Pokemon信息查询服务

一个与POKEAPI集成的服务器,通过MCP协议提供Pokemon信息查询功能,适用于LLM应用和MCP客户端。

  • by AkhrHysd
  • TypeScript
  • 本地部署
  • 更新于
在 GitHub 查看 akhrhysd/mcp-pokeapi-server

使用说明

mcp-pokeapi服务器

POKEAPI 的总和MCP(Model Context Protocol)是可以通过规格获取口袋妖怪信息的服务器。

概要

  • MCP 在协议(JSON-RPC2.0over stdio)中LLM 应用程序MCP 提供从客户端获取口袋妖怪信息的工具。
  • 波克派(https://pokeapi.co/)を利用。
  • 架构验证包括:动物圈中所述修改相应参数的值。

安装,安装

npm install

构建

npx tsc

开発用起动(ts-node)

npx ts-node src/index.ts

MCP 客户端使用示例

MCP 客户机和LLM 从应用程序中,用标准输入/输出JSON-RPC 提交请求。

1.获取工具列表(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": { ... }
      }
    ]
  }
}

2.获取口袋妖怪信息(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"]
        }
      }
    ]
  }
}

测试

npm test

参考