OpenAPI Mcp Server

by FusionWorks

284 downloads Not rated yet
GitHub

About

# OpenAPI MCP Server This application exposes any REST API as an MCP (Model Context Protocol) server based on its OpenAPI schema. It automatically generates MCP tools from OpenAPI operations with comprehensive OpenAPI 3.0+ support. ## Features - **Complete OpenAPI 3.0+ Support**: Parse schemas from JSON and YAML…

Explore

- Complete OpenAPI 3.0+ Support: Parse schemas from JSON and YAML formats
- Advanced Schema Processing: Full $ref resolution, composition schemas (oneOf, anyOf, allOf)
- Rich Tool Generation: Automatic MCP tools with detailed descriptions, validation, and metadata
- Multiple Content Types: Support for JSON, XML, form data, and multipart uploads
- Parameter Handling: Path, query, header parameters with type conversion and validation
- Authentication: HTTP Basic Authentication and custom headers support
- Enhanced Error Handling: Detailed error messages with request context
- Type Safety: Full TypeScript implementation with comprehensive validation
- Testing: Extensive test suite with 90%+ coverage

Setting up with Highlight

This MCP is not yet compatible with Highlight’s one-click setup. However, you can still use it with Highlight by following these steps:

  1. Download and install Highlight from highlightai.com/download
  2. Navigate to the plugins tab and select "Add Custom Plugin"
  3. Configure the plugin with the settings below
    Plugin Name OpenAPI Mcp Server
    Command (node, npx, python, etc.)

    Please refer to the README for specific instructions on how to obtain API keys or other required environment variables.

  4. Enable "Start Automatically" if you want the plugin to start when Highlight launches

From the repository

``bash
npm install
npm run build


npm start -- --schema ./api-schema.yaml

npm start -- --schema ./api-schema.yaml --headers '{"Authorization": "Bearer your-token"}'

npm start -- --schema ./api-schema.yaml --username myuser --password mypass

The server supports HTTP Basic Authentication by providing username and password via command line arguments:

bash
npm start -- --schema ./api-schema.yaml --username myuser --password mypassword
`

When basic authentication credentials are provided:
- Both username and password must be specified (cannot provide just one)
- Credentials are base64 encoded and sent in the
Authorization: Basic <encoded> header
- All API requests will automatically include the authentication header

The configuration file is located at:

- macOS:
~/Library/Application Support/Claude/claude_desktop_config.json
- Windows:
%APPDATA%\Claude\claude_desktop_config.json

1. Build the server (if you haven't already):
`bash
npm install
npm run build
`

2. Open or create the Claude Desktop configuration file at the location above.

3. Add the MCP server configuration:
`json
{
"mcpServers": {
"openapi-server": {
"command": "node",
"args": [
"/path/to/your/openapi-mcp-server/dist/index.js",
"--schema",
"/path/to/your/openapi-schema.yaml"
]
}
}
}
`

4. Replace the paths with your actual paths:
- Replace
/path/to/your/openapi-mcp-server/ with the full path to where you cloned/downloaded this project
- Replace
/path/to/your/openapi-schema.yaml with the full path to your OpenAPI schema file

Here are example configurations showing different authentication methods:

`json
{
"mcpServers": {
"secure-api": {
"command": "node",
"args": [
"/Users/username/projects/openapi-mcp-server/dist/index.js",
"--schema",
"/Users/username/projects/openapi-mcp-server/api-schema.yaml",
"--username",
"apiuser",
"--password",
"secret123"
]
}
}
}


json
{
"mcpServers": {
"xmpt-api": {
"command": "node",
"args": [
"/Users/username/projects/openapi-mcp-server/dist/index.js",
"--schema",
"/Users/username/projects/openapi-mcp-server/schema.yaml",
"--base-url",
"https://api.your.service",
"--headers",
"{\"Authorization\": \"Bearer your-api-token\"}"
]
}
}
}

json
{
"mcpServers": {
"secure-api": {
"command": "node",
"args": [
"/Users/username/projects/openapi-mcp-server/dist/index.js",
"--schema",
"/Users/username/projects/schemas/secure-api.yaml",
"--username",
"admin",
"--password",
"password123"
]
},
"public-api": {
"command": "node",
"args": [
"/Users/username/projects/openapi-mcp-server/dist/index.js",
"--schema",
"/Users/username/projects/schemas/public-api.json"
]
}
}
}
`

When adding the server to Claude Desktop, you can use all the same command-line options:

-
--schema <path> - Path to your OpenAPI schema file (required)
-
--base-url <url> - Override the base URL from the schema
-
--headers <json> - Add authentication or other headers as JSON string
-
--username <username> - Username for basic authentication
-
--password <password>` - Password for basic authentication

npm install

- Rich Descriptions: Combines summaries, descriptions, tags, and response information
- Enhanced Metadata: Stores operation metadata for improved tool execution context
- Content Type Detection: Intelligently prioritizes content types (JSON > XML > others)
- Parameter Validation: Comprehensive validation with detailed error messages

Claude Desktop / Cursor

Paste into your MCP client config file to install this server.

{
    "mcpServers": {
        "openapi mcp server": {
            "openapi-server": {
                "command": "node",
                "args": [
                    "/path/to/your/openapi-mcp-server/dist/index.js",
                    "--schema",
                    "/path/to/your/openapi-schema.yaml"
                ]
            }
        }
    }
}

McpServers

{
    "openapi-server": {
        "command": "node",
        "args": [
            "/path/to/your/openapi-mcp-server/dist/index.js",
            "--schema",
            "/path/to/your/openapi-schema.yaml"
        ]
    }
}
This application exposes any REST API as an MCP (Model Context Protocol) server based on its OpenAPI schema. It automatically generates MCP tools from OpenAPI operations with comprehensive OpenAPI 3.0+ support.

Features

- Complete OpenAPI 3.0+ Support: Parse schemas from JSON and YAML formats - Advanced Schema Processing: Full $ref resolution, composition schemas (oneOf, anyOf, allOf) - Rich Tool Generation: Automatic MCP tools with detailed descriptions, validation, and metadata - Multiple Content Types: Support for JSON, XML, form data, and multipart uploads - Parameter Handling: Path, query, header parameters with type conversion and validation - Authentication: HTTP Basic Authentication and custom headers support - Enhanced Error Handling: Detailed error messages with request context - Type Safety: Full TypeScript implementation with comprehensive validation - Testing: Extensive test suite with 90%+ coverage

Installation

``bash npm install npm run build `

Usage

`bash npm start -- --schema <path-to-openapi-schema> [options] `

Options

-
-s, --schema <path> - Path to OpenAPI schema file (JSON or YAML) [Required] - -b, --base-url <url> - Override base URL from schema - -h, --headers <headers> - Additional headers as JSON string - -u, --username <username> - Username for basic authentication - -p, --password <password> - Password for basic authentication

Examples

``bash
No reviews yet — be the first

Sign in to leave a review

Use Google, GitHub, or an email account so ratings stay tied to real people.

Email sign in

No reviews posted yet.