读取和写入 Pinecone 索引。
flowchart TB
subgraph 客户端["MCP 客户端(例如,Claude Desktop)"]
UI[用户界面]
end
subgraph MCPServer["MCP 服务器(pinecone-mcp)"]
Server[服务器类]
subgraph Handlers["请求处理器"]
ListRes[list_resources]
ReadRes[read_resource]
ListTools[list_tools]
CallTool[call_tool]
GetPrompt[get_prompt]
ListPrompts[list_prompts]
end
subgraph Tools["实现工具"]
SemSearch[语义搜索]
ReadDoc[读取文档]
ListDocs[列出文档]
PineconeStats[pinecone-stats]
ProcessDoc[处理文档]
end
end
subgraph PineconeService["Pinecone 服务"]
PC[Pinecone 客户端]
subgraph PineconeFunctions["Pinecone 操作"]
Search[搜索记录]
Upsert[更新或插入记录]
Fetch[获取记录]
List[列出记录]
Embed[生成嵌入]
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 索引的功能。
语义搜索: 在 Pinecone 索引中搜索记录。读取文档: 从 Pinecone 索引中读取文档。列出文档: 列出 Pinecone 索引中的所有文档。pinecone-stats: 获取关于 Pinecone 索引的统计信息,包括记录数、维度和命名空间。处理文档: 将文档分割成块并将其插入到 Pinecone 索引中。这执行了分块、嵌入和插入的整体步骤。注意:嵌入是通过 Pinecone 的推理 API 生成的,并且分块是使用基于令牌的分块器完成的。通过大量复制 langchain 和使用 Claude 进行调试编写。
要通过 Smithery 自动安装 Pinecone MCP 服务器用于 Claude Desktop:
npx -y @smithery/cli install mcp-pinecone --client claude
建议使用 uv 在本地安装服务器以供 Claude 使用。
uvx install mcp-pinecone
或者
uv pip install mcp-pinecone
按照下面的说明添加配置。
在 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 中创建一个新的索引,替换 {your-index-name} 并从 Pinecone 控制台获取 API 密钥,替换配置中的 {your-secret-api-key}。
为了准备分发包:
uv sync
uv build
这将在 dist/ 目录中创建源代码和轮子分布。
uv publish
注意:您需要通过环境变量或命令标志设置 PyPI 凭证:
--token 或 UV_PUBLISH_TOKEN--username/UV_PUBLISH_USERNAME 和 --password/UV_PUBLISH_PASSWORD由于 MCP 服务器通过标准 I/O 运行,调试可能会很困难。为了获得最佳的调试体验,我们强烈推荐使用 MCP Inspector。
您可以通过以下命令使用 npm 启动 MCP Inspector:
npx @modelcontextprotocol/inspector uv --directory {project_dir} run mcp-pinecone
启动后,Inspector 将显示一个 URL,您可以在浏览器中访问该 URL 开始调试。
本项目根据 MIT 许可证授权。详情见 LICENSE 文件。
源代码可在 GitHub 上找到。
将您的想法和反馈发送至 Bluesky 或通过打开问题进行贡献。