PokeMCP Server - Pokémon Server with Model Context Protocol (MCP)

PokeMCP Server - Pokémon Server with Model Context Protocol (MCP)

site icon
2025.05.03 0
C#Pokémon 服务游戏数据查询娱乐功能
PokeMCP Server 是一个基于 Model Context Protocol (MCP) 的 Pokémon 服务器,提供 Pokémon 相关信息查询、战斗结果计算和闪光 Pokémon 遭遇概率估算等功能。
View on GitHub

Overview

基本能力

产品定位

PokeMCP Server 是一个 Pokémon 相关的服务器,主要用于提供 Pokémon 信息查询、战斗计算和闪光概率估算等功能。

核心功能

  • 通过 PokeAPI 获取 Pokémon 信息
  • 计算两只 Pokémon 之间的战斗结果
  • 估算闪光 Pokémon 的遭遇概率
  • 基于 Clean Architecture 原则构建
  • 使用 MCP 协议进行客户端-服务器通信

适用场景

  • Pokémon 游戏开发者需要查询 Pokémon 数据
  • 玩家需要计算战斗结果或闪光概率
  • 需要与 MCP 客户端集成的应用

工具列表

  • PokeApiTool: 通过 GetPokemonInfo(pokemonName) 获取 Pokémon 的详细信息。
  • PokeFunctionsTool: 通过 GetBattleResult(attacker, defender) 计算战斗结果,通过 ProbabilityFindingShiny(encounters, hasShinyCharm) 计算闪光概率。

常见问题解答

使用教程

使用依赖

  • .NET 9
  • 互联网连接(用于访问 PokeAPI)

安装教程

  1. 克隆仓库: git clone https://github.com/GuillermoRuizDev/PokeMCP-Server.git cd PokeMCP

  2. 恢复依赖: dotnet restore

  3. 构建项目: dotnet build

调试方式

  1. 运行开发模式: dotnet run --project PokeMCP

  2. 默认运行在:

  3. HTTP: http://localhost:3002
  4. HTTPS: https://localhost:7133

  5. 验证是否正常工作:访问 http://localhost:3002/home,应看到消息:"Pokemon MCP Server - Ready for use with SSE"。

集成 MCP 客户端

  1. mcp.json 文件中添加以下 JSON:
{
    "servers": {        
        "pokeapi-mcp-server": {
            "type": "sse",
            "url": "http://localhost:3002/sse"
        }
    }
}
  1. 使用暴露的工具与 Pokémon 功能交互。

许可证

该项目遵循 MIT 开源许可条款,请参阅 MIT 了解完整条款。