Chess MCP Server

Chess MCP Server

Provides an interactive chess game experience through MCP tools with a web-based chessboard interface. Enables users to play chess games, make moves using standard algebraic notation, and manage persistent game state across sessions.

Category
Visit Server

README

Chess MCP Server

A Model Context Protocol (MCP) server that provides an interactive chess game experience using MCP-UI. This server exposes chess game functionality through MCP tools and provides a web-based chessboard interface for playing games.

Features

  • ā™Ÿļø Full Chess Game: Complete chess implementation using chess.js
  • šŸ”§ MCP Tools: Chess game actions exposed as MCP tools
  • šŸŽ® Interactive UI: Web-based chessboard using ChessBoard.js
  • šŸ’¾ Game State Management: Persistent game state with session-based saves

Workshop

In the ./workshop directory, you can find a step by step to creating this MCP server.

Architecture

This MCP server is built using Express.js with integrated MCP capabilities:

Key Components

  • MCP Server (src/server.ts): Main server with chess tools and UI generation
  • Store (src/lib/store.ts): Game state persistence using file system
  • MCP Framework (src/lib/mcp/): Custom MCP middleware implementation with Express integration

MCP Tools Available

  • chess_get_board_state: Get the current state of the chess board with visual representation
  • chess_move: Make a move in standard algebraic notation (e.g., e4, Nf3, O-O) or start a new game

Getting Started

Prerequisites

  • Node.js 18+
  • npm

Installation

Install the dependencies:

npm install

Development

Start the development server:

npm run dev

The server will be available at:

  • MCP endpoint: http://localhost:3000/mcp

Development Commands

  • npm run dev - Start development server

Usage

As an MCP Server

The server exposes MCP tools that can be consumed by MCP clients:

// Get current board state
{
  "method": "tools/call",
  "params": {
    "name": "chess_get_board_state",
    "arguments": {}
  }
}

// Make a move
{
  "method": "tools/call",
  "params": {
    "name": "chess_move",
    "arguments": {
      "move": "e4"
    }
  }
}

// Start a new game
{
  "method": "tools/call",
  "params": {
    "name": "chess_move",
    "arguments": {
      "move": "new"
    }
  }
}

Interactive Chessboard

When using the MCP tools, each response includes:

  • Text representation: ASCII board and FEN notation with valid moves
  • Interactive UI: Drag-and-drop chessboard that allows moves via mouse interaction

Game Rules

  • Standard chess rules apply
  • Uses chess.js for move validation and game logic
  • Supports all legal chess moves including castling, en passant, and pawn promotion
  • Game state persists per session ID

Project Structure

src/
ā”œā”€ā”€ lib/
│   ā”œā”€ā”€ mcp/           # Custom MCP middleware framework
│   │   ā”œā”€ā”€ index.ts   # Main exports
│   │   ā”œā”€ā”€ middleware.ts  # Express middleware integration
│   │   ā”œā”€ā”€ header.ts  # HTTP header utilities
│   │   └── uuid.ts    # UUID validation
│   └── store.ts       # Game state persistence
ā”œā”€ā”€ server.ts          # Main server with chess tools and UI
games/                 # Persistent game files (FEN notation)

Game State Persistence

  • Each chess game is saved to a JSON file in the games/ directory
  • Games are identified by MCP session ID
  • Game state is stored as FEN (Forsyth-Edwards Notation) strings
  • Games automatically resume when reconnecting with the same session

Dependencies

  • chess.js: Chess game logic and move validation
  • @chrisoakman/chessboardjs: Interactive chessboard UI
  • @mcp-ui/server: MCP UI resource creation
  • @modelcontextprotocol/sdk: MCP server implementation
  • express: Web server framework

License

Apache 2.0 License - see LICENSE file for details.

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
E2B

E2B

Using MCP to run code via e2b.

Official
Featured