Skip to main content
Glama
donovan-fournier

Cloudflare Workshop MCP Server

README.md
# Cloudflare Workshop MCP Server

A Model Context Protocol (MCP) server implementation for Cloudflare Workers that provides chess-related tools and functionality using the Chess.com API.

āš ļø README generated by AI

## Context

This MCP server was developed for the Cloudflare Workshop on "Building and Deploying Remote MCP Servers with
Cloudflare" [šŸ”— Workshop Link](https://cloudflare.ondemand.goldcast.io/on-demand/e274bc65-8118-43e3-8e57-bdff56f5b4fd)

## Features

- Get daily chess puzzles from Chess.com
- View currently live chess streamers
- Retrieve detailed player information and statistics
- List titled players by category (GM, IM, etc.)
- Implements the Model Context Protocol for AI assistant integration

## Claude Desktop Setup

To use this MCP server with Claude desktop application:

1. Open Claude desktop settings
2. Navigate to the configuration file location
3. Add the following configuration to enable the chess tools:
```json
{
  "mcpServers": {
    "workshop_chess": {
      "command": "npx",
      "args": [
        "mcp-remote",
        "https://cloudflare-workshop-mcp-server.donovan-5a5.workers.dev/sse"
      ]
    }
  }
}
```

### Prerequisites

- [Node.js](https://nodejs.org/) (v18 or later recommended)
- [npm](https://www.npmjs.com/) (included with Node.js)
- [Cloudflare account](https://dash.cloudflare.com/sign-up) (for deployment)

### Setup

1. Clone the repository:

2. Install dependencies:
   ```bash
   npm install
   ```

3. Set up environment variables:
   Create a `.dev.vars` file in the project root for local development with any required API keys or configuration values.

## Local Development

To run the server locally:

```bash
npm run dev
```

This will start the development server using Wrangler, Cloudflare's command-line tool for Workers. The server will be available at `http://localhost:8787` by default.

### Available Scripts

- `npm run dev` or `npm start`: Start the development server
- `npm run deploy`: Deploy to Cloudflare Workers
- `npm run format`: Format code using Biome
- `npm run lint:fix`: Lint and fix code issues
- `npm run type-check`: Check TypeScript types

## Deployment

To deploy the MCP server to Cloudflare Workers:

1. Make sure you're logged in to Cloudflare:
   ```bash
   npx wrangler login
   ```

2. Push environment variables to Cloudflare:
   ```bash
   npx wrangler secret bulk .dev.vars
   ```

3. Deploy the worker:
   ```bash
   npm run deploy
   ```

4. After deployment, your MCP server will be available at the URL provided in the deployment output.

## Usage Examples

The MCP server provides several chess-related tools that can be used by AI assistants or other clients that implement the Model Context Protocol.

### Example Prompts

Here are some example prompts you can use with an AI assistant that has access to this MCP server:

#### Get Today's Chess Puzzle

```
Can you show me today's chess puzzle from Chess.com?
```

#### Find Live Chess Streamers

```
Who is currently streaming chess live?
```

#### Get Player Information

```
Tell me about the chess player MagnusCarlsen.
```

#### Get Player Statistics

```
What are the chess ratings and statistics for Hikaru?
```

#### List Titled Players

```
Can you give me some GrandMasters FIDE ranking ?
```

Maintenance

ActivityInactive
ResponsivenessNo issues