Skip to content

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

  1. Navigate to MCP
  2. Click Add Server
  3. Enter server details:
    • Name
    • URL
    • Authentication
  4. 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}/tools

Response:

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 results

In 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}/mcp

Get 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

StatusDescription
connectedServer is accessible
disconnectedConnection failed
errorServer returned error
pendingConnection 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-tools not server1
  • database-ops not mcp-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

  1. Verify server URL
  2. Check authentication
  3. Test network connectivity
  4. Review server logs

Tools Not Loading

  1. Refresh tool list
  2. Check server version
  3. Verify protocol compatibility
  4. Review error messages

Slow Response

  1. Check server latency
  2. Monitor timeout settings
  3. Consider caching
  4. Optimize queries

API Reference

See MCP API for complete endpoint documentation.

Released under the MIT License.