PI API MCP 服务器

PI API MCP 服务器

为 PI API 提供标准化工具和资源的 MCP(模型上下文协议)服务器。

快速入门

  1. 安装依赖 克隆仓库并安装依赖:

    git clone git@github.com:mingzilla/pi-api-mcp-server.git
    cd pi-api-mcp-server
    npm install
    ./dependencies.sh
    
  2. 构建项目 执行以下命令以构建项目:

    npm run build
    
  3. 运行服务器 使用以下命令启动服务器:

    npm start
    
  4. Docker 安装(推荐) 配置 MCP 客户端文件并运行 Docker:

    {
      "mcpServers": {
        "pi-api": {
          "command": "docker",
          "args": [
            "run",
            "-i",
            "--rm",
            "-e",
            "API_URL=http://localhost:8224/pi/api/v2",
            "-e",
            "PI_API_KEY=XXXXXXXX",
            "mingzilla/pi-api-mcp-server"
          ]
        }
      }
    }
    
  5. 验证连接 使用工具检查连接状态:

    check-connection
    
  6. 认证 设置 API URL 并进行身份验证:

    set-api-url http://localhost:8224/pi/api/v2
    authenticate
    
  7. 更多功能

    • 列出所有分类:list-categories
    • 导出图表:export-chart <chart_id>