Pinecone索引协议服务器

一个用于Claude桌面的Pinecone索引读写服务,支持语义搜索、文档处理和索引统计功能。

  • by sirmews
  • Python
  • 本地部署
  • 150 星标
  • 更新于
在 GitHub 查看 sirmews/mcp-pinecone

使用说明

Claude Desktop的松果模型上下文协议服务器。

读写松果索引。

组件

flowchart TB
    subgraph Client["MCP Client (e.g., Claude Desktop)"]
        UI[User Interface]
    end

    subgraph MCPServer["MCP Server (pinecone-mcp)"]
        Server[Server Class]
        
        subgraph Handlers["Request Handlers"]
            ListRes[list_resources]
            ReadRes[read_resource]
            ListTools[list_tools]
            CallTool[call_tool]
            GetPrompt[get_prompt]
            ListPrompts[list_prompts]
        end
        
        subgraph Tools["Implemented Tools"]
            SemSearch[semantic-search]
            ReadDoc[read-document]
            ListDocs[list-documents]
            PineconeStats[pinecone-stats]
            ProcessDoc[process-document]
        end
    end

    subgraph PineconeService["Pinecone Service"]
        PC[Pinecone Client]
        subgraph PineconeFunctions["Pinecone Operations"]
            Search[search_records]
            Upsert[upsert_records]
            Fetch[fetch_records]
            List[list_records]
            Embed[generate_embeddings]
        end
        Index[(Pinecone Index)]
    end

    %% Connections
    UI --> Server
    Server --> Handlers
    
    ListTools --> Tools
    CallTool --> Tools
    
    Tools --> PC
    PC --> PineconeFunctions
    PineconeFunctions --> Index
    
    %% Data flow for semantic search
    SemSearch --> Search
    Search --> Embed
    Embed --> Index
    
    %% Data flow for document operations
    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

资源

服务器实现了对松果索引的读写功能。

工具

  • semantic-search:在松果索引中搜索记录。
  • read-document:阅读松果索引中的文档。
  • list-documents:列出松果索引中的所有文档。
  • pinecone-stats:获取Pinecone索引的统计信息,包括记录数、维度和命名空间。
  • process-document:将文档处理成块,并将其追加到松果索引中。这执行了分块、嵌入和加扰的整体步骤。

注意:嵌入是通过Pinecone的推理API生成的,分块是通过基于标记的分块器完成的。通过大量复制langchain编写,并使用Claude进行调试。

快速启动

通过Smithery安装

通过以下方式自动安装Claude Desktop的松果MCP服务器 史密瑟里:

npx -y @smithery/cli install mcp-pinecone --client claude

安装服务器

建议使用 紫外线 在本地为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帐户 这里.

获取API密钥

在Pinecone中创建新索引,替换 {your-index-name} 并从Pinecone仪表板获取API密钥,替换 {your-secret-api-key} 在配置中。

发展

建筑与出版

准备分发包裹:

  1. 同步依赖关系并更新锁文件:
uv sync
  1. 构建包分发:
uv build

这将在 dist/ 目录。

  1. 发布到PyPI:
uv publish

注意:您需要通过环境变量或命令标志设置PyPI凭据:

  • 令牌: --token 或 UV_PUBLISH_TOKEN
  • 或用户名/密码: --username/UV_PUBLISH_USERNAME 和 --password/UV_PUBLISH_PASSWORD

调试

由于MCP服务器在stdio上运行,调试可能具有挑战性。为了达到最佳调试效果 经验,我们强烈建议使用 MCP检查员.

您可以通过以下方式启动MCP检查器 npm 使用此命令:

npx @modelcontextprotocol/inspector uv --directory {project_dir} run mcp-pinecone

启动后,检查器将显示一个URL,您可以在浏览器中访问该URL以开始调试。

许可证

该项目根据MIT许可证获得许可。请参阅 许可证 文件以获取详细信息。

源代码

源代码可在 GitHub.

贡献

请将您的想法和反馈发送给我 蓝天 或者打开一个问题。