RobutlerRobutler
SkillsCore

MCP Skill

Connect any Model Context Protocol (MCP) server to your agent. The MCP skill discovers tools, resources, and prompts from external servers and makes them available as native agent tools.

Overview

MCP is the general-purpose integration path for tool ecosystems. Instead of writing custom skills for each service, point the MCP skill at any MCP-compatible server and its tools become available to your agent automatically.

The skill uses the official MCP Python SDK with support for multiple transport types (SSE, HTTP, WebSocket), automatic reconnection, and background capability refresh.

Configuration

from webagents import BaseAgent
from webagents.agents.skills.core.mcp import MCPSkill

agent = BaseAgent(
    name="mcp-agent",
    model="openai/gpt-4o",
    skills={
        "mcp": MCPSkill({
            "servers": [
                {
                    "name": "weather",
                    "url": "https://weather-mcp.example.com/mcp",
                    "transport": "sse",
                },
                {
                    "name": "database",
                    "url": "https://db-mcp.example.com/mcp",
                    "transport": "http",
                    "auth": {"type": "bearer", "token": "${DB_MCP_TOKEN}"},
                },
            ],
            "timeout": 30.0,
            "reconnect_interval": 60.0,
        }),
    },
)

Config Reference

ParameterTypeDefaultDescription
serverslist[]MCP server definitions
timeoutfloat30.0Request timeout in seconds
reconnect_intervalfloat60.0Seconds between reconnection attempts
max_connection_errorsint5Errors before giving up on a server
capability_refresh_intervalfloat300.0Seconds between capability re-discovery

Server Config

FieldRequiredDescription
nameYesIdentifier for this server
urlYesServer endpoint URL
transportNosse, http, or websocket (default: sse)
authNoAuthentication config ({"type": "bearer", "token": "..."})

How It Works

On initialization, the skill connects to each configured MCP server and discovers its capabilities:

  1. Tools are registered as agent tools — the LLM can call them directly
  2. Resources are exposed for data retrieval
  3. Prompts are available for prompt injection

The skill runs background tasks for health monitoring and capability refresh, automatically reconnecting if a server goes down.

Platform MCP Proxy

When running on the Robutler platform, agents can also access MCP servers through the platform's proxy at /api/integrations/mcp/{provider}. The proxy handles authentication for connected accounts (Google, n8n, etc.) and supports tool-level pricing with _metering.

See the MCP Integration Guide for platform-specific setup.

Dynamic Tool Registration

Skills can register additional MCP tools at runtime:

class MySkill(Skill):
    @tool
    async def add_server(self, name: str, url: str) -> str:
        """Dynamically add an MCP server."""
        mcp = self.agent.skills["mcp"]
        await mcp._register_mcp_server({"name": name, "url": url})
        return f"Connected to {name}"

See Also

On this page