A production-ready Model Context Protocol (MCP) server for Method CRM API integration. This server enables LLMs to interact with Method CRM data through well-designed tools for tables, files, users, events, and API key management. - 20 Comprehensive Tools covering all Method CRM operations - API Key Authentication (fully implemented) with OAuth2 placeholders - Dual Transport Support: stdio (local)
Add this skill
npx mdskills install avisangle/method-crm-mcpComprehensive MCP server with 20 well-documented tools covering Method CRM operations with strong error handling
1# Method CRM MCP Server23A production-ready Model Context Protocol (MCP) server for Method CRM API integration. This server enables LLMs to interact with Method CRM data through well-designed tools for tables, files, users, events, and API key management.45## Features67- **20 Comprehensive Tools** covering all Method CRM operations8- **API Key Authentication** (fully implemented) with OAuth2 placeholders9- **Dual Transport Support**: stdio (local) and streamable HTTP (remote)10- **Rate Limiting & Retry Logic**: Automatic handling of API limits11- **Type-Safe**: Full Pydantic validation for all inputs12- **Actionable Errors**: Clear error messages with suggestions13- **Pagination Support**: Efficient handling of large datasets14- **Multiple Response Formats**: JSON and Markdown outputs1516## Installation1718### Prerequisites1920- Python 3.10 or higher21- Method CRM account with API access22- API key (obtain from Method CRM dashboard)2324### Install Dependencies2526```bash27# Clone the repository28git clone https://github.com/avisangle/method-crm-mcp.git29cd method-crm-mcp3031# Install dependencies32pip install -e .3334# Or install with dev dependencies35pip install -e ".[dev]"36```3738## Configuration3940### 1. Environment Setup4142Copy the example environment file:4344```bash45cp .env.example .env46```4748### 2. Configure Authentication4950Edit `.env` and set your API key:5152```bash53# Required: Method CRM API Key54METHOD_API_KEY=your_api_key_here5556# Optional: Customize API base URL57METHOD_API_BASE_URL=https://rest.method.me/api/v1/5859# Optional: Transport configuration60METHOD_TRANSPORT=stdio # or 'http'61METHOD_HTTP_PORT=8000 # only used if TRANSPORT=http62```6364### 3. Get Your API Key65661. Log in to your Method CRM account672. Navigate to **Settings** → **API Settings**683. Click **Create API Key** (requires Administrator role)694. Name your key (e.g., "MCP Server")705. Copy the generated key immediately (it won't be shown again)716. Paste it into `.env` as `METHOD_API_KEY`7273## Usage7475### Running the Server7677#### stdio Transport (Local Use)7879Default mode for use with MCP clients like Claude Desktop:8081```bash82python -m method_mcp.server83```8485Or using the module directly:8687```bash88python src/method_mcp/server.py89```9091#### HTTP Transport (Remote Access)9293For remote access or multiple clients:9495```bash96# Set transport in .env97METHOD_TRANSPORT=http98METHOD_HTTP_PORT=800099100# Start server101python -m method_mcp.server102```103104The server will listen on `http://localhost:8000`105106### MCP Client Configuration107108#### Claude Desktop109110Add to your Claude Desktop configuration (`~/Library/Application Support/Claude/claude_desktop_config.json` on macOS):111112```json113{114 "mcpServers": {115 "method-crm": {116 "command": "python",117 "args": [118 "-m",119 "method_mcp.server"120 ],121 "cwd": "/absolute/path/to/method-crm-mcp",122 "env": {123 "METHOD_API_KEY": "your_api_key_here"124 }125 }126 }127}128```129130#### MCP Inspector (Testing)131132Test tools using MCP Inspector:133134```bash135npx @modelcontextprotocol/inspector python src/method_mcp/server.py136```137138## Available Tools139140### Table Operations (5 tools)141142| Tool | Description | Read-Only | Destructive |143|------|-------------|-----------|-------------|144| `method_tables_query` | Query records with filtering, pagination, aggregation | ✅ | ❌ |145| `method_tables_get` | Get specific record by ID with optional expansion | ✅ | ❌ |146| `method_tables_create` | Create new record in any table | ❌ | ❌ |147| `method_tables_update` | Update record fields (batch support: 50 records) | ❌ | ❌ |148| `method_tables_delete` | Delete record permanently | ❌ | ✅ |149150**Example**: Query active customers151```json152{153 "table": "Customer",154 "filter": "Status eq 'Active'",155 "top": 50,156 "orderby": "CreatedDate desc",157 "response_format": "json"158}159```160161**Example**: Create new inventory item162```json163{164 "table": "ItemInventory",165 "fields": {166 "Name": "New Product",167 "Sku": "SKU-001",168 "SalesDesc": "Product description",169 "SalesPrice": 99.99,170 "PurchaseCost": 80,171 "PurchaseDesc": "Purchase description",172 "IsActive": true,173 "IncomeAccount": "Sales of Product Income",174 "COGSAccount": "Cost of Goods Sold",175 "AssetAccount": "Inventory",176 "PurchaseTaxCode": "Tax on Purchases",177 "SalesTaxCode": "Tax on Sales",178 "IsUsedOnPurchaseTransaction": true,179 "IsUsedOnSalesTransaction": true,180 "IsTrackQtyOnHand": true,181 "TenantID": 1182 },183 "response_format": "json"184}185```186**Note**: Required fields vary by table. For `ItemInventory`:187- **Required**: `Sku` (must be unique), `COGSAccount`, `AssetAccount`, `TenantID`188- **Recommended**: `IncomeAccount`, tax codes, transaction flags189- Account fields must match existing QuickBooks account names exactly190191### File Management (6 tools)192193| Tool | Description | Read-Only | Destructive |194|------|-------------|-----------|-------------|195| `method_files_upload` | Upload file (max 50MB) with optional record linking | ❌ | ❌ |196| `method_files_list` | List files with filtering and pagination | ✅ | ❌ |197| `method_files_download` | Download file content (base64-encoded) | ✅ | ❌ |198| `method_files_get_url` | Generate temporary download URL (20-min expiry) | ✅ | ❌ |199| `method_files_update_link` | Update file link to different table/record | ❌ | ❌ |200| `method_files_delete` | Delete file permanently | ❌ | ✅ |201202**Example**: Upload invoice PDF203```json204{205 "filename": "invoice-2024-01.pdf",206 "content": "<base64-encoded content>",207 "link_table": "Invoice",208 "link_record_id": "INV-12345",209 "description": "January 2024 invoice"210}211```212213### User Information (1 tool)214215| Tool | Description | Read-Only |216|------|-------------|-----------|217| `method_user_get_info` | Get current authenticated user information | ✅ |218219### Event Automation (4 tools)220221| Tool | Description | Read-Only | Destructive |222|------|-------------|-----------|-------------|223| `method_events_create_routine` | Create event-driven automation routine | ❌ | ❌ |224| `method_events_list_routines` | List all event routines with pagination | ✅ | ❌ |225| `method_events_get_routine` | Get specific routine details by ID | ✅ | ❌ |226| `method_events_delete_routine` | Delete event routine permanently | ❌ | ✅ |227228**Example**: Send email on new customer229```json230{231 "name": "New Customer Welcome",232 "description": "Send welcome email to new customers",233 "trigger_config": {234 "event": "record_created",235 "table": "Customer"236 },237 "actions": [238 {239 "action": "send_email",240 "template": "welcome",241 "to_field": "Email"242 }243 ],244 "enabled": true245}246```247248### API Key Management (4 tools)249250| Tool | Description | Read-Only | Destructive | Admin Required |251|------|-------------|-----------|-------------|----------------|252| `method_apikeys_create` | Create new API key (returns key once) | ❌ | ❌ | ✅ |253| `method_apikeys_list` | List API keys (keys masked for security) | ✅ | ❌ | ❌ |254| `method_apikeys_update` | Update key metadata (name, permissions, status) | ❌ | ❌ | ✅ |255| `method_apikeys_delete` | Delete/revoke API key permanently | ❌ | ✅ | ✅ |256257**Example**: Create production API key258```json259{260 "name": "Production Server",261 "description": "Main API integration key",262 "permissions": ["read:all", "write:all"]263}264```265266## API Rate Limits267268Method CRM enforces the following limits:269270- **Per-minute**: 100 requests per account271- **Daily**: 5,000-25,000 requests (varies by license count)272- **File size**: 50MB per file273- **Storage**: 10GB total per account274- **Batch updates**: 50 related records maximum275276The MCP server automatically handles rate limiting with:277- Exponential backoff retry logic278- Clear error messages with retry-after timing279- Actionable suggestions for rate limit errors280281## Error Handling282283All tools return actionable error messages with suggestions:284285**Example error responses**:286287```288Error: Rate limit exceeded (100 requests/minute or daily limit reached).289Retry-After: 45 seconds290Suggestion: Wait before making more requests. Method CRM limits: 100 req/min per account, 5,000-25,000 daily depending on licenses.291```292293```294Error: Resource not found - Record 'CUST-999' not found in table 'Customer'295Suggestion: Verify that the table name, record ID, or file ID is correct. Use list/query tools to find the correct identifier.296```297298```299Error: Permission denied - Your account doesn't have Admin role required for this operation300Suggestion: Your account doesn't have permission to perform this operation. Check that you have the required role (e.g., Admin for API key creation) or that the resource belongs to your account.301```302303## Advanced Features304305### OData Query Filtering306307Use powerful OData-style filters for queries:308309```310# Equality311"Status eq 'Active'"312313# Comparison314"CreatedDate gt '2024-01-01'"315"Total ge 1000"316317# Logical operators318"Status eq 'Active' and Total gt 500"319"Type eq 'Invoice' or Type eq 'Estimate'"320321# String functions322"startswith(Name, 'John')"323"contains(Email, '@example.com')"324"endswith(Status, 'ed')"325326# Null checks327"Email ne null"328```329330### Aggregations331332Perform aggregations directly in queries:333334```335# Count records336"count()"337338# Sum amounts339"sum(Amount)"340341# Group by with aggregation342"groupby((Status),aggregate($count as Total))"343344# Multiple aggregations345"sum(Amount),average(Total),count()"346```347348### Pagination349350All list/query tools support pagination:351352```json353{354 "table": "Customer",355 "top": 100,356 "skip": 0357}358```359360Responses include pagination metadata:361362```json363{364 "total": 500,365 "count": 100,366 "offset": 0,367 "has_more": true,368 "next_offset": 100369}370```371372### Response Formats373374Choose between JSON (structured) and Markdown (human-readable):375376```json377{378 "response_format": "json" // or "markdown"379}380```381382## Architecture383384```385method-crm-mcp/386├── src/method_mcp/387│ ├── server.py # FastMCP server initialization388│ ├── client.py # HTTP client with retry logic389│ ├── auth.py # Authentication (API Key + OAuth2 placeholders)390│ ├── models.py # Pydantic models (20 tools)391│ ├── errors.py # Error handling utilities392│ ├── utils.py # Shared helpers (pagination, formatting)393│ └── tools/394│ ├── tables.py # 5 table operation tools (CRUD)395│ ├── files.py # 6 file management tools396│ ├── user.py # 1 user info tool397│ ├── events.py # 4 event automation tools (complete CRUD)398│ └── apikeys.py # 4 API key management tools (complete CRUD)399├── tests/ # Unit and integration tests400├── evaluations/ # Evaluation questions for testing401├── pyproject.toml # Dependencies and project metadata402├── .env.example # Environment configuration template403└── README.md # This file404```405406## Development407408### Running Tests409410```bash411# Install dev dependencies412pip install -e ".[dev]"413414# Run all tests415pytest416417# Run with coverage418pytest --cov=src/method_mcp --cov-report=html419```420421### Code Quality422423```bash424# Type checking425mypy src/method_mcp426427# Linting428ruff check src/method_mcp429430# Formatting431black src/method_mcp432```433434## Troubleshooting435436### Authentication Errors437438**Problem**: `Error: Authentication failed. Your API key or access token is invalid or expired.`439440**Solutions**:441- Verify `METHOD_API_KEY` is set correctly in `.env`442- Check that the key hasn't been revoked in Method CRM dashboard443- Ensure no extra whitespace in the key value444445### Rate Limiting446447**Problem**: `Error: Rate limit exceeded (100 requests/minute)`448449**Solutions**:450- Wait for the retry-after period (check error message)451- Reduce request frequency in your application452- Use pagination to reduce total requests453- Consider upgrading Method CRM license for higher limits454455### File Upload Errors456457**Problem**: `Error: File size exceeds 50MB limit`458459**Solutions**:460- Compress files before uploading461- Split large files into smaller chunks462- Use external storage (S3, etc.) and store URLs in Method CRM463464### Connection Errors465466**Problem**: `Error: Unable to connect to Method API`467468**Solutions**:469- Check internet connection470- Verify `METHOD_API_BASE_URL` is correct471- Check if Method CRM is experiencing downtime472- Verify firewall/proxy settings473474## Security Best Practices4754761. **API Key Storage**477 - Store in environment variables, never in code478 - Use `.env` file (never commit to version control)479 - Rotate keys periodically (every 90 days recommended)4804812. **Access Control**482 - Use separate API keys for different environments (dev/staging/prod)483 - Revoke unused keys promptly484 - Monitor key usage via `method_apikeys_list`4854863. **File Handling**487 - Validate file types before upload488 - Scan uploaded files for malware489 - Enforce file size limits in application logic4904914. **Error Messages**492 - Don't expose sensitive information in logs493 - Use debug mode only in development494495## OAuth2 Support (Coming Soon)496497OAuth2 authentication is planned for a future release:498499- **Authorization Code Flow**: User-based authentication500- **Client Credentials Flow**: Machine-to-machine with token refresh501- **Implicit Flow**: Browser-based SPAs502503Placeholders are already in the codebase (`auth.py`).504505## Contributing506507Contributions are welcome! Please:5085091. Fork the repository5102. Create a feature branch5113. Add tests for new features5124. Ensure all tests pass5135. Submit a pull request514515## Support516517- **Issues**: Report bugs and request features on GitHub518- **Documentation**: https://developer.method.me/519- **Method CRM Support**: https://help.method.me/520521## License522523MIT License - See [LICENSE](LICENSE) file for details.524525## Changelog526527### Version 1.0.0 (2025-11-22)528529**Initial Public Release**530- ✅ 20 fully implemented tools (complete API coverage)531- ✅ API Key authentication532- ✅ Dual transport support (stdio + HTTP)533- ✅ Rate limiting and retry logic534- ✅ Comprehensive error handling535- ✅ Pydantic validation for all inputs536- ✅ Pagination support with cursor-based navigation537- ✅ Multiple response formats (JSON/Markdown)538- ✅ File operations with multipart/form-data support539- ✅ Complete CRUD for tables, events, and API keys540- ⏳ OAuth2 support (placeholders added)541542---543544**Built with** ❤️ **using** [FastMCP](https://github.com/modelcontextprotocol/python-sdk) **and the** [Model Context Protocol](https://modelcontextprotocol.io)545
Full transparency — inspect the skill content before installing.