> ## Documentation Index
> Fetch the complete documentation index at: https://docs.gurubase.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# MCP Client

> Connect external MCP servers (tools) to your Guru to enhance answers

## Introduction

MCP Client Connections let you connect external [MCP (Model Context Protocol)](https://modelcontextprotocol.io/) servers to your Guru. When a user asks a question, your Guru can call tools from these connected servers to fetch real-time data, perform lookups, or execute actions as part of generating its answer.

For example, you could connect:

* A database MCP server so your Guru can query live data
* An internal API server so your Guru can fetch user-specific information
* A monitoring MCP server so your Guru can check system status

> [!NOTE]
>
> This is different from the [MCP Server](https://docs.gurubase.ai/guides/mcp-server.md) feature, which
> exposes your Guru **as** an MCP server. MCP Client Connections let your Guru
> **consume** external MCP servers.

> [!NOTE]
>
> Connected MCP tools work in both **Chat** and **Agent** answer modes — the
> difference is how they are called. See [Answer Modes](https://docs.gurubase.ai/guides/answer-modes.md).

## Prerequisites

* A Guru on [Gurubase Cloud](https://app.gurubase.io) or a self-hosted instance
* An external MCP server you want to connect (remote HTTP endpoint, or a local command for self-hosted only)
* API enabled on your Guru (Settings > Integrations > API)

## Adding a Connection

1. Navigate to your Guru's settings
2. Click **MCP** in the sidebar
3. Select the **MCP Clients** tab
4. Click **Add Connection**
5. Fill in the connection details:
   * **Name**: A descriptive name for the connection
   * **Server Config (JSON)**: The MCP server configuration (see [Configuration Format](#configuration-format) below)
   * **Tool Cache TTL**: How long discovered tools are cached (default: 600 seconds)
   * **Tool Timeout**: Max time for tool discovery and execution (default: 10 seconds)
6. Click **Test Connection** to verify it works
7. Click **Create** to save

## Configuration Format

The server config is a JSON object. The format depends on whether your MCP server is a local command (stdio) or a remote HTTP endpoint.

### Local Server (stdio)

> [!NOTE]
>
> Local (stdio) connections are only available in **self-hosted** deployments.
> On Gurubase Cloud, use a [Remote Server (Streamable HTTP)](#remote-server-streamable-http) instead.

Use this when the MCP server runs as a subprocess on the backend. The config must contain a `command` field.

```json theme={null}
{
  "command": "npx",
  "args": ["-y", "your-mcp-server"],
  "env": {
    "API_KEY": "your-api-key"
  }
}
```

| Field | Type | Required | Description |
| - | - | - | - |
| `command` | string | Yes | The command to run |
| `args` | array | No | Command arguments |
| `env` | object | No | Environment variables for the subprocess |

### Remote Server (Streamable HTTP)

Use this when the MCP server is accessible over HTTP. The config must contain a `url` field.

```json theme={null}
{
  "url": "https://your-mcp-server.com/mcp",
  "headers": {
    "Authorization": "Bearer YOUR_API_KEY"
  }
}
```

| Field | Type | Required | Description |
| - | - | - | - |
| `url` | string | Yes | The MCP server URL |
| `headers` | object | No | HTTP headers (e.g., for authentication) |

> [!NOTE]
>
> The config must contain either `command` (for stdio, self-hosted only) or `url` (for HTTP).
> If neither is present, the connection will be invalid.

## Testing Connections

Before saving, use the **Test Connection** button to verify your configuration:

* **Success**: Shows the number of tools discovered from the server (e.g., "Connection successful: 3 tools found")
* **Failure**: Shows an error message indicating what went wrong (e.g., timeout, invalid URL, authentication error)

Testing uses the **Tool Timeout** value you configured. If the server takes longer than the timeout to respond, the test will fail.

## Managing Connections

### Enable / Disable

Toggle a connection on or off from the actions menu (three-dot icon) on each row. Disabled connections are skipped during question answering.

### Edit

Click **Edit** in the actions menu to modify the connection name, config, cache TTL, or timeout.

### Delete

Click **Delete** in the actions menu. A confirmation dialog will appear before the connection is removed.

### View Discovered Tools

Click **View Tools** in the actions menu to see all tools discovered from the MCP server. For each tool you can see:

* A checkbox to enable or disable the tool for your Guru
* Tool name and description
* Parameters (name, type, required, description)
* A **Test** button to execute the tool with custom arguments and see the result

Uncheck a tool to hide it from the model while keeping it discoverable. Discovery stays fully dynamic: newly added tools appear automatically, and only the tools you explicitly disable are filtered out. Click **Save** to apply your changes.

The header on the **MCP Clients** tab shows how many tools are currently enabled against the per-guru cap and how many are disabled across enabled connections.

## How It Works

When a user asks a question to your Guru:

1. **Tool Discovery**: Gurubase discovers available tools from each enabled MCP connection (results are cached based on the Tool Cache TTL)
2. **Tool Selection**: During answer generation, the AI evaluates which MCP tools (if any) are relevant to the question
3. **Tool Execution**: If a tool is selected, Gurubase calls it on the external MCP server with the appropriate arguments
4. **Answer Generation**: The tool's response is incorporated into the Guru's answer as additional context

Tools from MCP connections appear alongside any [custom actions](https://docs.gurubase.ai/guides/actions.md) you've configured. The per-guru tool limit applies to the combined total of MCP tools across all connections.

## Next Steps

> [card] [MCP Server](https://docs.gurubase.ai/guides/mcp-server.md)
>
> Expose your Guru as an MCP server

> [card] [Actions](https://docs.gurubase.ai/guides/actions.md)
>
> Create custom API call actions for your Guru


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.