Skip to main content
Glama

Chess MCP Server

store.ts737 B
import { writeFile, readFile, mkdir } from "node:fs/promises"; import { existsSync } from "node:fs"; import { Chess } from "chess.js"; export async function saveGame( sessionId: string | undefined, game: Chess, ): Promise<void> { // Ensure games directory exists if (!existsSync("./games")) { await mkdir("./games", { recursive: true }); } await writeFile( `./games/${sessionId}.json`, JSON.stringify(game.fen(), null, 2), ); } export async function loadGame(sessionId?: string): Promise<Chess | null> { if (!existsSync(`./games/${sessionId}.json`) || !sessionId) { return null; } const data = await readFile(`./games/${sessionId}.json`, "utf-8"); const fen = JSON.parse(data) as string; return new Chess(fen); }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/ibuildthecloud/chess-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server