Claude Desktop Integration
Connect TONL-MCP Bridge to Claude Desktop using the HTTP/SSE transport.
Overview
Starting with v0.9.0, TONL-MCP Bridge uses HTTP/SSE transport instead of stdio. This requires a different configuration in Claude Desktop.
Prerequisites
- Claude Desktop (latest version)
- TONL-MCP Bridge v0.9.0+
- MCP server running
Step 1: Install TONL-MCP Bridge
npm install -g tonl-mcp-bridgeStep 2: Start MCP Server
Start the server with authentication:
export TONL_AUTH_TOKEN=your-secure-token
npx tonl-mcp-serverServer starts on http://localhost:3000
Output:
🚀 TONL MCP Server listening on port 3000
- SSE Stream: http://localhost:3000/mcp
🔒 Security: Enabled (Bearer Token required)Keep this terminal running!
Step 3: Configure Claude Desktop
macOS
Edit Claude Desktop config:
code ~/Library/Application\ Support/Claude/claude_desktop_config.jsonWindows
Edit Claude Desktop config:
notepad %APPDATA%\Claude\claude_desktop_config.jsonConfiguration
Add TONL server to mcpServers:
{
"mcpServers": {
"tonl": {
"url": "http://localhost:3000/mcp",
"transport": {
"type": "sse"
},
"headers": {
"Authorization": "Bearer your-secure-token"
}
}
}
}Replace your-secure-token with your actual token!
Step 4: Restart Claude Desktop
- Quit Claude Desktop completely
- Start Claude Desktop again
- Check MCP icon in bottom-right corner
Step 5: Verify Connection
In Claude Desktop, the TONL server should appear in:
- MCP settings menu
- Server status indicator
Test by asking Claude:
"Can you convert this JSON to TONL format: [{"id": 1, "name": "Test"}]"Claude should use the convert_to_tonl tool.
Available Tools
Claude Desktop has access to three tools:
1. convert_to_tonl
Convert JSON/YAML to TONL format:
Convert this data to TONL: [{"id": 1, "name": "Alice"}]2. parse_tonl
Parse TONL back to JSON:
Parse this TONL: data[1]{id:i32,name:str}: 1, Alice3. calculate_savings
Calculate token savings:
Calculate token savings for converting this data to TONL: [...]Configuration Examples
Basic (Local Development)
{
"mcpServers": {
"tonl": {
"url": "http://localhost:3000/mcp",
"transport": {
"type": "sse"
},
"headers": {
"Authorization": "Bearer dev-token-123"
}
}
}
}Production (Remote Server)
{
"mcpServers": {
"tonl": {
"url": "https://tonl.example.com/mcp",
"transport": {
"type": "sse"
},
"headers": {
"Authorization": "Bearer prod-token-abc123"
}
}
}
}Multiple Servers
{
"mcpServers": {
"tonl-dev": {
"url": "http://localhost:3000/mcp",
"transport": {
"type": "sse"
},
"headers": {
"Authorization": "Bearer dev-token"
}
},
"tonl-prod": {
"url": "https://tonl.example.com/mcp",
"transport": {
"type": "sse"
},
"headers": {
"Authorization": "Bearer prod-token"
}
}
}
}Troubleshooting
Connection Failed
Check server is running:
curl -H "Authorization: Bearer your-token" \
http://localhost:3000/mcpShould return SSE event.
Check firewall:
# macOS
sudo lsof -i :3000
# Linux
sudo netstat -tlnp | grep 3000Authentication Failed
Verify token in server logs:
# Server should log auth attempts
# Check terminal where server is runningTest token:
# Should fail (401)
curl http://localhost:3000/mcp
# Should work
curl -H "Authorization: Bearer your-token" \
http://localhost:3000/mcpTools Not Appearing
Restart Claude Desktop:
- Completely quit Claude Desktop
- Wait 5 seconds
- Restart
Check config syntax:
# Validate JSON
cat ~/Library/Application\ Support/Claude/claude_desktop_config.json | python -m json.toolServer Disconnects
Check server logs: Look for errors in terminal where server is running.
Increase timeout (if needed): Server handles long-running connections automatically.
Running as Background Service
macOS (launchd)
Create ~/Library/LaunchAgents/com.tonl.mcp.plist:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.tonl.mcp</string>
<key>ProgramArguments</key>
<array>
<string>/usr/local/bin/node</string>
<string>/usr/local/bin/tonl-mcp-server</string>
</array>
<key>EnvironmentVariables</key>
<dict>
<key>TONL_AUTH_TOKEN</key>
<string>your-secure-token</string>
</dict>
<key>RunAtLoad</key>
<true/>
<key>KeepAlive</key>
<true/>
<key>StandardOutPath</key>
<string>/tmp/tonl-mcp.log</string>
<key>StandardErrorPath</key>
<string>/tmp/tonl-mcp-error.log</string>
</dict>
</plist>Load service:
launchctl load ~/Library/LaunchAgents/com.tonl.mcp.plistLinux (systemd)
Create /etc/systemd/system/tonl-mcp.service:
[Unit]
Description=TONL MCP Server
After=network.target
[Service]
Type=simple
User=youruser
Environment="TONL_AUTH_TOKEN=your-secure-token"
ExecStart=/usr/local/bin/tonl-mcp-server
Restart=always
RestartSec=10
[Install]
WantedBy=multi-user.targetEnable and start:
sudo systemctl enable tonl-mcp
sudo systemctl start tonl-mcp
sudo systemctl status tonl-mcpWindows (NSSM)
- Download NSSM: https://nssm.cc/download
- Install service:
nssm install TONL-MCP "C:\Program Files\nodejs\node.exe" "C:\Users\YourUser\AppData\Roaming\npm\node_modules\tonl-mcp-bridge\dist\mcp\index.js"
nssm set TONL-MCP AppEnvironmentExtra TONL_AUTH_TOKEN=your-secure-token
nssm start TONL-MCPSecurity Best Practices
Generate Secure Token
# Linux/macOS
openssl rand -base64 32
# Or use password managerRotate Tokens Regularly
- Generate new token
- Update server environment
- Restart server
- Update Claude Desktop config
- Restart Claude Desktop
Use Environment Variables
Don't hardcode tokens in config files.
macOS/Linux:
export TONL_AUTH_TOKEN=$(cat ~/.tonl-token)
npx tonl-mcp-serverWindows:
set /p TONL_AUTH_TOKEN=<C:\Users\YourUser\.tonl-token
npx tonl-mcp-serverDocker Integration
If running server in Docker:
Start container:
docker run -d \
--name tonl-server \
-p 3000:3000 \
-e TONL_AUTH_TOKEN=your-token \
ghcr.io/kryptomrx/tonl-mcp-bridge:latestClaude Desktop config:
{
"mcpServers": {
"tonl": {
"url": "http://localhost:3000/mcp",
"transport": {
"type": "sse"
},
"headers": {
"Authorization": "Bearer your-token"
}
}
}
}Migration from stdio (v0.8.0)
If you were using v0.8.0 with stdio transport:
Old config (v0.8.0):
{
"mcpServers": {
"tonl": {
"command": "npx",
"args": ["tonl-mcp-server"]
}
}
}New config (v0.9.0):
{
"mcpServers": {
"tonl": {
"url": "http://localhost:3000/mcp",
"transport": {
"type": "sse"
},
"headers": {
"Authorization": "Bearer your-token"
}
}
}
}Steps:
- Update to v0.9.0
- Start server manually with token
- Update Claude Desktop config
- Restart Claude Desktop
Next Steps
- MCP Server Guide - Server configuration details
- Docker Guide - Docker deployment
- Production Deployment - Production setup
- Security Guide - Security best practices