---
url: /guides/mcp.md
---
# MCP Connections

Memoh fully supports the **Model Context Protocol (MCP)**, allowing you to connect your Bot to external tool services and context providers.

## Concept: Extending Bot Capabilities

MCP provides a standardized way for bots to access external data sources and tools. Each Bot can have its own independent set of MCP connections.

You can configure connections manually from the **MCP** tab, or start from a curated template in **[Supermarket](./supermarket.md)** and then review the prefilled draft in the bot editor.

***

## Connection Types

Configure MCP connections from the **MCP** tab in the Bot Detail page.

### 1. Stdio (Local Process)

This type of connection executes a local command inside the bot's container and communicates via standard input/output.

| Field | Description |
|-------|-------------|
| **Command** | The executable to run (e.g., `npx`, `python3`). |
| **Arguments** | A list of command-line arguments (e.g., `-y`, `@modelcontextprotocol/server-filesystem`, `/opt/memoh/data`). |
| **Env** | Key-value pairs for environment variables. |
| **CWD** | Working directory for the process. |

### 2. Remote (HTTP/SSE)

This type of connection connects to a remote MCP server over the network.

| Field | Description |
|-------|-------------|
| **URL** | The endpoint of the remote MCP server. |
| **Headers** | Custom HTTP headers (e.g., for authentication). |
| **Transport** | Choose between `http` or `sse` (Server-Sent Events). |

***

## OAuth Authentication

Some MCP servers require OAuth-based authentication. Memoh supports the full MCP OAuth flow:

1. Click the **OAuth** button on a connection that requires authentication.
2. Memoh will **discover** the server's OAuth configuration automatically.
3. Click **Authorize** to open the provider's authorization page.
4. After granting access, you are redirected back to Memoh.
5. The token is **exchanged** and stored securely for the connection.

You can also:

* **Check status** — View the current OAuth token status.
* **Revoke** — Remove the stored OAuth token.

***

## Operations

* **Add Connection**: Click **Add**, choose the type, and fill in the configuration.
* **Import JSON**: Use the **Import** button to quickly add multiple connections from a standard `mcpServers` JSON config file.
* **Export**: Export connection configurations to a JSON file for backup or sharing.
* **Toggle Active**: Enable or disable specific connections without deleting them.
* **Search**: Quickly find a connection by name or ID.
* **Batch Delete**: Select multiple connections and delete them at once.

***

## Tool Discovery

Once an MCP connection is active, Memoh automatically discovers the tools exposed by the server. You can:

1. Click on a connection to view its details.
2. The **Tools** section lists all available tools with their names and descriptions.
3. The bot will use these tools automatically during conversations when relevant.

You can also use the **Probe** button to manually refresh the tool list from the server.

***

## Bot Interaction

Once an MCP connection is active, the bot will automatically:

* Discover the tools and resources exposed by the MCP server.
* Use these tools to perform tasks requested by the user.
* Include the context provided by the MCP server in its reasoning process.
