MCP Chess.com Server

MCP Chess.com Server

Provides access to Chess.com's public API, allowing AI assistants to fetch player information and statistics.

Category
访问服务器

README

MCP Chess.com Server

A Model Context Protocol (MCP) server that provides access to Chess.com's public API, allowing AI assistants to fetch player information and statistics.

Features

  • Player Information: Get detailed player profiles including usernames, ratings, and account information
  • Player Statistics: Retrieve comprehensive game statistics including ratings across different time controls
  • MCP Integration: Seamlessly integrates with MCP-compatible AI assistants like Claude

Installation

Prerequisites

  • Python 3.10 or higher
  • uv package manager (recommended) or pip

Setup Instructions

  1. Initialize the project:

    uv init
    
  2. Create and activate virtual environment:

    uv venv
    .\.venv\Scripts\activate  # Windows
    # or
    source .venv/bin/activate  # Linux/macOS
    
  3. Install dependencies:

    uv add mcp[cli]
    uv sync
    
  4. Test the server:

    uv run chess
    

Project Structure

mcp-server-chess-com/
├── src/
│   └── chess/
│       ├── __init__.py
│       ├── chess_api.py      # Chess.com API client
│       └── server.py         # MCP server implementation
├── pyproject.toml            # Project configuration
├── uv.lock                   # Dependency lock file
└── README.md                 # This file

Configuration

MCP Client Setup (Claude/Cline)

To use this server with Claude via Cline, update your MCP settings:

  1. Locate the MCP settings file:

    • Path: ~/.config/claude-desktop/claude_desktop_config.json (macOS/Linux)
    • Path: %APPDATA%\Claude\claude_desktop_config.json (Windows)
    • Or for Cline: cline_mcp_settings.json
  2. Add the server configuration:

    {
      "mcpServers": {
        "server": {
          "command": "uv",
          "args": [
            "--directory",
            "BASE_PATH_TO_MCP_PROJECT\\mcp-server-chess-com",
            "run",
            "chess"
          ]
        }
      }
    }
    

    Note: Replace BASE_PATH_TO_MCP_PROJECT with the actual path to your project directory.

  3. Restart your MCP client to load the new server.

  4. Verify the server is loaded: After restarting, you should see the server listed in your MCP Servers panel as shown below:

    MCP Server Configuration

    The server should appear as "server" with a green status indicator, showing it's successfully connected and ready to use.

Usage

Once configured, you can interact with the Chess.com API through your MCP client:

Available Tools

get_chess_player_info

Retrieves basic player information.

Parameters:

  • username (string): Chess.com username

Example queries:

  • "What is the player details for Hikaru?"
  • "Get information about Magnus Carlsen's Chess.com profile"
  • "Show me details for the player 'GMHikaru'"

get_chess_player_stats

Retrieves detailed player statistics including ratings.

Parameters:

  • username (string): Chess.com username

Example queries:

  • "What are Hikaru's current ratings?"
  • "Show me Magnus Carlsen's chess statistics"
  • "Get the rating statistics for player 'GMHikaru'"

Sample Interactions

Here's an example of how the MCP server works in practice:

First Interaction Example

The screenshot above shows a real interaction where:

  • User Query: "What is the player details for Hikaru?"
  • MCP Tool Called: get_chess_player_info
  • Arguments: {"username": "GMHikaru"}
  • Response: Complete player profile data from Chess.com
  • Token Usage: Shows input/output tokens and cost per interaction
  • Performance: Demonstrates real-time API response with detailed player information
User: "What is the player details for Hikaru?"
Assistant: [Calls get_chess_player_info with username "GMHikaru"]

User: "What are Magnus Carlsen's current ratings?"
Assistant: [Calls get_chess_player_stats with username "MagnusCarlsen"]

API Reference

Chess.com API Endpoints Used

  • Player Profile: https://api.chess.com/pub/player/{username}
  • Player Stats: https://api.chess.com/pub/player/{username}/stats

Response Format

The server returns JSON data directly from Chess.com's API, including:

Player Info Response:

  • Player details (username, title, followers, etc.)
  • Account status and verification
  • Profile URLs and avatars

Player Stats Response:

  • Current ratings for different time controls (bullet, blitz, rapid, daily)
  • Game statistics (wins, losses, draws)
  • Performance metrics

Development

Building the Project

# Install in development mode
uv sync

# Run the server
uv run chess

# Run with debugging
uv run chess --debug

Project Configuration

The project uses the following key configurations in pyproject.toml:

[project]
name = "mcp-server-chess-com"
version = "0.1.0"
description = "Add your description here"
readme = "README.md"
requires-python = ">=3.10"
dependencies = [
    "mcp[cli]>=1.13.1",
    "requests>=2.25.0",
]

[project.scripts]
chess = "chess.server:main"

[build-system]
requires = ["setuptools"]
build-backend = "setuptools.build_meta"

[tool.setuptools]
package-dir= {"" = "src"}

[tool.setuptools.packages.find]
where = ["src"]

Dependencies

  • mcp[cli] (>=1.13.1): Model Context Protocol framework
  • requests (>=2.25.0): HTTP client for Chess.com API calls

Error Handling

The server includes robust error handling for:

  • Invalid usernames
  • API rate limiting
  • Network connectivity issues
  • Chess.com API downtime

Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Test thoroughly
  5. Submit a pull request

License

This project is licensed under the MIT License - see the LICENSE file for details.

Acknowledgments

  • Chess.com for providing the public API
  • The MCP community for the excellent protocol and tools
  • FastMCP for simplifying MCP server development

Support

For issues and questions:

  • Check Chess.com's API documentation: https://www.chess.com/news/view/published-data-api
  • Review MCP documentation: https://spec.modelcontextprotocol.io/
  • Open an issue in this repository

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选