Back to MCP directory
publicPublicdnsLocal runtime

mcp-pokeapi-server

一个与POKEAPI对接的MCP协议服务器,提供通过JSON-RPC获取宝可梦信息的工具服务。

article

README

🚀 mcp-pokeapi-server

本项目将POKEAPI与MCP(模型上下文协议)规范相结合,为用户提供了一个获取宝可梦信息的工具服务器。它允许LLM应用或MCP客户端通过特定协议方便地获取宝可梦的相关信息。

🚀 快速开始

安装依赖

npm install

项目构建

npx tsc

开发环境启动(使用ts-node)

npx ts-node src/index.ts

运行测试

npm test

✨ 主要特性

  • 采用MCP协议(JSON - RPC 2.0 over stdio),支持LLM应用和MCP客户端获取宝可梦信息。
  • 借助POKEAPI(https://pokeapi.co/)获取宝可梦的详细数据。
  • 使用zod进行模式验证,确保数据的准确性。

💻 使用示例

基础用法

从MCP客户端获取工具列表(list_tools)

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "list_tools"
}

响应示例

{
  "jsonrpc": "2.0",
  "id": 1,
  "result": {
    "tools": [
      {
        "name": "getPokemonInfo",
        "description": "从宝可梦名称或ID中,通过POKEAPI获取宝可梦信息。",
        "input_schema": { ... },
        "output_schema": { ... }
      }
    ]
  }
}

获取宝可梦信息(call_tool)

{
  "jsonrpc": "2.0",
  "id": 2,
  "method": "call_tool",
  "params": {
    "name": "getPokemonInfo",
    "arguments": {
      "nameOrId": "pikachu"
    }
  }
}

响应示例

{
  "jsonrpc": "2.0",
  "id": 2,
  "result": {
    "content": [
      {
        "type": "json",
        "data": {
          "name": "pikachu",
          "id": 25,
          "height": 4,
          "weight": 60,
          "types": ["electric"]
        }
      }
    ]
  }
}

📚 详细文档

参考资料

help

Runtime guide

cloud

Hosted runtime

Hosted servers run from a provider-managed environment. You usually connect the MCP client to the hosted endpoint or follow the provider's authorization flow, without keeping a local process alive

  1. Open provider connection page
  2. Authorize or copy endpoint
  3. Connect from your MCP client
terminal

Local runtime / other methods

Local servers run on your own machine or infrastructure. You normally copy the server_config into your MCP client, install the required package, and provide env variables from env_schema when needed

  1. Copy server_config
  2. Install required package
  3. Fill env variables and restart client