MCP Servers
Model Context Protocol (MCP) servers extend your agent's capabilities with external tools and resources.
Overview
MCP enables:
- Tool discovery and execution
- Resource access
- Context sharing
- Standardized integration
What is MCP?
The Model Context Protocol is an open standard for:
- Connecting AI to external systems
- Exposing tools and resources
- Stateless tool discovery
- Cross-platform compatibility
Adding MCP Servers
Via Dashboard
- Navigate to MCP
- Click Add Server
- Enter server details:
- Name
- URL
- Authentication
- Click Connect
Via API
bash
curl -X POST https://your-domain.com/api/agents/{id}/mcp \
-H "Content-Type: application/json" \
-d '{
"name": "GitHub Tools",
"url": "https://mcp.github.com/v1",
"auth": {
"type": "bearer",
"token": "{{secrets.github_token}}"
}
}'Server Configuration
Basic Server
json
{
"name": "Database Tools",
"url": "https://mcp.example.com",
"description": "Database operations"
}Authenticated Server
json
{
"name": "Secure API",
"url": "https://mcp.secure.com",
"auth": {
"type": "bearer",
"token": "secret-token"
}
}Headers
json
{
"name": "Custom Server",
"url": "https://mcp.custom.com",
"headers": {
"X-API-Key": "key123",
"X-Tenant": "tenant-1"
}
}Tool Discovery
MCP servers expose tools dynamically:
┌─────────────────┐ ┌─────────────────┐
│ Uranus Agent │────▶│ MCP Server │
│ │ │ │
│ "List tools" │ │ Returns: │
│ │◀────│ - search_db │
│ │ │ - create_user │
│ │ │ - send_email │
└─────────────────┘ └─────────────────┘Get Available Tools
bash
curl https://your-domain.com/api/agents/{id}/mcp/{serverId}/toolsResponse:
json
{
"tools": [
{
"name": "search_database",
"description": "Search the database",
"parameters": {
"type": "object",
"properties": {
"query": {
"type": "string",
"description": "Search query"
},
"limit": {
"type": "number",
"default": 10
}
},
"required": ["query"]
}
}
]
}Using MCP Tools
In Chat
MCP tools are automatically available:
User: "Search the database for recent orders"
Agent: [Calls search_database tool via MCP]
→ Returns resultsIn Workflows
json
{
"type": "mcp-tool",
"data": {
"server": "database-tools",
"tool": "search_database",
"args": {
"query": "{{input.search_term}}",
"limit": 20
}
}
}Managing Servers
List Servers
bash
curl https://your-domain.com/api/agents/{id}/mcpGet Server Status
bash
curl https://your-domain.com/api/agents/{id}/mcp/{serverId}Delete Server
bash
curl -X DELETE "https://your-domain.com/api/agents/{id}/mcp?id={serverId}"Server Status
| Status | Description |
|---|---|
connected | Server is accessible |
disconnected | Connection failed |
error | Server returned error |
pending | Connection in progress |
Authentication Types
Bearer Token
json
{
"auth": {
"type": "bearer",
"token": "your-api-token"
}
}API Key
json
{
"auth": {
"type": "api-key",
"key": "X-API-Key",
"value": "your-api-key"
}
}OAuth
json
{
"auth": {
"type": "oauth",
"client_id": "...",
"client_secret": "...",
"token_url": "https://..."
}
}Common MCP Servers
Database Operations
- Query execution
- Schema inspection
- Data manipulation
File Systems
- Read/write files
- Directory listing
- File search
Web Services
- HTTP requests
- Web scraping
- API integration
Code Execution
- Run scripts
- Evaluate expressions
- Execute commands
Building MCP Servers
Create custom MCP servers:
typescript
import { MCPServer } from 'mcp-sdk'
const server = new MCPServer({
name: 'My Tools',
version: '1.0.0'
})
server.addTool({
name: 'my_tool',
description: 'Does something useful',
parameters: {
type: 'object',
properties: {
input: { type: 'string' }
}
},
handler: async ({ input }) => {
return { result: `Processed: ${input}` }
}
})
server.start()Best Practices
1. Use Descriptive Names
Name servers clearly:
github-toolsnotserver1database-opsnotmcp-2
2. Secure Credentials
Protect authentication:
- Use secrets storage
- Rotate tokens regularly
- Limit permissions
3. Monitor Status
Track server health:
- Check connectivity
- Monitor latency
- Alert on failures
4. Document Tools
Describe tools clearly:
- Purpose
- Parameters
- Examples
- Limitations
5. Handle Errors
Implement graceful failures:
- Retry logic
- Fallback behavior
- Error logging
Troubleshooting
Connection Failed
- Verify server URL
- Check authentication
- Test network connectivity
- Review server logs
Tools Not Loading
- Refresh tool list
- Check server version
- Verify protocol compatibility
- Review error messages
Slow Response
- Check server latency
- Monitor timeout settings
- Consider caching
- Optimize queries
API Reference
See MCP API for complete endpoint documentation.