Command Palette

Search for a command to run...

UnylyUnyly
Весь каталог

Method Crm Mcp Workers

БесплатноНе проверен

MCP server for Method CRM on Cloudflare Workers — 22 tools, OAuth 2.1, multi-tenant

GitHubEmbed

Описание

MCP server for Method CRM on Cloudflare Workers — 22 tools, OAuth 2.1, multi-tenant

README

A TypeScript-based Model Context Protocol (MCP) server for Method CRM, deployed on Cloudflare Workers with API key authentication.

Overview

This MCP server enables Claude Desktop and other MCP clients to interact with Method CRM's REST API through 22 specialized tools. Built for Cloudflare Workers with the agents SDK (createMcpHandler), it provides global edge deployment with low latency and automatic scaling.

Live: https://method.avinashsangle.com

Features

  • 22 MCP Tools across 6 categories:

    • Tables: Query, get, create, update, delete records
    • Discovery: Discover table schemas, find reference IDs
    • Files: Upload, list, download, manage file attachments
    • User: Get authenticated user information
    • Events: Create and manage event automation routines
    • API Keys: Manage API key access and permissions
  • API Key Authentication:

    • Pass your Method CRM API key via request header
    • Supports X-Method-API-Key: <key> or Authorization: APIKey <key>
  • Edge Deployment:

    • Cloudflare Workers + agents SDK (createMcpHandler)
    • Wrangler 4.x (required for agents SDK)
    • ~80ms startup time, automatic scaling and high availability
  • Schema Caching:

    • Workers KV caching for table schemas (70-90% latency reduction)
    • Tiered TTL: 10 min for high-traffic tables, 5 min for others
    • Separate SCHEMAS KV namespace with multi-tenant isolation
  • Production Ready:

    • Type-safe with TypeScript and Zod schemas
    • Rate limiting and retry logic with exponential backoff
    • Comprehensive error handling
  • Multi-Tenant Support:

    • Each client provides their own Method CRM API key via headers
    • Stateless architecture — no credentials stored server-side
    • Support for custom Method CRM base URLs per tenant
  • Safeguards for Destructive Operations:

    • All CREATE, UPDATE, DELETE tools require _skip_confirmation: true
    • Field validation blocks system field modification
  • AI Agent Discoverability:

    • Rich JSON landing page at /
    • Full tool catalog at /capabilities and /.well-known/mcp.json
    • AI-friendly /robots.txt

How It Works

Clients provide their own Method CRM API key via a request header on every request. The server is stateless — no credentials are stored server-side.

Required header (one of):

  • X-Method-API-Key: <your_api_key>
  • Authorization: APIKey <your_api_key>

Optional header:

  • X-Method-URL: https://rest.method.me (override for custom Method CRM deployments)

Prerequisites

  • Node.js 18+ and npm
  • Cloudflare account (free tier works)
  • Method CRM account with API access
  • Your Method CRM API key

Installation

# Clone the repository
git clone https://github.com/avisangle/method-crm-mcp-workers
cd method-crm-mcp-workers

# Install dependencies
npm install

Configuration

wrangler.toml

Two Workers KV namespaces are required:

name = "method-crm-mcp-workers"
main = "src/index.ts"
compatibility_date = "2024-09-23"
compatibility_flags = ["nodejs_compat"]

[[kv_namespaces]]
binding = "TOKENS"
id = "your_tokens_kv_id"

[[kv_namespaces]]
binding = "SCHEMAS"
id = "your_schemas_kv_id"

[vars]
API_BASE_URL = "https://rest.method.me/api/v1"
DEPLOYMENT_MODE = "multi-tenant"

Development

# Run local development server
npm run dev
# Available at http://localhost:8787

# Type check
npm run type-check

# Run tests
npm test

Deployment

# Create Workers KV namespaces
npx wrangler kv:namespace create TOKENS
npx wrangler kv:namespace create SCHEMAS

# Update wrangler.toml with the generated namespace IDs

# Deploy to Cloudflare Workers (requires Wrangler 4.x)
npm run deploy

Note: Wrangler 4.x is required. The agents SDK (createMcpHandler) is not compatible with Wrangler 3.x.

Client Configuration

Claude Code (CLI)

Native HTTP support — no proxy needed. Run once to register globally:

claude mcp add --transport http method-crm https://method.avinashsangle.com/mcp \
  --header "X-Method-API-Key:your_api_key_here"

Or add to .mcp.json in your project root:

{
  "mcpServers": {
    "method-crm": {
      "type": "http",
      "url": "https://method.avinashsangle.com/mcp",
      "headers": {
        "X-Method-API-Key": "your_api_key_here"
      }
    }
  }
}

Claude Desktop

Requires mcp-remote as a proxy. Add to claude_desktop_config.json:

{
  "mcpServers": {
    "method-crm": {
      "command": "npx",
      "args": [
        "-y",
        "mcp-remote",
        "https://method.avinashsangle.com/mcp",
        "--header",
        "X-Method-API-Key:your_api_key_here"
      ]
    }
  }
}

Config file locations:

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Windows: %APPDATA%\Claude\claude_desktop_config.json

Claude.ai (Web)

Native HTTP support — no proxy needed. Add in Settings → Integrations:

{
  "mcpServers": {
    "method-crm": {
      "url": "https://method.avinashsangle.com/mcp",
      "headers": {
        "X-Method-API-Key": "your_api_key_here"
      }
    }
  }
}

Cursor

Add to ~/.cursor/mcp.json (global) or .cursor/mcp.json (project):

{
  "mcpServers": {
    "method-crm": {
      "command": "npx",
      "args": [
        "-y",
        "mcp-remote",
        "https://method.avinashsangle.com/mcp",
        "--header",
        "X-Method-API-Key:your_api_key_here"
      ]
    }
  }
}

Windsurf

Add to ~/.codeium/windsurf/model_config.json:

{
  "mcpServers": {
    "method-crm": {
      "command": "npx",
      "args": [
        "-y",
        "mcp-remote",
        "https://method.avinashsangle.com/mcp",
        "--header",
        "X-Method-API-Key:your_api_key_here"
      ]
    }
  }
}

Available Tools

Tables (7 tools)

  • method_tables_query - Query tables with OData filters
  • method_tables_get - Get single record by ID
  • method_tables_create - Create new records ⚠️ requires _skip_confirmation: true
  • method_tables_update - Update existing records ⚠️ requires _skip_confirmation: true
  • method_tables_delete - Delete records ⚠️ requires _skip_confirmation: true
  • method_tables_fields - Discover table schema and available fields
  • method_tables_lookup - Find RecordID values for reference fields

Files (6 tools)

  • method_files_upload - Upload file attachments ⚠️ requires _skip_confirmation: true
  • method_files_list - List files with filtering
  • method_files_download - Download file content
  • method_files_get_url - Generate temporary download URL
  • method_files_update_link - Move files between records ⚠️ requires _skip_confirmation: true
  • method_files_delete - Delete files ⚠️ requires _skip_confirmation: true

User (1 tool)

  • method_user_get_info - Get current user information

Events (4 tools)

  • method_events_create_routine - Create automation routine ⚠️ requires _skip_confirmation: true
  • method_events_list_routines - List all routines
  • method_events_get_routine - Get routine details
  • method_events_delete_routine - Delete routine ⚠️ requires _skip_confirmation: true

API Keys (4 tools)

  • method_apikeys_create - Create new API key ⚠️ requires _skip_confirmation: true
  • method_apikeys_list - List API keys
  • method_apikeys_update - Update API key ⚠️ requires _skip_confirmation: true
  • method_apikeys_delete - Revoke API key ⚠️ requires _skip_confirmation: true

⚠️ All destructive operations require "_skip_confirmation": true in the tool arguments to prevent accidental data loss.

Architecture

src/
├── index.ts           # Main entry point, HTTP handlers, discoverability endpoints
├── config.ts          # Environment validation and constants
├── auth/              # Authentication strategies
│   ├── manager.ts     # Auth strategy pattern
│   ├── apiKey.ts      # API Key authentication
│   └── context.ts     # User context and header extraction
├── cache/             # Schema caching
│   ├── types.ts       # Cache type definitions
│   └── schemaCache.ts # Workers KV schema cache manager
├── client/            # HTTP client
│   ├── methodClient.ts # API client with retry/backoff
│   └── errors.ts      # Error formatting
├── models/            # Data models
│   ├── schemas.ts     # Zod schemas for all tool inputs
│   └── types.ts       # TypeScript interfaces
├── utils/             # Utilities
│   ├── formatting.ts  # JSON/Markdown response formatters
│   ├── query.ts       # OData query builder
│   └── validation.ts  # Field/permission validators
└── tools/
    └── index.ts       # Unified tool router (all 22 tools)

Discoverability Endpoints

Endpoint Description
GET / Rich JSON landing page with features and quick start
GET /health Health check ({"status":"ok","version":"1.0.0"})
GET /capabilities Full tool catalog with 22 tools
GET /.well-known/mcp.json Standard MCP discovery (mirrors /capabilities)
GET /robots.txt AI-friendly server description
POST /mcp MCP protocol endpoint

Related Projects

  • Python Version: method-crm-mcp - For Railway, Fly.io, and traditional deployments

Security

  • API keys transmitted only over HTTPS
  • No credentials stored server-side (stateless multi-tenant)
  • No secrets in logs or error messages
  • Destructive operations require explicit _skip_confirmation: true flag
  • Factory pattern (fresh McpServer per request) prevents cross-client data leaks

Troubleshooting

Authentication Failing

  • Verify your Method CRM API key is valid and active
  • Ensure the header format is correct: X-Method-API-Key: <key>
  • Check the key has the necessary permissions for the operations you're performing

API Calls Failing

  • Verify API key has access to the table/resource being queried
  • Check Method CRM API status at https://developer.method.me
  • Review error messages in Cloudflare dashboard logs

Destructive Operation Blocked

  • Add "_skip_confirmation": true to the tool arguments
  • Example: { "table": "Customer", "record_id": "123", "_skip_confirmation": true }

Build Error: "cloudflare-internal:email"

  • Upgrade to Wrangler 4.x: npm install --save-dev wrangler@4
  • This error occurs when using agents SDK with Wrangler 3.x

Rate Limiting

  • Method CRM has rate limits on API calls
  • The server automatically retries with exponential backoff (2s, 4s, 8s)

Contributing

Contributions welcome! Please open an issue or pull request.

License

MIT License - see LICENSE file for details.

Support

from github.com/avisangle/method-crm-mcp-workers

Установка Method Crm Mcp Workers

У этого сервера нет опубликованного пакета — он собирается из исходников. Открой репозиторий и следуй инструкции в README.

▸ github.com/avisangle/method-crm-mcp-workers

FAQ

Method Crm Mcp Workers MCP бесплатный?

Да, Method Crm Mcp Workers MCP бесплатный — установка в пару кликов через Unyly без оплаты.

Нужен ли API-ключ для Method Crm Mcp Workers?

Нет, Method Crm Mcp Workers работает без API-ключей и переменных окружения.

Method Crm Mcp Workers — hosted или self-hosted?

Self-hosted: сервер запускается локально на твоей машине командой из раздела установки.

Как установить Method Crm Mcp Workers в Claude Desktop, Claude Code или Cursor?

Открой Method Crm Mcp Workers на unyly.org, выбери вкладку своего клиента (Claude Desktop, Claude Code, Cursor) и нажми Install — конфиг сгенерируется автоматически, без правки JSON.

Похожие MCP

Compare Method Crm Mcp Workers with

Не уверен что выбрать?

Найди свой стек за 60 секунд

Автор?

Embed-бейдж для README

Похожее

Все в категории finance