🤝 MCP Integration
The Model Context Protocol (MCP) allows Code Puppy to connect to external tools and services, extending its capabilities infinitely.
What is MCP?
MCP (Model Context Protocol) is a standardized way for AI assistants to connect to external tools and data sources. Think of it as "plugins for AI" - you can add new capabilities without modifying Code Puppy itself.
💡 Examples of MCP Servers
- Database connections (PostgreSQL, SQLite, MongoDB)
- API integrations (GitHub, Slack, Jira)
- File system access with special permissions
- Web scraping and browser automation
- Custom business logic tools
MCP Commands
All MCP management is done through the /mcp command:
Listing Servers
/mcp list
List all configured MCP servers and their status (running/stopped).
/mcp status
Show detailed status of all MCP servers including health info.
Finding Servers
/mcp search <query>
Search the MCP server registry for servers matching your query.
/mcp search database
/mcp search github
/mcp search slack
Installing Servers
/mcp install <name>
Install an MCP server from the registry. Guides you through configuration.
/mcp install mcp-server-sqlite
Adding Custom Servers
/mcp add
Add a custom MCP server configuration with an interactive wizard.
Server Lifecycle
/mcp start <name>
Start an MCP server.
/mcp stop <name>
Stop a running MCP server.
/mcp restart <name>
Restart an MCP server.
/mcp start-all
Start all configured MCP servers.
/mcp stop-all
Stop all running MCP servers.
Troubleshooting
/mcp logs <name>
View logs from an MCP server.
/mcp test <name>
Test connectivity to an MCP server.
/mcp remove <name>
Remove an MCP server configuration.
Configuration
MCP servers are configured in ~/.code_puppy/mcp/servers.json:
{
"servers": {
"sqlite": {
"command": "uvx",
"args": ["mcp-server-sqlite", "--db-path", "./my-database.db"],
"env": {},
"auto_start": false
},
"github": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-github"],
"env": {
"GITHUB_TOKEN": "${GITHUB_TOKEN}"
},
"auto_start": true
}
}
}
Server Configuration Options
| Option | Type | Description |
|---|---|---|
command |
string | Command to run the server (e.g., "uvx", "npx", "node") |
args |
array | Command-line arguments |
env |
object | Environment variables (supports ${VAR} syntax) |
auto_start |
boolean | Start server automatically when Code Puppy starts |
Health Monitoring
Code Puppy includes built-in health monitoring for MCP servers:
- Circuit Breaker - Automatically stops retrying failed servers
- Health Checks - Periodic server health verification
- Auto-Recovery - Attempts to restart failed servers
- Error Isolation - One failing server doesn't affect others
Example: Adding SQLite
# Search for SQLite server
/mcp search sqlite
# Install it
/mcp install mcp-server-sqlite
# Or add manually
/mcp add
# Follow the wizard...
# Start the server
/mcp start sqlite
# Check status
/mcp status
# Now you can use SQL queries in your prompts!
"Query the users table to find all admins"
Popular MCP Servers
| Server | Description |
|---|---|
mcp-server-sqlite |
SQLite database access |
mcp-server-postgres |
PostgreSQL database access |
@modelcontextprotocol/server-github |
GitHub API integration |
@modelcontextprotocol/server-slack |
Slack integration |
@modelcontextprotocol/server-puppeteer |
Browser automation |