MCP SGF Server

by ragnar-johannsson

Not rated
GitHub

About

Process SGF (Smart Game Format) files to extract game information and generate visual board diagrams.

Details

Author
ragnar-johannsson
Categories
Developer Tools, Other, File Management

Setup

Install MCP SGF Server in your MCP client (Claude Desktop, Cursor, Windsurf, and others).

Repository: https://github.com/ragnar-johannsson/mcp-sgf

Follow the installation instructions in the repository README, then restart your MCP client.

AModel Context Protocol (MCP)server for processing SGF (Smart Game Format) files. Extract game information and generate visual board diagrams with.

- Extract comprehensive game informationfrom SGF files
- Generate visual board diagramswith customizable themes and formats
- High performance: ≤200ms for game info, ≤500ms for diagrams
- Robust validationwith detailed error handling
- TypeScript strict modewith 100% type safety
- 91.73% test coveragewith 139 comprehensive tests
- Multiple output formats: PNG and SVG support
- Customizable themes: Classic, modern, and minimal styles

Start the MCP server instantly without installation:

The server will start and listen for MCP protocol connections on stdio.

git clone <repository-url> cd mcp-sgf npm install npm run build npm start

To use this server with MCP-compatible clients (Claude Desktop, etc.), add the following configuration:

Claude Desktop Configuration (claude_desktop_config.json):

{ "mcpServers": { "sgf": { "command": "npx", "args": ["mcp-sgf"] } } }
{ "mcpServers": { "sgf": { "command": "mcp-sgf" } } }

The MCP SGF server provides two main tools that can be called via the MCP protocol:

1. Extract Game Information (get-sgf-info)

Extract comprehensive metadata from SGF files including player information, game rules, and results.

{ "tool": "get-sgf-info", "arguments": { "sgfContent": "(;FF[4]GM[1]SZ[19]PB[Lee Sedol]PW[AlphaGo]BR[9p]WR[-]KM[7.5]RE[W+R]DT[2016-03-09];B[pd];W[dp];B[cd];W[qp])" } }
{ "success": true, "data": { "gameInfo": { "playerBlack": "Lee Sedol", "playerWhite": "AlphaGo", "blackRank": "9p", "whiteRank": "-", "boardSize": 19, "komi": 7.5, "result": "W+R", "date": "2016-03-09", "fileFormat": 4, "gameType": 1 }, "metadata": { "totalMoves": 4, "boardSize": 19, "hasValidStructure": true }, "warnings": [] } }

2. Generate Board Diagrams (get-sgf-diagram)

Create visual board diagrams showing game positions with customizable appearance.

{ "tool": "get-sgf-diagram", "arguments": { "sgfContent": "(;FF[4]GM[1]SZ[19];B[pd];W[dp];B[cd];W[qp];B[ed];W[fq])", "moveNumber": 4, "width": 800, "height": 800, "theme": "modern", "coordLabels": true, "moveNumbers": false, "format": "png" } }
{ "success": true, "data": { "mimeType": "image/png", "width": 800, "height": 800, "movesCovered": 4, "boardSize": 19, "parameters": { "moveNumber": 4, "format": "png", "theme": "modern" } } }

The response includes base64-encoded image data with the specified MIME type.

- classic: Traditional wood board with classic stones
- modern: Clean, contemporary appearance
- minimal: Simplified design for clarity

- png: Raster format, best for viewing and sharing
- svg: Vector format, scalable and editable

- Range: 1×1 to 361×361 boards
- Common: 9×9, 13×13, 19×19
- Automatic: Size detection from SGF content

npm run build # Build TypeScript to JavaScript npm run dev # Development mode with watch npm test # Run all tests with coverage npm run lint # ESLint checking npm run format # Prettier formatting npm run type-check # TypeScript type checking

When integrating programmatically, use these JSON message formats:

{ "jsonrpc": "2.0", "id": 1, "method": "tools/list" }
{ "jsonrpc": "2.0", "id": 2, "method": "tools/call", "params": { "name": "get-sgf-info", "arguments": { "sgfContent": "(;FF[4]GM[1]SZ[19]PB[Lee Sedol]PW[AlphaGo]BR[9p]WR[-]KM[7.5]RE[W+R]DT[2016-03-09];B[pd];W[dp];B[cd];W[qp])" } } }
{ "jsonrpc": "2.0", "id": 3, "method": "tools/call", "params": { "name": "get-sgf-diagram", "arguments": { "sgfContent": "(;FF[4]GM[1]SZ[19];B[pd];W[dp];B[cd];W[qp];B[ed];W[fq])", "moveNumber": 4, "width": 800, "height": 800, "theme": "modern", "format": "png" } } }
mcp-sgf/ ├── src/ │ ├── index.ts # MCP server entry point │ ├── tools/ # MCP tool implementations │ │ ├── getSgfInfo.ts # Game information extraction │ │ └── getSgfDiagram.ts # Diagram generation │ ├── utils/ # Utility functions │ │ ├── sgfParser.ts # SGF parsing logic │ │ ├── diagramRenderer.ts # Image generation │ │ └── validation.ts # Input validation │ └── types/ │ └── sgf.ts # TypeScript type definitions ├── tests/ # Comprehensive test suite ├── docs/ # Documentation └── package.json # Dependencies and scripts
# Run all tests npm test # Run specific test suite npm test tests/getSgfInfo.test.ts # Run with coverage report npm test -- --coverage # Run performance tests npm test tests/performance.test.ts

- TypeScript: Strict mode with 100% type coverage
- ESLint: Zero warnings with strict rules
- Prettier: Consistent code formatting
- Vitest: 95% coverage threshold enforced
- Performance: Response time targets validated

The server provides comprehensive error handling with specific error types:

{ "success": false, "error": { "type": "INVALID_FORMAT", "message": "Invalid SGF format. SGF files must start with '(' and end with ')' and contain at least one property.", "details": {} } }

MIT License - seeLICENSEfile for details.

- Tool Reference: Complete API documentation
-
OpenAPI Schema: Machine-readable specification
-
Model Context Protocol: MCP specification

This is a web browser that enables your coding agent, such as Claude Code, to visit websites on your behalf and assist you in identifying bugs or creating UI test cases.

Interact with the EVE Online ESI API to access game data and services.

An MCP server for interacting with the EVE Online ESI (EVE Swagger Interface) API.

Access NEXON MapleStory open API data for character info, union details, guild data, rankings, and game mechanics.

Quickly integrate with Tencent Cloud Storage (COS) and Data Processing (CI) capabilities powered

Remote MCP server with real-money crypto casino audit data: trust scores, rankings, live payout tests, and T&C-decoded bonuses. No API key, Ed25519-signed answers. Endpoint: https://wagerx.io/mcp

Access player data, game records, and public information from Chess.com's Published Data API.

An MCP server that provides chess statistics for any player.

A server for processing PDF files, allowing text and table extraction, metadata retrieval, and file listing within a specific directory.

A server for managing Dungeons & Dragons campaigns, storing all data in local JSON files.

A read-only MCP server by CData that allows LLMs to query live Dropbox data. Requires the CData JDBC Driver for Dropbox.

No reviews yet — be the first

Sign in to leave a review

Use Google, GitHub, or an email account so ratings stay tied to real people.

Email sign in

No reviews posted yet.