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.tsMCP 客户端使用示例
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______________________________________________________________________
