Robutler
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 supports multiple transport types (SSE, HTTP, WebSocket), automatic reconnection, and background capability refresh.

Configuration

import { BaseAgent } from 'webagents';
import { MCPSkill } from 'webagents/skills/mcp';

const agent = new BaseAgent({
  name: 'mcp-agent',
  model: 'openai/gpt-4o',
  skills: [
    new 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: process.env.DB_MCP_TOKEN! },
        },
      ],
      timeout: 30_000,
      reconnectInterval: 60_000,
    }),
  ],
});

Config Reference

Parameter (Python / TS)TypeDefaultDescription
serverslist[]MCP server definitions
timeout / timeoutseconds (Py) / ms (TS)30 / 30 000Request timeout
reconnect_interval / reconnectIntervalseconds (Py) / ms (TS)60 / 60 000Reconnect delay
max_connection_errors / maxConnectionErrorsint5Errors before giving up on a server
capability_refresh_interval / capabilityRefreshIntervalseconds (Py) / ms (TS)300 / 300 000Capability re-discovery cadence

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 servers at runtime:

import { Skill, tool } from 'webagents';

class MySkill extends Skill {
  readonly name = 'my-skill';

  @tool({ description: 'Dynamically add an MCP server' })
  async addServer(params: { name: string; url: string }): Promise<string> {
    const mcp = this.agent!.skills.find((s) => s.name === 'mcp') as MCPSkill;
    await mcp.registerServer({ name: params.name, url: params.url });
    return `Connected to ${params.name}`;
  }
}

See Also

On this page