mirror of
https://github.com/mintlify/docs.git
synced 2026-09-14 13:35:46 +08:00
4fcc4e706d
* sentence case headers * copyedit page * add note about auth restricting MCP server generation
120 lines
3.3 KiB
Plaintext
120 lines
3.3 KiB
Plaintext
---
|
|
title: "Model Context Protocol"
|
|
description: "Generate MCP servers from your documentation or OpenAPI specs"
|
|
icon: 'audio-waveform'
|
|
---
|
|
|
|
## Overview
|
|
|
|
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.
|
|
|
|
<Note>
|
|
MCP servers can only be generated for public documentation. Documentation behind end-user authentication cannot be accessed for server generation.
|
|
</Note>
|
|
|
|
## Generating your MCP server
|
|
|
|
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
|
|
```
|
|
|
|
### Authentication
|
|
|
|
When you run the command, you'll need to provide two API keys, `External Admin Key` and `Assistant API Key`.
|
|
|
|
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>
|
|
|
|
### Select MCP clients
|
|
|
|
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.
|
|
|
|
## 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
|
|
|
|
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
|
|
|
|
Enable MCP for all endpoints in a specification file:
|
|
|
|
```json
|
|
{
|
|
"openapi": "3.1.0",
|
|
"x-mcp": {
|
|
"enabled": true
|
|
},
|
|
// Other OpenAPI content
|
|
}
|
|
```
|
|
|
|
#### Endpoint-level configuration
|
|
|
|
Enable MCP for specific endpoints only:
|
|
|
|
```json
|
|
{
|
|
"paths": {
|
|
"/api/v1/users": {
|
|
"x-mcp": {
|
|
"enabled": true
|
|
},
|
|
// Endpoint configuration
|
|
}
|
|
}
|
|
}
|
|
```
|
|
|
|
### Authentication handling
|
|
|
|
If your OpenAPI spec defines authentication using `securitySchemes`, these authentication methods will be automatically applied to your MCP server.
|
|
|
|
### Monitoring your MCP server
|
|
|
|
After publishing your changes, you can view all available MCP tools in the **Available Tools** section on the MCP server page 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.
|