MCP Integration Skill
This skill manages and integrates multiple MCP servers (Kite and OpenAlgo) for seamless trading operations.
Purpose
- •Configure and manage MCP servers
- •Troubleshoot MCP connection issues
- •Ensure both servers are accessible
- •Coordinate operations across MCP servers
MCP Servers Managed
1. Kite MCP
- •Type: Hosted server
- •URL:
https://mcp.kite.trade/mcp - •Command:
npx mcp-remote https://mcp.kite.trade/mcp - •Requirements: Node.js, internet connection
2. OpenAlgo MCP
- •Type: Local server
- •Port: 5002 (Dhan) or 5001 (Kite)
- •Command: Python script with API key
- •Requirements: OpenAlgo server running, valid API key
Configuration Management
Configuration File
Primary: ~/.cursor/mcp.json
Structure:
json
{
"mcpServers": {
"kite": {
"command": "npx",
"args": ["mcp-remote", "https://mcp.kite.trade/mcp"]
},
"openalgo": {
"command": "/opt/homebrew/bin/python3",
"args": [
"/path/to/mcpserver.py",
"API_KEY",
"http://127.0.0.1:5002"
]
}
}
}
Verification Steps
- •
Check Configuration:
bashcat ~/.cursor/mcp.json | python3 -m json.tool
- •
Verify Servers:
- •Kite: No local server needed
- •OpenAlgo: Check if server is running
- •
Test Connectivity:
- •Kite: Ask Cursor "What Kite MCP tools are available?"
- •OpenAlgo: Ask Cursor "What OpenAlgo MCP tools are available?"
Common Operations
Restore Missing MCP Server
If a server disappears from configuration:
python
import json
import os
mcp_file = os.path.expanduser("~/.cursor/mcp.json")
# Read existing config
with open(mcp_file, 'r') as f:
config = json.load(f)
# Add missing server
if "openalgo" not in config.get("mcpServers", {}):
config["mcpServers"]["openalgo"] = {
"command": "/opt/homebrew/bin/python3",
"args": [
"/Users/mac/dyad-apps/probable-fiesta/openalgo/mcp/mcpserver.py",
"API_KEY",
"http://127.0.0.1:5002"
]
}
# Save
with open(mcp_file, 'w') as f:
json.dump(config, f, indent=2)
Update API Key
python
# Update OpenAlgo MCP API key config["mcpServers"]["openalgo"]["args"][1] = "NEW_API_KEY"
Change Port
python
# Switch OpenAlgo MCP to port 5001 config["mcpServers"]["openalgo"]["args"][2] = "http://127.0.0.1:5001"
Troubleshooting
Issue: MCP Server Not Appearing
Diagnosis:
- •Check
~/.cursor/mcp.jsonexists and is valid JSON - •Verify server is in
mcpServersobject - •Check Cursor was restarted after config change
Fix:
- •Restore configuration
- •Restart Cursor IDE
- •Verify in Settings → MCP
Issue: OpenAlgo MCP Connection Failed
Diagnosis:
- •Check OpenAlgo server is running:
lsof -i :5002 - •Verify API key is correct
- •Check port matches configuration
Fix:
- •Start OpenAlgo server
- •Update API key if needed
- •Restart Cursor
Issue: Kite MCP Not Working
Diagnosis:
- •Check internet connection
- •Verify npx is available:
npx --version - •Check hosted server accessibility
Fix:
- •Ensure Node.js is installed
- •Check network connectivity
- •Try accessing hosted server directly
Best Practices
- •Always backup configuration before changes
- •Restart Cursor after configuration updates
- •Verify both servers are configured
- •Test connectivity after changes
- •Keep API keys secure (don't commit to git)
Related Files
- •Configuration:
~/.cursor/mcp.json - •Backup:
~/.cursor/mcp.json.backup.* - •OpenAlgo MCP:
/Users/mac/dyad-apps/probable-fiesta/openalgo/mcp/mcpserver.py
Use this skill to manage and integrate MCP servers for seamless trading operations.