spell-checker-mcp

jezweb/spell-checker-mcp

3.3

If you are the rightful owner of spell-checker-mcp and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to dayong@mcphub.com.

The Spell Checker MCP Server provides multi-language spell checking and AI-powered grammar correction for MCP clients, supporting 53 languages with automatic detection.

Tools
3
Resources
0
Prompts
0

Spell Checker MCP Server

Multi-language spell checking and AI-powered grammar correction for MCP clients

Deploy to Cloudflare npm version License: MIT

MCP server for real-time spell checking and grammar correction in AI coding assistants. Supports 53 languages with automatic detection, powered by Cloudflare Workers, nspell dictionaries, and Workers AI.

Live Demo: https://spellcheck.mcp.jezweb.ai (homepage only - MCP requires your own instance)

Version: 2.0.0 (OAuth 2.0 enabled)


Features

  • 53 Languages: Comprehensive spell checking with automatic language detection
  • AI Grammar: Context-aware grammar checking powered by DeepSeek R1 32B
  • Auto-Correction: Three modes (spelling only, grammar only, or both)
  • Document Storage: Corrected documents saved to R2 with 30-day auto-delete
  • OAuth 2.0 Authentication: Secure Google OAuth for Claude.ai and MCP clients
  • Edge Deployment: Global low-latency via Cloudflare Workers
  • Zero-Config: One-click deployment with automatic resource provisioning

Supported Languages

English (en, en-au, en-ca, en-gb, en-us, en-za) • Spanish • French • German • Italian • Dutch • Portuguese • Russian • Polish • Czech • Romanian • Swedish • Danish • Norwegian • Bulgarian • Catalan • Welsh • Greek • Esperanto • Estonian • Basque • Faroese • Friulian • Frisian • Irish • Scottish Gaelic • Galician • Hebrew • Croatian • Hungarian • Armenian • Icelandic • Georgian • Korean • Latin • Lithuanian • Latvian • Macedonian • Mongolian • Persian • Breton • Slovak • Slovenian • Serbian • Turkish • Ukrainian • Vietnamese


Quick Start

Option 1: Deploy Your Own (Recommended)

Click the button to deploy your own instance:

Deploy to Cloudflare

This will automatically:

  1. Fork the repository to your GitHub account
  2. Create R2 buckets for dictionaries and documents
  3. Set up Workers AI binding for grammar checking
  4. Deploy to Cloudflare Workers with CI/CD

After deployment:

  • Your server will be live at: https://spell-checker-mcp.<your-subdomain>.workers.dev
  • No additional configuration needed - all bindings are auto-provisioned!

Option 2: Deploy Your Own with Google OAuth

Note: The demo instance at spell-checker-mcp-api.webfonts.workers.dev is restricted to Jezweb Google Workspace members. To use this MCP server, you'll need to deploy your own instance and configure Google OAuth with your own credentials.

Setup steps:

  1. Deploy to Cloudflare using the button above
  2. Create Google OAuth credentials:
    • Go to Google Cloud Console → APIs & Services → Credentials
    • Create OAuth 2.0 Client ID (Web application)
    • Add redirect URI: https://your-worker.workers.dev/callback
    • Set OAuth consent screen to "Internal" (workspace only) or "External" (anyone)
  3. Set secrets:
    echo "your-client-id" | npx wrangler secret put GOOGLE_CLIENT_ID
    echo "your-client-secret" | npx wrangler secret put GOOGLE_CLIENT_SECRET
    python3 -c "import secrets; print(secrets.token_urlsafe(32))" | npx wrangler secret put COOKIE_ENCRYPTION_KEY
    npx wrangler deploy
    
  4. Connect from Claude.ai:
    https://your-worker.workers.dev/mcp
    

For Claude Code CLI:

claude mcp add spell-checker https://your-worker.workers.dev/sse

Option 3: Run Locally

# Clone repository
git clone https://github.com/jezweb/spell-checker-mcp.git
cd spell-checker-mcp

# Install dependencies
npm install

# Start dev server
npm run dev

Installation

Connect this MCP server to your favorite AI coding assistant.

Important: Replace your-worker.workers.dev with your deployed instance URL. The demo instance is restricted to Jezweb workspace members.

Claude Code CLI

Via CLI (Recommended)

Use HTTP transport (your deployed instance):

claude mcp add spell-checker --transport http https://your-worker.workers.dev/mcp

Or use NPX (local):

claude mcp add spell-checker -- npx -y spell-checker-mcp

Via Configuration File

Add to ~/.claude/mcp.json (user-level) or .mcp.json (project-level):

HTTP Transport:

{
  "mcpServers": {
    "spell-checker": {
      "url": "https://your-worker.workers.dev/mcp",
      "transport": "http"
    }
  }
}

NPX (local):

{
  "mcpServers": {
    "spell-checker": {
      "command": "npx",
      "args": ["-y", "spell-checker-mcp"]
    }
  }
}

Verify Installation

claude mcp list
claude mcp get spell-checker
Cursor
  1. Open Cursor Settings
  2. Navigate to "MCP Servers"
  3. Click "Add Server"
  4. Choose configuration:

HTTP Transport (Public Server):

{
  "mcpServers": {
    "spell-checker": {
      "url": "https://your-worker.workers.dev/mcp",
      "transport": "http"
    }
  }
}

NPX (Local):

{
  "mcpServers": {
    "spell-checker": {
      "command": "npx",
      "args": ["-y", "spell-checker-mcp"]
    }
  }
}
  1. Save and restart Cursor
Cline (VS Code Extension)

Add to ~/Library/Application Support/Code/User/globalStorage/rooveterinaryinc.roo-cline/settings/cline_mcp_settings.json:

HTTP Transport:

{
  "mcpServers": {
    "spell-checker": {
      "url": "https://your-worker.workers.dev/mcp",
      "transport": "http"
    }
  }
}

NPX:

{
  "mcpServers": {
    "spell-checker": {
      "command": "npx",
      "args": ["-y", "spell-checker-mcp"]
    }
  }
}

Restart VS Code after configuration.

Zed Editor

Add to ~/.config/zed/settings.json:

{
  "context_servers": {
    "spell-checker": {
      "settings": {
        "url": "https://your-worker.workers.dev/mcp",
        "transport": "http"
      }
    }
  }
}

Restart Zed after configuration.

Other MCP Clients

Most MCP clients support the standard configuration format:

HTTP Transport:

{
  "mcpServers": {
    "spell-checker": {
      "url": "https://your-worker.workers.dev/mcp",
      "transport": "http"
    }
  }
}

Stdio (NPX):

{
  "mcpServers": {
    "spell-checker": {
      "command": "npx",
      "args": ["-y", "spell-checker-mcp"]
    }
  }
}

Consult your client's documentation for the specific configuration file location.


MCP Tools

spell_check_analyze

Analyze text for spelling errors with suggestions.

Input:

{
  "text": "The text to check for speling errors",
  "language": "en-au"
}

Output:

{
  "summary": "Found 1 spelling error",
  "errors": [
    {
      "word": "speling",
      "line": 1,
      "column": 25,
      "suggestions": ["spelling", "spieling", "peeling"]
    }
  ]
}

Parameters:

  • text (required): Text to analyze
  • language (optional): Language code (defaults to auto-detect)

spell_check_grammar

AI-powered grammar and style checking.

Input:

{
  "text": "The team are ready but they dont know what their doing.",
  "language": "en-au"
}

Output:

{
  "summary": "Found 2 grammar issues",
  "errors": [
    {
      "message": "Missing apostrophe in contraction",
      "context": "they dont know",
      "suggestions": ["they don't know"],
      "ruleId": "APOSTROPHE_MISSING",
      "category": "PUNCTUATION"
    },
    {
      "message": "Incorrect use of 'their' - should be 'they're'",
      "context": "what their doing",
      "suggestions": ["what they're doing"],
      "ruleId": "THEIR_THEYRE",
      "category": "GRAMMAR"
    }
  ]
}

Categories:

  • GRAMMAR: Subject-verb agreement, tense, etc.
  • PUNCTUATION: Apostrophes, commas, quotation marks
  • STYLE: Wordiness, passive voice, clarity
  • TYPOGRAPHY: Spacing, capitalization

spell_check_correct

Auto-correct spelling and grammar errors.

Input:

{
  "text": "The text to corect with speling and grammer errors.",
  "language": "en-au",
  "mode": "both"
}

Output:

{
  "original": "The text to corect with speling and grammer errors.",
  "corrected": "The text to correct with spelling and grammar errors.",
  "changes": [
    {
      "type": "spelling",
      "position": 12,
      "original": "corect",
      "correction": "correct",
      "confidence": 0.95
    },
    {
      "type": "spelling",
      "position": 24,
      "original": "speling",
      "correction": "spelling",
      "confidence": 0.98
    },
    {
      "type": "spelling",
      "position": 36,
      "original": "grammer",
      "correction": "grammar",
      "confidence": 0.92
    }
  ],
  "summary": "Applied 3 corrections",
  "r2": {
    "url": "https://spellcheck.files.jezweb.ai/abc123.txt",
    "key": "abc123.txt",
    "size": 52,
    "expiresAt": "2025-12-13T00:00:00Z"
  }
}

Modes:

  • spelling: Fix spelling only (fast, no AI required)
  • grammar: Fix grammar only (AI-powered)
  • both: Fix spelling then grammar (default)

R2 Storage: All corrected documents are automatically uploaded to R2 storage with:

  • 30-day automatic expiration
  • Unique non-guessable URLs
  • Public read access

Architecture

Tech Stack

  • Runtime: Cloudflare Workers (V8 isolates) + Durable Objects
  • Framework: Hono (lightweight HTTP) + @cloudflare/workers-oauth-provider
  • Authentication: OAuth 2.0 with Google (DCR supported)
  • MCP Agent: McpAgent Durable Object from agents/mcp
  • Spell Checking: nspell + 53 Hunspell dictionaries
  • Language Detection: franc-min (automatic)
  • Grammar AI: Workers AI (DeepSeek R1 Distill Qwen 32B)
  • Storage: R2 (dictionaries + corrected documents), KV (OAuth state)
  • Transport: SSE + Streamable HTTP (MCP standard)

Project Structure

src/
├── index.ts              # OAuthProvider entry point
├── oauth/
│   ├── google-handler.ts # Google OAuth routes (/authorize, /callback)
│   ├── utils.ts          # Token exchange, user info fetching
│   └── workers-oauth-utils.ts # CSRF, state validation, approval dialog
├── handlers/
│   └── homepage.ts       # Glassmorphism landing page
├── mcp/
│   └── agent.ts          # SpellCheckerMCP Durable Object (3 tools)
├── lib/
│   ├── dictionary.ts     # Dictionary loader with R2 lazy loading
│   ├── spellcheck.ts     # nspell wrapper with position tracking
│   ├── grammar.ts        # Workers AI grammar checking
│   ├── correction.ts     # Correction application logic
│   └── storage.ts        # R2 document storage
├── tools/
│   ├── analyze.ts        # spell_check_analyze implementation
│   ├── grammar.ts        # spell_check_grammar implementation
│   └── correct.ts        # spell_check_correct implementation
├── prompts/
│   ├── types.ts          # Grammar prompt configuration interfaces
│   └── grammar-prompts.ts # 53-language grammar prompts registry
└── types/
    └── env.d.ts          # Environment type definitions

Bindings

Configured in wrangler.jsonc:

  • SPELL_CHECK_DICTS: R2 bucket for dictionaries (170MB, 106 files)
  • SPELL_CHECK_DOCS: R2 bucket for corrected documents (30-day lifecycle)
  • AI: Workers AI binding for grammar checking
  • OAUTH_KV: KV namespace for OAuth state management
  • MCP_OBJECT: Durable Object for MCP agent sessions
  • MCP_METRICS: Analytics Engine for usage tracking

OAuth Endpoints

  • GET /authorize - OAuth authorization (shows approval dialog)
  • POST /authorize - Process approval form
  • GET /callback - Google OAuth callback
  • POST /register - Dynamic Client Registration (DCR)
  • POST /token - Token exchange
  • /sse - SSE transport for MCP
  • /mcp - Streamable HTTP transport for MCP

Development

Prerequisites

  • Node.js 18+
  • Cloudflare account
  • Wrangler CLI (npm install -g wrangler)

Setup

# Install dependencies
npm install

# Generate Cloudflare types
npm run cf-typegen

# Start dev server
npm run dev
# Server runs on http://localhost:8787

Testing

# Health check
curl http://localhost:8787/health

# Test spell checking
curl -X POST http://localhost:8787/mcp \
  -H "Content-Type: application/json" \
  -d '{
    "jsonrpc": "2.0",
    "id": 1,
    "method": "tools/call",
    "params": {
      "name": "spell_check_analyze",
      "arguments": {
        "text": "This is a tesst with speling errors"
      }
    }
  }'

Deployment

# Build TypeScript
npm run build

# Deploy to Cloudflare
npm run deploy

Production URL: https://spell-checker-mcp.<your-subdomain>.workers.dev


Configuration

Environment Variables (Secrets)

For OAuth authentication, the following secrets are required:

# Google OAuth credentials (from Google Cloud Console)
echo "your-client-id" | npx wrangler secret put GOOGLE_CLIENT_ID
echo "your-client-secret" | npx wrangler secret put GOOGLE_CLIENT_SECRET

# Cookie encryption key (generate secure random key)
python3 -c "import secrets; print(secrets.token_urlsafe(32))" | npx wrangler secret put COOKIE_ENCRYPTION_KEY

# Deploy to activate secrets
npx wrangler deploy

Google Cloud Console Setup:

  1. Go to Google Cloud Console
  2. Create a new project or select existing
  3. Navigate to APIs & Services → Credentials
  4. Create OAuth 2.0 Client ID (Web application)
  5. Add authorized redirect URI: https://your-worker.workers.dev/callback
  6. Copy Client ID and Client Secret

Custom Deployment

If deploying manually:

  1. Create R2 Buckets:

    wrangler r2 bucket create spell-checker-dictionaries
    wrangler r2 bucket create spell-checker-documents
    
  2. Create KV Namespace for OAuth:

    npx wrangler kv namespace create OAUTH_KV
    # Copy the ID to wrangler.jsonc kv_namespaces section
    
  3. Upload Dictionaries:

    npm run upload-dictionaries
    
  4. Configure Lifecycle Policy (30-day auto-delete):

    wrangler r2 bucket lifecycle set spell-checker-documents \
      --expiration-days 30
    
  5. Set OAuth Secrets (see Environment Variables section above)

  6. Deploy:

    npm run deploy
    

Performance

Benchmarks

  • Spell check (cached): <50ms
  • Spell check (first load): 200-400ms (R2 fetch + parse)
  • Grammar check: 800-1500ms (AI inference)
  • Auto-correct: 300-2000ms (depends on mode)

Bundle Size

  • Worker bundle: 348KB (gzipped)
  • Dictionaries: 170MB (R2 lazy-loaded, not bundled)

Caching Strategy

  • Dictionaries: In-memory cache (per-language, per-isolate)
  • HTTP responses: Standard Cloudflare CDN caching
  • AI results: No caching (always fresh grammar checks)

Troubleshooting

MCP server not connecting

Check server status:

curl https://your-worker.workers.dev/health

Verify client configuration:

# Claude Code CLI
claude mcp get spell-checker

Check logs:

wrangler tail
Grammar checking fails

Verify Workers AI binding:

wrangler deployments list

Workers AI binding must be configured in wrangler.jsonc:

{
  "ai": {
    "binding": "AI"
  }
}
R2 upload errors

Check R2 bucket exists:

wrangler r2 bucket list

Verify bindings:

wrangler deployments list

Bindings must match wrangler.jsonc configuration.

Deployment fails

Common issues:

  1. Missing Wrangler login:

    wrangler login
    
  2. Binding name mismatch:

    • Check wrangler.jsonc binding names
    • Must match variable names in code
  3. TypeScript errors:

    npm run build
    

Contributing

Contributions welcome! Please:

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit changes (git commit -m 'Add amazing feature')
  4. Push to branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

Development Guidelines

  • Use TypeScript strict mode
  • Follow existing code style
  • Add tests for new features
  • Update documentation

Roadmap

  • URL fetching support (spell check content from external URLs)
  • Document format conversion (HTML → text, PDF → text)
  • Chunking for very large documents (>1MB)
  • Custom dictionary management (add/remove words)
  • Language-specific grammar rules refinement
  • Batch processing API
  • WebSocket streaming for real-time checking

License

MIT License - see file for details.

Copyright (c) 2025 Jeremy Dawes (Jezweb)


Author

Jezweb - jeremy@jezweb.net


Acknowledgments


Built with ❤️ on Cloudflare Workers