Twenty MCP Server
A Model Context Protocol (MCP) server that provides seamless integration with the Twenty CRM API, enabling LLM agents to interact with your CRM data through well-defined, typed tools.
π Table of Contents
Overview
This MCP server transforms your Twenty CRM instance into a powerful tool accessible by Claude and other MCP-compatible AI assistants. It provides comprehensive access to contacts, companies, tasks, and notes with full TypeScript support and robust error handling.
Key Features
π€ Contact Management: Create, retrieve, update, and search contacts
π’ Company Management: Full company lifecycle management
πΌ Opportunity Tracking: Complete sales pipeline management
π Activity Management: Unified timeline view with filtering
β Task Management: Create and manage tasks
π Relationship Management: Link entities and analyze connections
π Metadata Discovery: Explore CRM schema and field definitions
π OAuth 2.1 Authentication: Secure user-specific API key management
π Full TypeScript Support: Type-safe operations with validation
Total: 29 MCP Tools providing comprehensive CRM automation capabilities. See full tool list β
Understanding MCP Servers
MCP (Model Context Protocol) servers are tools that extend AI assistants like Claude with new capabilities. Once configured, this server allows Claude to:
π Read your CRM data (contacts, companies, opportunities)
βοΈ Create new records directly from conversations
π Update existing information
π€ Automate CRM workflows through natural language
Think of it as giving Claude direct access to your Twenty CRM, turning it into a powerful CRM assistant.
Prerequisites
Before installing, ensure you have:
β Node.js 18 or higher - Download from nodejs.org
β npm (included with Node.js)
β Git for cloning the repository
β Twenty CRM instance with API access
β Text editor for configuration files
Checking Prerequisites
β οΈ Windows Users: The quick install script requires Git Bash or WSL. See Windows Installation Guide for alternatives.
π Quick Start
Option 1: Instant Trial (No Installation Required) β‘
Perfect for trying Twenty MCP Server before committing to installation!
Option 2: Global Installation (Best for Regular Use)
That's it! The CLI will guide you through everything else.
Option 3: Git Clone (For Developers)
For experienced users who want to clone and modify the source:
Then configure your IDE using the absolute path shown by the installer.
Installation
πΊοΈ Installation Overview
Choose Your Installation Method
Method | When to Use | Time | Platform |
β‘ npx Instant Trial | Try before installing - no commitment! | ~30 seconds | All platforms |
π npm Global Install | Regular use and best performance | ~1 minute | All platforms |
π― Git Clone + Install | Developers who want to modify code | ~3 minutes | Linux/macOS/Git Bash |
π§ Manual Git Setup | Windows Command Prompt or custom needs | ~5 minutes | All platforms |
Option 1: npx Instant Trial (Try Before Installing)
Experience Twenty MCP Server instantly without any installation:
Benefits:
β Zero installation - try instantly
β Always runs the latest version
β Configuration persists between runs
β Perfect for testing and evaluation
β No global installation clutter
Ready to install permanently? Simply run: npm install -g twenty-mcp-server
Option 2: npm Global Install (Best for Regular Use)
For users who want Twenty MCP Server permanently installed:
Benefits:
β Works on all platforms (Windows, macOS, Linux)
β Automatic PATH configuration
β Interactive setup wizard guides you through everything
β No manual file management or path configuration
β Easy updates with
npm update -g twenty-mcp-serverβ Built-in CLI commands for management and testing
β Professional configuration management
What the setup wizard configures:
π§ Twenty CRM API connection
π OAuth 2.1 authentication (optional)
π‘οΈ IP address protection (optional)
βοΈ Server preferences and defaults
π Cross-platform configuration storage
Option 3: Git Clone Installation
For developers who want to modify the source code:
The install script will:
β Check Node.js version (18+ required)
β Install all dependencies
β Build the TypeScript project
β Run tests (if API key is configured)
β Show your absolute path for IDE configuration
β Provide next steps
π Note: Save the absolute path shown by the installer - you'll need it for IDE configuration!
Option 4: Manual Installation
Perfect for Windows Command Prompt users or those who prefer manual control:
β
If you see dist/index.js, the build succeeded!
π Finding Your Installation Path (IMPORTANT!)
π¨ Critical: You MUST use the absolute path to
dist/index.jsfor IDE configuration. Relative paths will NOT work!
β οΈ Warning: If your path contains spaces (e.g., "Program Files"), use quotes in your IDE configuration!
Your MCP server path will be:
π§ͺ Installation Quick Check
Before proceeding to configuration, verify your installation:
Windows Installation Guide
πͺ Windows Users: See our detailed Windows Installation Guide for step-by-step instructions with Command Prompt, PowerShell, and Git Bash options.
Configuration
Step 1: Get Your Twenty CRM API Key
Log into your Twenty CRM instance
For Twenty Cloud: https://app.twenty.com
For self-hosted: Your instance URL
Navigate to Settings
Click on your profile avatar (top right)
Select "Settings" from the dropdown
Find API & Webhooks
Look in the "Developers" section
Click on "API & Webhooks"
Generate Your API Key
Click "Generate API Key" button
Important: Copy the key immediately - it won't be shown again!
Store it securely (password manager recommended)
Step 2: Configure Environment Variables
Option A: Using .env File (Recommended)
Add your configuration to the .env file:
Common Base URLs:
Twenty Cloud:
https://api.twenty.comSelf-hosted:
https://your-company.twenty.comLocal development:
http://localhost:3000
Option B: Using Export Commands
Step 3: Load Your Configuration
π Important: Environment variables must be loaded in your current shell session!
.env files store configuration but don't automatically load into your shell:
Linux/macOS: Must use
source .envto load variablesWindows: The npm scripts automatically read .env files
IDE Configuration: Usually reads .env files directly
If using a .env file:
OAuth Authentication
The Twenty MCP Server supports OAuth 2.1 authentication following the MCP Authentication Specification. This enables secure, user-specific API key management and multi-user deployments.
π OAuth Features
π Secure API Key Storage: User API keys encrypted with AES-256-GCM
π€ User-Specific Access: Each user manages their own Twenty CRM connection
π Backward Compatible: Works alongside traditional API key configuration
π‘οΈ Clerk Integration: Production-ready authentication provider
π Discovery Endpoints: Full MCP OAuth specification compliance
π Quick OAuth Setup
Run the interactive OAuth setup CLI:
This will guide you through:
Enabling OAuth authentication
Configuring Clerk credentials
Setting up encryption secrets
Testing the integration
π OAuth Documentation
For detailed OAuth implementation guide, see OAUTH.md:
Complete OAuth 2.1 Flow: Step-by-step implementation
Security Best Practices: Encryption, token validation, CORS
Client Integration Examples: JavaScript, Python, curl
Production Deployment: Environment setup and troubleshooting
π§ͺ OAuth Testing
Test your OAuth setup:
βοΈ OAuth vs API Key Configuration
Feature | API Key Mode | OAuth Mode |
Setup Complexity | Simple | Moderate |
Security | Shared key | User-specific encrypted keys |
Multi-user | β Single user | β Multiple users |
Authentication | Query parameter | Bearer token |
Key Storage | Environment variables | Encrypted in Clerk |
Backward Compatibility | β Full | β Full (when auth disabled) |
Choose API Key mode for:
Single-user deployments
Simple integrations
Quick prototyping
Choose OAuth mode for:
Multi-user applications
Production deployments
Enhanced security requirements
Verification
Before configuring your IDE, verify everything is working:
1. Run Configuration Validator
Expected output when everything is configured:
2. Test Your Configuration
3. Optional: Start HTTP Server
You should see: Server running on http://localhost:3000
IDE Integration
π Before You Begin - Checklist
Installation complete (
dist/index.jsexists)Configuration valid (
npm run validatepasses)Absolute path noted (from installation step)
API key and base URL ready
π₯οΈ Claude Desktop
Configure Claude Desktop to use your Twenty MCP server:
1. Find Your Configuration File
Platform | Location |
macOS |
|
Windows |
|
Linux |
|
2. Edit Configuration
If you installed via npm or use npx:
Note for npx users: Your configuration is automatically saved globally, so Claude Desktop will work seamlessly even when using npx!
If you cloned from Git:
β οΈ Common Mistakes to Avoid:
Using relative paths (e.g.,
./dist/index.js) - won't work!Forgetting to restart Claude Desktop after changes
Missing quotes around paths with spaces
Using wrong slashes on Windows (use
/or\\)
3. Real Examples
npm Installation or npx Usage (All Platforms):
π‘ npx users: This same configuration works whether you use npx twenty-mcp-server or install globally!
Git Installation Examples:
macOS Example:
Windows Example:
4. Verify Connection
Restart Claude Desktop (required!)
Ask Claude: "What MCP tools do you have available?"
Test with: "Show me my contacts from Twenty CRM"
π» Other IDE Integrations
Open Cursor Settings (
Cmd/Ctrl + ,)Navigate to Extensions β MCP Servers
Add configuration:
{ "name": "twenty-crm", "command": "node", "args": ["/absolute/path/to/twenty-mcp/dist/index.js"], "env": { "TWENTY_API_KEY": "your-api-key", "TWENTY_BASE_URL": "https://your-instance.com" } }Restart Cursor
Quick setup:
Install Smithery:
npm install -g @smithery/cliRun:
smithery devin the twenty-mcp directoryConfigure credentials when prompted
Or use the deployed version:
Visit smithery.ai
Search for "Twenty MCP"
Click "Use this server"
Install Cline extension from VS Code marketplace
Add to VS Code settings.json:
{ "cline.mcpServers": { "twenty-crm": { "command": "node", "args": ["/path/to/twenty-mcp/dist/index.js"], "env": { "TWENTY_API_KEY": "your-api-key", "TWENTY_BASE_URL": "https://your-instance.com" } } } }
For web integrations, run as HTTP server:
Configure via query parameters:
CLI Commands
Twenty MCP Server includes a powerful CLI for easy management:
Setup and Configuration
Server Management
Testing and Diagnostics
Status and Information
AI Assistant Usage
Basic Commands
Once configured in your IDE, you can ask your AI assistant to:
"Show me all contacts in Twenty CRM"
"Create a new company called Acme Corp"
"Find all opportunities in the proposal stage"
"Add a task to follow up with John Doe"
"Show me all activities from last week"
Example Conversations
See full tool documentation β
Troubleshooting
π§ Quick Diagnostic
First, run the configuration validator:
This will identify most common issues and suggest fixes.
π« Common Issues & Solutions
Installation Issues
Solution: Update Node.js
Solution: Build the project
Solution: Make script executable
Configuration Issues
Solution: Set your environment variables
Solution:
Verify API key is correct (no extra spaces)
Check key hasn't expired
Regenerate key in Twenty CRM Settings
Ensure you're using the correct base URL
Solution:
Check base URL is correct (no trailing slash!)
Verify Twenty instance is accessible
Check firewall/proxy settings
Test with curl:
curl -H "Authorization: Bearer YOUR_API_KEY" \ https://your-instance.com/graphql
IDE Integration Issues
Solution:
Verify absolute path is correct:
# Get the correct path cd twenty-mcp && pwdCheck config file location is correct for your OS
Ensure JSON syntax is valid (no trailing commas!)
Restart Claude Desktop (required!)
Check Claude's developer console for errors
Solution: Use proper Windows paths
π Advanced Debugging
Enable debug logging for more details:
π Getting Help
If you're still stuck:
Check existing issues: GitHub Issues
Read test documentation: TESTING.md
Create a new issue with:
Your OS and Node.js version
Complete error message
Output from
npm run validateSteps to reproduce
Additional Resources
π Documentation
Full Tool Reference - Detailed documentation of all 29 tools
Testing Guide - How to run and write tests
Contributing Guide - How to contribute to the project
ποΈ Architecture
The Twenty MCP Server is built with:
TypeScript for type safety
GraphQL for Twenty API communication
MCP SDK for protocol implementation
Zod for runtime validation
π€ Contributing
We welcome contributions! Please see our Contributing Guide for details on:
Setting up development environment
Running tests
Submitting pull requests
Code style guidelines
π License
MIT License - see LICENSE file for details.
π Acknowledgments
Twenty CRM for the open-source CRM platform
Model Context Protocol for the integration standard
Anthropic for Claude and the MCP framework
Project Structure
Key Components
TwentyClient: GraphQL client that handles API communication with Twenty CRM
MCP Tools: 29 tools that provide comprehensive CRM functionality to AI assistants
Type System: Comprehensive TypeScript definitions for Twenty's data structures
Schema Transformation: Converts flat tool inputs to Twenty's nested GraphQL schema
This server cannot be installed