AgentsSkills

mcp_gateway

View as MarkdownOpen in Claude

Connect to MCP (Model Context Protocol) servers via the MCP Gateway service. Each MCP tool is dynamically registered as a SWAIG function, enabling your agent to use any MCP-compatible tool.

Tools: Dynamically created from connected MCP services

Requirements: Running MCP Gateway service

Multi-instance: Yes

gateway_url
strRequired

MCP Gateway service URL.

auth_user
str

Basic auth username for the gateway.

auth_password
str

Basic auth password for the gateway.

auth_token
str

Bearer token (alternative to basic auth).

services
list[dict]

Specific services and tools to enable. Each dict has name (str) and tools (str "*" or list of tool names). If omitted, all available services are enabled.

session_timeout
intDefaults to 300

Session timeout in seconds.

tool_prefix
strDefaults to mcp_

Prefix for generated function names (e.g., mcp_todo_add_todo).

retry_attempts
intDefaults to 3

Number of connection retry attempts.

request_timeout
intDefaults to 30

Individual request timeout in seconds.

verify_ssl
boolDefaults to True

Whether to verify SSL certificates.

1from signalwire import AgentBase
2
3class MyAgent(AgentBase):
4 def __init__(self):
5 super().__init__(name="assistant", route="/assistant")
6 self.set_prompt_text("You are a helpful assistant.")
7 self.add_skill("mcp_gateway", {
8 "gateway_url": "http://localhost:8080",
9 "auth_user": "admin",
10 "auth_password": "secure-password",
11 "services": [
12 {"name": "todo", "tools": "*"},
13 {"name": "calculator", "tools": ["add", "multiply"]}
14 ]
15 })
16
17agent = MyAgent()
18agent.serve()