MCP PI 仪表板服务器添加福利群:解决AI开发者的「MCP实战痛点」这是一个 Model Context Protocol (MCP) 服务器,为与 PI 仪表板 API 交互提供了标准化的工具和资源。此实现使 Claude 和其他兼容 MCP 的 AI 助手能够安全地访问和管理 PI 仪表板资源,包括类别和图表。
以下是在完成设置后,此 MCP 服务器的典型使用场景示例。
初始认证:
Ensure the PI API MCP server is running Set the API URL to http://localhost:8224/pi/api/v2 Use the authenticate tool for authentication guidance Check the connection status to verify everything is working List two charts from the dashboard
图表分析:
Retrieve the metadata from chart ID 450 Extract the chart JSON data from ID 450 Identify chart IDs associated with claims Obtain JSON data for the identified charts Analyze the data to generate actionable insights
示例输出:
要通过 Smithery 自动安装 pi-api-mcp-server 到 Claude Desktop:
npx -y @smithery/cli install @mingzilla/pi-api-mcp-server --client claude
{
"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"
],
"disabled": false,
"autoApprove": [
"keep-session-alive",
"check-connection",
"authenticate",
"list-categories",
"get-category",
"list-charts",
"get-chart",
"export-chart",
"get-filterable-attributes",
"export-chart"
]
}
}
}

重要提示:如果在初始化时未提供 --api-url 参数,服务器会在执行任何操作之前提示您使用 set-api-url 工具配置 API URL。这种设计使得在启动时 URL 尚未确定的环境中也能灵活配置。
访问您的 Claude for Desktop 应用程序配置文件的位置如下:
~/Library/Application Support/Claude/claude_desktop_config.json%APPDATA%\Claude\claude_desktop_config.json获取图表实体的可过滤属性
将 API URL 设置为 http://localhost:8224/pi/api/v2
以下是一些与Claude连接服务器后使用的示例查询:
Please use the set-api-url tool to set the PI API URL to http://localhost:8224/pi/api/v2
Please help me authenticate to the PI API.
I have a token. Please use the keep-session-alive tool with my token: [YOUR_TOKEN_HERE]
Please check if my connection to the PI API is working properly.
List all categories in the dashboard.
Get details about category with ID 123.
List all the charts available in the dashboard.
Export chart with ID 456 as a PDF.
Get the filterable attributes for chart entities to understand what fields I can filter on.
List charts with description containing "revenue" using the filter option.
Analyze the categories in the dashboard.
Compare data between charts 123 and 456.
Show me how to use filters effectively with this API.
start.sh来运行开发服务器。# Clone the repository (SSH or HTTPS option)
git clone git@github.com:mingzilla/pi-api-mcp-server.git
cd pi-api-mcp-server
# Install dependencies
npm install
./dependencies.sh # Installs global dependencies to enable MCP client connection via "@mingzilla/pi-api-mcp-server"
# Build the project
npm run build
# Execute the server
npm start

# Global installation
npm install -g @mingzilla/pi-api-mcp-server
# Direct execution via npx
npx @mingzilla/pi-api-mcp-server --api-url "http://localhost:8224/pi/api/v2" --auth-token "XXXXXXXX"

与桌面版Claude集成:
./dependencies.sh以安装所需依赖@mingzilla/pi-api-mcp-server引用的是通过“本地执行”安装的包){
"mcpServers": {
"pi-api": {
"command": "npx",
"args": [
"-y",
"@mingzilla/pi-api-mcp-server",
"--api-url",
"http://localhost:8224/pi/api/v2",
"--auth-token",
"XXXXXXXX"
],
"autoApprove": [
"keep-session-alive",
"check-connection",
"authenticate",
"list-categories",
"get-category",
"list-charts",
"get-chart",
"export-chart",
"get-filterable-attributes",
"export-chart"
]
}
}
}

./start.sh运行服务器build/index.js文件路径的配置./start.sh
{
"mcpServers": {
"pi-api": {
"command": "node",
"args": [
"/home/mingzilla/dev/tool-mcp-pi-api-server/build/index.js",
"--api-url",
"http://localhost:8224/pi/api/v2",
"--auth-token",
"XXXXXXXX"
],
"autoApprove": [
"keep-session-alive",
"check-connection",
"authenticate",
"list-categories",
"get-category",
"list-charts",
"get-chart",
"export-chart",
"get-filterable-attributes",
"export-chart"
]
}
}
}

MIT许可证
Ming Huang (mingzilla)