***

title: MCP Gateway
sidebar-title: MCP Gateway
slug: /reference/python/agents/mcp-gateway
description: Bridge MCP servers with SignalWire SWAIG functions via an HTTP gateway.
max-toc-depth: 3
---------------------

For a complete index of all SignalWire documentation pages, fetch https://signalwire.com/docs/llms.txt

[agentbase-addmcpserver]: /docs/server-sdks/reference/python/agents/agent-base/add-mcp-server

[mcp-gateway-cli-command]: /docs/server-sdks/reference/python/agents/cli/mcp-gateway

[mcp-gateway]: /docs/server-sdks/reference/python/agents/mcp-gateway/mcp-gateway

[session-manager]: /docs/server-sdks/reference/python/agents/mcp-gateway/session-manager

[mcp-manager]: /docs/server-sdks/reference/python/agents/mcp-gateway/mcp-manager

[mcp-client]: /docs/server-sdks/reference/python/agents/mcp-gateway/mcp-client

The MCP Gateway module provides an HTTP/HTTPS server that bridges
[Model Context Protocol](https://modelcontextprotocol.io/) (MCP) servers with
SignalWire SWAIG functions. It manages sessions, handles authentication, and
translates between the MCP JSON-RPC protocol and SignalWire's tool-calling
interface.

Use the MCP Gateway when you want to expose tools from one or more MCP servers
as SWAIG functions that a SignalWire AI agent can call during a conversation.

```python
from signalwire.mcp_gateway import MCPGateway

gateway = MCPGateway("config.json")
gateway.run()
```

<Info>
  For agent-side MCP integration, see
  [`AgentBase.add_mcp_server()`][agentbase-addmcpserver].
  For the CLI entry point, see the
  [`mcp-gateway` CLI command][mcp-gateway-cli-command].
</Info>

## **Learn More**

<CardGroup cols={2}>
  <Card title="MCPGateway" href="/docs/server-sdks/reference/python/agents/mcp-gateway/mcp-gateway">
    The main gateway service class. Loads configuration, sets up routes, and runs the HTTP server.
  </Card>

  <Card title="Session Management" href="/docs/server-sdks/reference/python/agents/mcp-gateway/session-manager">
    Session and SessionManager classes for tracking MCP session lifecycles.
  </Card>

  <Card title="MCP Management" href="/docs/server-sdks/reference/python/agents/mcp-gateway/mcp-manager">
    MCPService and MCPManager classes for spawning and managing MCP servers.
  </Card>

  <Card title="MCPClient" href="/docs/server-sdks/reference/python/agents/mcp-gateway/mcp-client">
    Client for communicating with a single MCP server subprocess via JSON-RPC.
  </Card>
</CardGroup>