Pinecone模型上下文协议服务器用于Claude桌面版。
读取和写入Pinecone索引。
组件
flowchart TB
subgraph 客户端["MCP客户端(例如Claude桌面版)"]
UI[用户界面]
end
subgraph MCPServer["MCP服务器(pinecone-mcp)"]
Server[服务器类]
subgraph 处理器["请求处理器"]
ListRes[list_resources]
ReadRes[read_resource]
ListTools[list_tools]
CallTool[call_tool]
GetPrompt[get_prompt]
ListPrompts[list_prompts]
end
subgraph 工具["实现工具"]
SemSearch[semantic-search]
ReadDoc[read-document]
ListDocs[list-documents]
PineconeStats[pinecone-stats]
ProcessDoc[process-document]
end
end
subgraph PineconeService["Pinecone服务"]
PC[Pinecone客户端]
subgraph PineconeFunctions["Pinecone操作"]
Search[search_records]
Upsert[upsert_records]
Fetch[fetch_records]
List[list_records]
Embed[generate_embeddings]
end
Index[(Pinecone索引)]
end
%% 连接
UI --> Server
Server --> Handlers
ListTools --> Tools
CallTool --> Tools
Tools --> PC
PC --> PineconeFunctions
PineconeFunctions --> Index
%% 语义搜索的数据流
SemSearch --> Search
Search --> Embed
Embed --> Index
%% 文档操作的数据流
UpsertDoc --> Upsert
ReadDoc --> Fetch
ListRes --> List
classDef primary fill:#2563eb,stroke:#1d4ed8,color:white
classDef secondary fill:#4b5563,stroke:#374151,color:white
classDef storage fill:#059669,stroke:#047857,color:white
class Server,PC primary
class Tools,Handlers secondary
class Index storage
资源
服务器实现了读取和写入Pinecone索引的功能。
工具
semantic-search:在Pinecone索引中搜索记录。read-document:从Pinecone索引中读取文档。list-documents:列出Pinecone索引中的所有文档。pinecone-stats:获取关于Pinecone索引的统计信息,包括记录数、维度和命名空间。process-document:将文档处理成片段并插入到Pinecone索引中。这执行了分块、嵌入和插入的整体步骤。
注意:嵌入通过Pinecone的推理API生成,分块使用基于token的分块器完成。通过大量复制langchain并使用Claude进行调试编写。
快速入门
通过Smithery安装
通过Smithery自动安装Claude桌面版的Pinecone MCP服务器:
npx -y @smithery/cli install mcp-pinecone --client claude
安装服务器
建议使用uv在本地为Claude安装服务器。
uvx install mcp-pinecone
OR
uv pip install mcp-pinecone
按照以下说明添加您的配置。
Claude桌面版
在MacOS上:~/Library/Application\ Support/Claude/claude_desktop_config.json
在Windows上:%APPDATA%/Claude/claude_desktop_config.json
注意:您可能需要使用uv的直接路径。使用which uv查找路径。
开发/未发布服务器配置
"mcpServers": {
"mcp-pinecone": {
"command": "uv",
"args": [
"--directory",
"{project_dir}",
"run",
"mcp-pinecone"
]
}
}
已发布服务器配置
"mcpServers": {
"mcp-pinecone": {
"command": "uvx",
"args": [
"--index-name",
"{your-index-name}",
"--api-key",
"{your-secret-api-key}",
"mcp-pinecone"
]
}
}
注册Pinecone
您可以在这里注册Pinecone账号。
获取API密钥
在Pinecone中创建一个新的索引,替换{your-index-name}并从Pinecone控制台获取API密钥,替换配置中的{your-secret-api-key}。
开发
构建和发布
准备用于分发的包:
- 同步依赖项并更新锁文件:
uv sync
- 构建包分发:
uv build
这将创建源代码和轮包在dist/目录中。
- 发布到PyPI:
uv publish
注意:您需要通过环境变量或命令标志设置PyPI凭证:
- 令牌:
--token或UV_PUBLISH_TOKEN - 或者用户名/密码:
--username/UV_PUBLISH_USERNAME和--password/UV_PUBLISH_PASSWORD
调试
由于MCP服务器通过stdio运行,调试可能具有挑战性。为了获得最佳调试体验,我们强烈建议使用MCP Inspector。
您可以通过npm使用以下命令启动MCP Inspector:
npx @modelcontextprotocol/inspector uv --directory {project_dir} run mcp-pinecone
启动后,Inspector将显示一个URL,您可以在浏览器中访问以开始调试。
许可证
本项目根据MIT许可证授权。有关详细信息,请参阅LICENSE文件。
源代码
源代码可在GitHub上获取。
贡献
请通过Bluesky或通过打开问题向我发送您的想法和反馈。