Skip to content
Last updated

Beta feature

This feature is currently experimental and may be subject to changes.

Currently, only the tools section is included in the generated documentation.

Use x-mcp to document MCP (Model Context Protocol) servers for consumers.

Location

The x-mcp extension can be added to Root Object. The root is the outer most level of the OpenAPI description.

Options

OptionTypeDescription
x-mcpMCP objectMCP server description and configuration.

MCP object

OptionTypeDescription
protocolVersionstringREQUIRED. The MCP protocol version supported by the server.
servers[ Server Object ]A list of server objects used to add one or more target endpoints for the MCP server.
capabilitiesCapabilities objectServer capabilities including supported features like logging, prompts, resources, and tools.
tools[ Tool object ]Array of tools provided by the MCP server.
resources[ Resource object ]Array of resources provided by the MCP server.
prompts[ Prompt object ]Prompt capabilities configuration with optional listChanged boolean property.

Capabilities object

OptionTypeDescription
loggingobjectLogging capabilities configuration. Empty object indicates basic logging support.
promptsobjectPrompt capabilities configuration with optional listChanged boolean property.
resourcesobjectResource capabilities configuration with optional subscribe and listChanged boolean properties.
toolsobjectTool capabilities configuration with optional listChanged boolean property.

Tool object

OptionTypeDescription
namestringREQUIRED. The name of the tool.
titlestringTitle of the tool.
descriptionstringREQUIRED. Description of what the tool does.
tags[ string ]Tags for the tool.
inputSchemaobjectJSON Schema describing the expected input parameters for the tool.
outputSchemaobject | stringJSON Schema describing the tool's output, or a reference to a schema component.
security[ object ]Security requirements for the tool, following OpenAPI security scheme format.

Resource object

OptionTypeDescription
namestringREQUIRED. The name of the resource.
descriptionstringDescription of the resource.
uristringURI template for accessing the resource.
mimeTypestringMIME type of the resource content.

Prompt object

OptionTypeDescription
namestringREQUIRED. The name of the prompt.
titlestringTitle of the prompt.
descriptionstringDescription of the prompt.
arguments[ Argument object ]Array of arguments for the prompt.

Argument object

OptionTypeDescription
namestringREQUIRED. The name of the argument.
descriptionstringDescription of the argument.
requiredbooleanWhether the argument is required.

Examples

x-mcp example

Metadata keys can be any string. The values can be any primitive type, or a list of strings.

The following is an example of an x-mcp described within an OpenAPI description file:

api-clients-mcp.yaml
openapi: 3.2.0
info:
  version: 1.0.0
  title: API Clients MCP
  license:
    name: MIT
servers:
  - url: http://localhost:8080/mcp

paths: {} # no paths

x-mcp:
  protocolVersion: '2025-06-18'
  capabilities:
    logging: {}
    prompts:
      listChanged: true
    resources:
      subscribe: true
    tools:
      listChanged: true
  tools:
    # this is the output of the list/tools call to the MCP
    - name: clients/get
      description: Get a list of clients with all scopes in a service domain.
      inputSchema:
        type: object
        properties:
          clientId:
            type: string
            description: The ID of the client to get.
      outputSchema:
        $ref: '#/components/schemas/Client'
      # we added the OAuth2 security scheme
      security:
        - OAuth2:
            scopes:
              read: Read access
    - name: clients/list
      description: Get a list of clients with all scopes in a service domain.
      inputSchema:
        type: object
        properties:
          paginationToken:
            type: string
            description: The pagination token to get the next page of clients.
      outputSchema:
        type: object
        properties:
          clients:
            type: array
            items:
              $ref: '#/components/schemas/Client'
          paginationToken:
            type: string
            description: The pagination token to get the next page of clients.
  resources: []

components:
  securitySchemes:
    OAuth2:
      type: oauth2
      flows:
        clientCredentials:
          tokenUrl: http://localhost:8080/mcp/token
          scopes:
            read: Read access
            write: Write access
  schemas:
    Client:
      type: object
      properties:
        clientId:
          type: number
          description: The ID of the client.
        scopes:
          type: array
          items:
            type: string
          description: The scopes of the client.
      required:
        - clientId
        - scopes

The data is presented similar to the following screenshot:

Example MCP docs

Resources