Skip to content
Merged
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
149 changes: 86 additions & 63 deletions ai/model-context-protocol.mdx
Original file line number Diff line number Diff line change
@@ -1,70 +1,45 @@
---
title: "Model Context Protocol"
description: "Generate MCP servers from your documentation or OpenAPI specs"
description: "Let users access your docs and APIs through their favorite AI tools"
icon: 'audio-waveform'
---

## Overview
<Info>
MCP server generation is available on [Pro and Enterprise plans](https://mintlify.com/pricing?ref=mcp).
</Info>

The Model Context Protocol (MCP) is an open protocol that connects your functions to LLMs and AI applications. With Mintlify's integration, you can automatically generate an MCP server from your existing documentation or OpenAPI specifications, enabling seamless AI-powered interactions with your product.
## About MCP servers

<Note>
MCP servers can only be generated for public documentation. Documentation behind end-user authentication cannot be accessed for server generation.
</Note>
The Model Context Protocol (MCP) is an open protocol that creates standardized connections between AI applications and external services, like documentation. Mintlify generates an MCP server from your documentation and OpenAPI specifications, preparing your content for the broader AI ecosystem where any MCP client (like Claude, Cursor, Goose, and others) can connect to your documentation and APIs.

## Generating your MCP server
Your MCP server exposes tools and resources to AI applications:

Public documentation hosted on Mintlify can be extracted as an MCP server using the following command:

```bash
npx mint-mcp add <your-subdomain-or-domain>
```

Examples:

```bash
# Using subdomain
npx mint-mcp add mintlify

# Using domain
npx mint-mcp add mintlify.com
```
- **Tools**: Functions that can be called by the AI application, including documentation search and API calls.
- **Resources**: Your documentation content, API responses, and other data.

### Authentication
This structure allows any MCP-compatible tool to understand and work with your documentation in a consistent way.

When you run the command, you'll need to provide two API keys, `External Admin Key` and `Assistant API Key`.
## Accessing your MCP server

These can be found in your [dashboard](https://dashboard.mintlify.com/settings/organization/api-keys) under **Settings > API Keys**.

<Frame>
<img src="/images/mcp/mcp-terminal.png" alt="Terminal prompt asking What is the Bearer Token for Mintlify External API?" />
</Frame>
<Note>
MCP servers can only be generated for public documentation. Documentation behind end-user authentication cannot be accessed for server generation.
</Note>

### Select MCP clients
Your MCP server is automatically generated and hosted at your documentation URL with the `/mcp` path.

After authentication, you'll choose which MCP clients to enable for your server:

<Frame>
<img src="/images/mcp/mcp-terminal-completed.png" alt="MCP Clients listed in the terminal." />
</Frame>

Once configured, your MCP server is ready to use with the command provided in the terminal.
For example, Mintlify's MCP server is available at `https://mintlify.com/docs/mcp`.

## Configuring your MCP server

Now let's take a look at how to configure your MCP server.

### Default functionality

All MCP servers include the `search` tool by default, allowing users to query information across your entire documentation.

### Adding API functions
All MCP servers include the `search` tool by default, allowing users to query information from your docs in other tools.

If you have an OpenAPI specification, you can expose specific endpoints as MCP tools by using the `x-mcp` extension at either the file or endpoint level.

#### File-level configuration
For example, the Mintlify MCP server includes tools to get status updates, trigger updates, and create assistant chats.

### File-level configuration

Enable MCP for all endpoints in a specification file:
Enable MCP for all endpoints in an OpenAPI specification file:

```json
{
Expand All @@ -76,7 +51,7 @@
}
```

#### Endpoint-level configuration
### Endpoint-level configuration

Enable MCP for specific endpoints only:

Expand All @@ -93,27 +68,75 @@
}
```

### Authentication handling
## Using your MCP server

Your users must connect your MCP server to their preferred AI tools.

1. Make your MCP server URL publicly available.
2. Users copy your MCP server URL and add it to their tools.
3. The tools will have standardized access to your documentation and API endpoints.

### Claude

To use your MCP server with Claude:

<Steps>
<Step title="Add your MCP server to Claude">
1. Navigate to the [Connectors](https://claude.ai/settings/connectors) page in the Claude settings.
2. Select **Add custom connector**.
3. Add your MCP server name and URL.
4. Select **Add**.
</Step>
<Step title="Access resources in your chat">
1. When using Claude, select the attachments button (the plus icon).
2. Select your MCP server.
3. The menu displays all resources available to your MCP server. Select the resources you want to use in your chat.
</Step>
</Steps>

See the [Model Context Protocol documentation](https://modelcontextprotocol.io/docs/tutorials/use-remote-mcp-server#connecting-to-a-remote-mcp-server) for more details.

### Cursor

To connect your MCP server to Cursor:

<Steps>
<Step title="Open MCP settings">
1. Use <kbd>Command</kbd> + <kbd>Shift</kbd> + <kbd>P</kbd> (<kbd>Ctrl</kbd> + <kbd>Shift</kbd> + <kbd>P</kbd> on Windows) to open the command palette.

Check warning on line 105 in ai/model-context-protocol.mdx

View check run for this annotation

Mintlify / Mintlify Validation (mintlify) - vale-spellcheck

ai/model-context-protocol.mdx#L105

Did you really mean 'Ctrl'?
2. Search for "Open MCP settings".
3. Select **Add custom MCP**. This will open the `mcp.json` file.
</Step>
<Step title="Configure your server">
In `mcp.json`, configure your server:

```json mcp.json example
{
"mcpServers": {
"server-name": {
"url": "https://your-docs-site.com/mcp"
}
}
}
```
</Step>
<Step title="Test the connection">
In Cursor's chat, you can ask "What tools do you have available?" Cursor should have your documentation search and any configured API endpoints.
</Step>
</Steps>

See [Installing MCP servers](https://docs.cursor.com/en/context/mcp#installing-mcp-servers) in the Cursor documentation for more details.

If your OpenAPI spec defines authentication using `securitySchemes`, these authentication methods will be automatically applied to your MCP server.
## Authentication

### Monitoring your MCP server
When using API endpoints through your MCP server, AI tools will prompt users for their API keys as needed. These keys are handled directly by the tool and not stored or processed by Mintlify.

After publishing your changes, you can view all available MCP tools in the **Available Tools** section on the MCP server page in your dashboard.
If a user asks their AI tool to demonstrate an API call, it will request the necessary authentication credentials from the user at that moment.

## Monitoring your MCP server

You can view all available MCP tools in the **Available tools** section of the [MCP Server page](https://dashboard.mintlify.com/products/mcp) in your dashboard.

<Frame>
<img src="/images/mcp/mcp-server-page-light.png" alt="MCP dashboard with Available tools section emphasized" class="block dark:hidden" />
<img src="/images/mcp/mcp-server-page-dark.png" alt="MCP dashboard with Available tools section emphasized" class="hidden dark:block" />
</Frame>

## Distribution

### User installation

Your users can install and use your MCP server with:

```bash
npx mint-mcp add <your-subdomain-or-domain>
```

This provides them with a ready-to-use MCP server that connects your documented functions to AI applications.