AI-powered DAML development tools via Model Context Protocol. Provides code analysis, pattern recommendations, and automated Canton environment management.
# 1. Clone and start with Docker
git clone <repository-url>
cd canton-mcp-server
docker-compose up -d
# 2. Verify it's running
curl http://localhost:7284/health
# 3. Use with Cursor or Claude Desktop
# Add to your MCP config (see Configuration below)Server URL: http://localhost:7284/mcp
Analyze DAML code, recommend patterns, validate business logic.
Use for: Code review, pattern suggestions, security analysis
Automate Canton environments, tests, and builds.
Use for: Spinning up Canton networks, running tests, building DARs
Add to .cursor/mcp.json:
{
"mcpServers": {
"canton-mcp": {
"type": "sse",
"url": "http://<you-server-ip-or.domain>:7284/mcp",
"headers": {
"X-Canton-Party-ID": "your-party::1220abc..."
}
}
}
}Add to claude_desktop_config.json:
{
"mcpServers": {
"canton": {
"command": "docker",
"args": ["exec", "canton-mcp-server", "uv", "run", "canton-mcp-server", "serve"]
}
}
}Create .env.canton:
# Server
MCP_SERVER_URL=http://localhost:7284
# x402 Payments (REQUIRED for production)
CANTON_ENABLED=true
CANTON_FACILITATOR_URL=http://46.224.109.63:3000
CANTON_PAYEE_PARTY=damlcopilot-receiver::1220...
CANTON_NETWORK=canton-devnet
# DCAP Performance Tracking (optional)
DCAP_ENABLED=true
DCAP_MULTICAST_IP=159.89.110.236
DCAP_PORT=10191
# Canonical docs path (optional, defaults to ../../canonical-daml-docs)
CANONICAL_DOCS_PATH=/path/to/canonical-daml-docsdocker-compose up -d
docker-compose logs -f# Using uv (recommended)
uv sync
uv run canton-mcp-server
# Using pip
pip install -e .
canton-mcp-serverThe server needs access to official DAML repositories for pattern recommendations:
# Create canonical docs directory (parallel to server)
mkdir -p ../canonical-daml-docs
cd ../canonical-daml-docs
# Clone official repos
git clone https://github.com/digital-asset/daml.git
git clone https://github.com/digital-asset/canton.git
git clone https://github.com/digital-asset/daml-finance.gitExpected structure:
your-projects/
├── canonical-daml-docs/
│ ├── daml/
│ ├── canton/
│ └── daml-finance/
└── canton-mcp-server/
Set custom path via CANONICAL_DOCS_PATH environment variable if needed.
IMPORTANT: When using a production/public server, always include your party ID:
# In headers
X-Canton-Party-ID: your-party::1220abc...
# Or in URL
http://server:7284/mcp?payerParty=your-party::1220abc...Without a party ID, requests will be rejected (security protection against free access).
Payment flow:
- Tool call requires payment ($0.10 per call)
- Server registers payment requirement with facilitator
- Wallet executes payment on Canton blockchain
- Server verifies payment and processes request
See canton-x402-facilitator for payment infrastructure setup.
# List available tools
curl -X POST http://localhost:7284/mcp \
-H "Content-Type: application/json" \
-H "X-Canton-Party-ID: your-party::123" \
-d '{"jsonrpc":"2.0","id":1,"method":"tools/list"}'
# Call daml_reason
curl -X POST http://localhost:7284/mcp \
-H "Content-Type: application/json" \
-H "X-Canton-Party-ID: your-party::123" \
-d '{
"jsonrpc":"2.0",
"id":2,
"method":"tools/call",
"params":{
"name":"daml_reason",
"arguments":{"businessIntent":"Create a simple IOU contract"}
}
}'
# Interactive testing
npx @modelcontextprotocol/inspector http://localhost:7284/mcp- CANTON_X402_INTEGRATION.md - Payment integration guide
- DEPLOYMENT_SETUP.md - Production deployment
- QUICK_START.md - Detailed setup guide
# Install dev dependencies
uv sync --dev
# Run server
uv run python -m canton_mcp_server.server
# Run tests
pytestSimple stack:
- FastAPI server with HTTP+SSE transport
- Two MCP tools (daml_reason, daml_automater)
- x402 payment integration (Canton Coin)
- DCAP performance tracking
- Canonical resource recommendations
Payment philosophy:
- No rate limiting (payment IS the limiter)
- No authentication (permissionless by design)
- Single requirement: proof of payment
- Fork the repository
- Create a feature branch
- Make your changes
- Submit a pull request
MIT License - see LICENSE file for details.