百度向量数据库MCP Server提供了对百度云向量数据库功能的访问,方便开发者使用相关服务,与各类支持模型上下文协议的大语言模型应用程序协同工作。
在使用百度云向量数据库MCP Server之前,请确保你具备以下条件:
使用百度云向量数据库MCP Server的推荐方式是通过uv运行,而无需进行安装。具体步骤如下:
git clone https://github.com/baidu/mochow-mcp-server-python.git
cd mochow-mcp-server-python
uv运行,其中endpoint和api-key根据实际需要修改:uv run src/mochow_mcp_server/server.py
uv run src/mochow_mcp_server/server.py --endpoint http://127.0.0.1:8287 --api-key mochow
或者,在src/mochow_mcp_server/目录中修改.env文件来设置环境变量,再使用以下命令运行服务器:
uv run src/mochow_mcp_server/server.py
百度云向量数据库MCP Server可以与各种支持模型上下文协议的大语言模型应用程序配合使用,具体如下:
~/Library/Application Support/Claude/claude_desktop_config.json。{
"mcpServers": {
"mochow": {
"command": "/PATH/TO/uv",
"args": [
"--directory",
"/path/to/mochow-mcp-server-python/src/mochow_mcp_server",
"run",
"server.py",
"--endpoint",
"http://127.0.0.1:8287",
"--api-key",
"mochow"
]
}
}
}
Cursor 也支持 MCP工具。你可以通过以下方式将百度MCP Server添加到Cursor中:
Cursor设置>功能>MCP,点击+添加新的MCP服务器按钮,在mcp.json中添加以下配置:{
"mcpServers": {
"mochow": {
"command": "/PATH/TO/uv",
"args": [
"--directory",
"/path/to/mochow-mcp-server-python/src/mochow_mcp_server",
"run",
"server.py",
"--endpoint",
"http://127.0.0.1:8287",
"--api-key",
"mochow"
]
}
}
}
How many databases do i have in the mochow db?
Claude将使用百度云向量数据库MCP Server提供的list_databases来获取数据库列表。
Let me check how many databases you have in the Mochow instance.
You have 2 databases in your Mochow instance:
1. book
2. test
I want to get the detail of table named book_segments in database book.
Claude将使用百度云向量数据库MCP Server提供的describe_table来获取表的详情信息。
I'll help you get the details of the "book_segments" table in the "book" database. Let me first switch to the "book" database and then describe the table.
Here's the information about the "book_segments" table in the "book" database:
Database: book
Table Name: book_segments
Creation Time: 2025-05-06 11:08:22
State: NORMAL
Schema:
id (STRING)
Primary Key: Yes
Partition Key: Yes
Not Null: Yes
bookName (STRING)
Not Null: Yes
author (STRING)
Not Null: No
page (UINT32)
Not Null: No
segment (TEXT)
Not Null: No
vector (FLOAT_VECTOR)
Not Null: Yes
Dimension: 1024
Indexes
book_name_filtering_idx (FILTERING_INDEX)
Field: bookName
Order: ASCEND
Structure Type: DEFAULT
vector_idx (HNSW)
Field: vector
Metric Type: L2
Auto Build: False
Parameters: (M: 16 efConstruction: 200)
百度云向量数据库MCP Server提供以下工具:
list_databases:列出数据库中所有的Databasecreate_database:创建一个新的Database
database_name:待创建的Database名称use_database:切换到一个已存在的Database
database_name:待切换的Database名称list_tables:列出数据库中所有的Tabledescribe_table:获取指定Table的详细信息
table_name:Table名称stats_table:获取指定Table的统计信息
table_name:Table名称delete_table_rows:使用过滤表达式删除数据
table_name:Table名称filter_expr:过滤表达式select_table_rows:使用过滤表达式查询数据
table_name:Table名称filter_expr:过滤表达式limit:查询结果的最大条数output_fields:查询结果中要返回的字段名create_vector_index:在指定向量字段上创建向量索引
table_name:Table名称index_name:向量索引名称field_name:向量字段名称index_type:向量索引类型metric_type:向量索引的距离度量params:向量索引的创建参数rebuild_vector_index:重新构建指定向量索引
table_name:Table名称index_name:向量索引名称drop_vector_index:删除指定向量索引
table_name:Table名称index_name:向量索引名称describe_index:获取指定索引的详情信息
table_name:Table名称index_name:向量索引名称vector_search:执行带标量过滤的向量相似性检索
table_name:Table名称vector:向量vector_field:向量字段名称limit:相似性检索结果中返回最接近目标向量的记录数量filter_expr:过滤表达式output_fields:查询结果中要返回的字段名fulltext_search:执行全文检索
table_name:Table名称index_name:向量索引名称search_text:全文检索的检索表达式limit:全文检索返回相关性最高的条目数filter_expr:过滤表达式output_fields:查询结果中要返回的字段名| 属性 | 详情 |
|---|---|
MOCHOW_ENDPOINT |
百度云向量数据库连接实例URI |
MOCHOW_API_KEY |
百度云向量数据库实例API密钥 |