DenchClaw + MCP: Connect to Any AI Tool
DenchClaw + MCP: Connect to Any AI Tool
MCP — Model Context Protocol — is Anthropic's open standard for giving AI tools access to external data and actions. An MCP server exposes "tools" and "resources" that any compatible AI client can call. DenchClaw ships with an MCP server that exposes your entire CRM to any AI tool that supports the protocol.
This means Claude Desktop, Cursor, and any other MCP-compatible AI can query your contacts, read deal notes, and update CRM entries — using natural language, from wherever you're working.
What MCP Is (in 2 Minutes)#
MCP defines a standard interface between AI clients (like Claude Desktop or Cursor) and data sources (like your CRM, your filesystem, or a database). Instead of each AI tool building custom integrations with every data source, they all speak the same protocol.
From the AI client's perspective: "I have access to a tool called crm_query. I can call it with a SQL query and get back results."
From DenchClaw's perspective: "I'm an MCP server. I expose tools: crm_query, crm_create_entry, crm_update_entry, crm_search. Any MCP client can call them."
The result: you can ask Claude "Who are my top leads this month?" and it pulls the answer from DenchClaw in real time. No copy-pasting, no CSV exports.
DenchClaw's MCP Server#
DenchClaw's MCP server runs alongside the gateway. It exposes these tools:
| Tool | Description |
|---|---|
crm_query | Run a SQL query against the CRM database |
crm_search | Full-text search across all entries |
crm_get_entry | Get a single entry by ID |
crm_create_entry | Create a new CRM entry |
crm_update_entry | Update fields on an existing entry |
crm_list_objects | List all object types and their fields |
crm_get_pipeline | Get pipeline summary by stage |
And these resources:
| Resource | Description |
|---|---|
crm://people | All people entries |
crm://companies | All company entries |
crm://deals | All deal entries |
crm://documents | Workspace documents |
The MCP server starts automatically with the gateway:
openclaw gateway start
# MCP server available at http://localhost:3000/mcpConnecting DenchClaw to Claude Desktop#
Claude Desktop supports MCP natively. Configure it to connect to DenchClaw:
1. Find your Claude Desktop config file:
# macOS
open ~/Library/Application\ Support/Claude/claude_desktop_config.json
# Windows
# %APPDATA%\Claude\claude_desktop_config.json2. Add the DenchClaw MCP server:
{
"mcpServers": {
"denchclaw": {
"command": "npx",
"args": ["-y", "@dench/mcp-server"],
"env": {
"DENCH_TOKEN": "your-token-here",
"DENCH_URL": "http://localhost:3000"
}
}
}
}Alternatively, if you're running DenchClaw locally and want to use the built-in MCP endpoint directly:
{
"mcpServers": {
"denchclaw": {
"url": "http://localhost:3000/mcp",
"apiKey": "your-denchclaw-token"
}
}
}3. Get your DenchClaw API token:
openclaw auth token
# eyJhbGci...4. Restart Claude Desktop.
Now open Claude Desktop and ask:
How many leads do I have this month?
Claude will call crm_query with something like:
SELECT count(*) FROM v_person WHERE status='lead' AND created_at > date_trunc('month', current_date)And return the answer from your local DuckDB database.
More examples with Claude Desktop + DenchClaw:
Show me all deals closing this quarter with value over $10,000
Who from Acme Corp have I spoken with?
Add Jane Smith (jane@startup.io) as a new lead, she came from the Product Hunt launch
What's the total value of deals in the proposal stage?
Update Acme Corp's status to 'customer' and set MRR to 2500
Using DenchClaw Data in Cursor via MCP#
Cursor has MCP support in its AI chat. Configure it in Cursor's settings:
Via Cursor's UI:
- Open Settings (
Cmd+,) - Search "MCP"
- Click "Add MCP Server"
- Enter:
- Name:
DenchClaw - URL:
http://localhost:3000/mcp - API Key:
your-denchclaw-token
- Name:
Via .cursor/mcp.json in your project:
{
"servers": {
"denchclaw": {
"url": "http://localhost:3000/mcp",
"apiKey": "your-denchclaw-token"
}
}
}Now when you're coding in Cursor and ask the AI a question, it can pull CRM context automatically:
// In Cursor AI chat:
"Build me a customer dashboard. Use the customer data from DenchClaw."
Cursor will call crm_list_objects to understand your schema, then crm_query to pull sample data, then generate code that queries your specific fields.
This is powerful for agency developers: Cursor can reference client notes, project specs, and contact info from DenchClaw while generating code — without you having to copy-paste anything.
The mcporter Skill#
DenchClaw ships with a mcporter skill for managing MCP connections from within the agent. This is useful for connecting DenchClaw to other MCP servers — not just serving as one.
# List configured MCP servers
openclaw skill run mcporter "list servers"
# Add a new MCP server
openclaw skill run mcporter "add server: name=filesystem, url=http://localhost:3001/mcp"
# Test a connection
openclaw skill run mcporter "test connection to filesystem server"
# List tools available on a server
openclaw skill run mcporter "list tools on filesystem server"
# Call a tool directly
openclaw skill run mcporter "call filesystem/read_file with path=/Users/me/notes.txt"With mcporter, DenchClaw can consume MCP tools from:
- Your local filesystem (read/write files)
- Your browser's history and bookmarks
- Your calendar (via a calendar MCP server)
- Code repositories (via a Git MCP server)
- Any custom MCP server you build
This makes DenchClaw the orchestration hub: it has CRM data, and it can call out to any MCP-compatible data source.
Building Custom MCP Tools for DenchClaw#
You can extend DenchClaw's MCP server with custom tools. Create a skill that registers additional MCP tools:
mkdir -p ~/.openclaw-dench/workspace/skills/custom-mcp# Custom MCP Tools Skill
## Purpose
Register additional MCP tools for domain-specific CRM operations.
## Custom Tools
### get_customer_health_score
Calculates a health score for a customer based on engagement metrics.
Parameters:
- company_id: string (required)
Implementation:
1. Query DuckDB for the company's deal history, last contact date, MRR
2. Apply scoring formula: recency (0-40) + deal_value (0-40) + engagement (0-20)
3. Return: { score: number, breakdown: { recency, deal_value, engagement }, label: "healthy|at_risk|churned" }
SQL:
SELECT
c.name,
max(ef.last_contact_date) as last_contact,
sum(CAST(d.value AS DECIMAL)) as total_deal_value,
count(d.id) as deal_count
FROM v_company c
LEFT JOIN v_deal d ON d.company_id = c.id
LEFT JOIN v_person p ON p.company_id = c.id
WHERE c.id = '{company_id}'
GROUP BY c.nameRegister it with the MCP server:
openclaw mcp register-skill custom-mcp
openclaw gateway restartNow any MCP client (Claude, Cursor, etc.) can call get_customer_health_score and get back a health analysis from your actual CRM data.
MCP vs REST API: When to Use Which#
Both the MCP server and REST API expose DenchClaw's data. They serve different use cases:
| MCP | REST API | |
|---|---|---|
| Best for | AI tools, LLM integrations | Traditional code integrations |
| Client | Claude, Cursor, other AI apps | Node.js, Python, curl |
| Auth | Token in MCP config | Bearer token in HTTP header |
| Discovery | AI auto-discovers tools/resources | You read API docs |
| Queries | SQL or natural language | Structured endpoints |
| Writes | Via tool calls | POST/PATCH requests |
| Latency | Low (same machine) | Low (localhost) |
Use MCP when: You're integrating with an AI tool that supports MCP, and you want the AI to have full CRM context.
Use REST API when: You're writing code (Node.js scripts, Python scripts) that programmatically reads/writes CRM data.
Many setups use both: MCP for AI-to-CRM conversations, REST API for automated sync scripts.
Debugging MCP Connections#
If Claude or Cursor can't connect to DenchClaw's MCP server:
# Check gateway status
openclaw gateway status
# Check MCP server is responding
curl http://localhost:3000/mcp/health
# Check available tools
curl http://localhost:3000/mcp/tools \
-H "Authorization: Bearer your-token"
# View MCP server logs
openclaw gateway logs --filter mcp
# Test a tool call manually
curl -X POST http://localhost:3000/mcp/call \
-H "Authorization: Bearer your-token" \
-H "Content-Type: application/json" \
-d '{
"tool": "crm_query",
"params": {
"sql": "SELECT count(*) FROM objects"
}
}'Common issues:
- Gateway not running:
openclaw gateway start - Wrong token: regenerate with
openclaw auth token - Port conflict: change port in config, update MCP URL
- CORS error: the MCP server allows localhost origins by default; if you're connecting from a different origin, add it to config
Security Considerations#
The DenchClaw MCP server exposes your CRM data to any client with the token. Keep the token secure:
- Don't commit it to git (use environment variables)
- Use a read-only token for AI tools that don't need to write data:
openclaw auth token --read-only - Scope tokens to specific operations:
openclaw auth token --scopes "query,search" - The MCP server only accepts connections from localhost by default — don't expose it to the internet without authentication
# Create a read-only token for Claude Desktop
openclaw auth token --read-only --label "claude-desktop"MCP is the cleanest way to give AI tools access to your CRM. It's designed for this use case, the protocol is standard, and you can connect multiple AI tools to the same DenchClaw instance without managing multiple integrations.
Ready to try DenchClaw? Install in one command: npx denchclaw. Full setup guide →
