OpenAPI to MCP Server
Includes functionality for forking and customizing the repository on GitHub, with workflow configurations for automatic publishing to npm.
Provides a configured GitHub Actions workflow for automatic building and publishing of customized MCP packages to npm when a tag is pushed.
Enables running the MCP server that transforms OpenAPI specifications into tools accessible to AI assistants, with specific support for Node.js environments including installation via npm.
Enables publishing and distribution of customized MCP server packages through npm, with automatic versioning based on Git tags.
Enables transformation of OpenAPI/Swagger specifications into MCP tools, allowing AI assistants to interact with any API defined in the Swagger format. The README specifically uses the Swagger Petstore example URL (https://petstore3.swagger.io/api/v3/openapi.json) as a demonstration.
Provides integration with Vercel AI SDK, allowing developers to use the MCP server directly in JavaScript/TypeScript applications through Vercel's MCP client.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@OpenAPI to MCP Serverlist all available pets in the pet store"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
OpenAPI to MCP Server
A tool that creates MCP (Model Context Protocol) servers from OpenAPI/Swagger specifications, enabling AI assistants to interact with your APIs. Create your own branded and customized MCPs for specific APIs or services.
Overview
This project creates a dynamic MCP server that transforms OpenAPI specifications into MCP tools. It enables seamless integration of REST APIs with AI assistants via the Model Context Protocol, turning any API into an AI-accessible tool.
Related MCP server: Swagger MCP
Features
Dynamic loading of OpenAPI specs from file or HTTP/HTTPS URLs
Support for OpenAPI Overlays loaded from files or HTTP/HTTPS URLs
Customizable mapping of OpenAPI operations to MCP tools
Advanced filtering of operations using glob patterns for both operationId and URL paths
Comprehensive parameter handling with format preservation and location metadata
API authentication handling
OpenAPI metadata (title, version, description) used to configure the MCP server
Hierarchical description fallbacks (operation description → operation summary → path summary)
Custom HTTP headers support via environment variables and CLI
X-MCP header for API request tracking and identification
Support for custom
x-mcpextensions at the path level to override tool names and descriptions
Using with AI Assistants
This tool creates an MCP server that allows AI assistants to interact with APIs defined by OpenAPI specifications. The primary way to use it is by configuring your AI assistant to run it directly as an MCP tool.
Setting Up in Claude Desktop
Ensure you have Node.js installed on your computer
Open Claude Desktop and navigate to Settings > Developer
Edit the configuration file (or it will be created if it doesn't exist):
macOS:
~/Library/Application Support/Claude/claude_desktop_config.jsonWindows:
%APPDATA%\Claude\claude_desktop_config.json
Add this configuration (customize as needed):
{
"mcpServers": {
"api-tools": {
"command": "npx",
"args": [
"-y",
"@tyk-technologies/api-to-mcp@latest",
"--spec",
"https://petstore3.swagger.io/api/v3/openapi.json"
],
"enabled": true
}
}
}Restart Claude Desktop
You should now see a hammer icon in the chat input box. Click it to access your API tools.
Customizing the Configuration
You can adjust the args array to customize your MCP server with various options:
{
"mcpServers": {
"my-api": {
"command": "npx",
"args": [
"-y",
"@tyk-technologies/api-to-mcp@latest",
"--spec",
"./path/to/your/openapi.json",
"--overlays",
"./path/to/overlay.json,https://example.com/api/overlay.json",
"--whitelist",
"getPet*,POST:/users/*",
"--targetUrl",
"https://api.example.com"
],
"enabled": true
}
}
}Setting Up in Cursor
Create a configuration file in one of these locations:
Project-specific:
.cursor/mcp.jsonin your project directoryGlobal:
~/.cursor/mcp.jsonin your home directory
Add this configuration (adjust as needed for your API):
{
"servers": [
{
"command": "npx",
"args": [
"-y",
"@tyk-technologies/api-to-mcp@latest",
"--spec",
"./path/to/your/openapi.json"
],
"name": "My API Tools"
}
]
}Restart Cursor or reload the window
Using with Vercel AI SDK
You can also use this MCP server directly in your JavaScript/TypeScript applications using the Vercel AI SDK's MCP client:
import { experimental_createMCPClient } from 'ai';
import { Experimental_StdioMCPTransport } from 'ai/mcp-stdio';
import { generateText } from 'ai';
import { createGoogleGenerativeAI } from '@ai-sdk/google';
// Initialize the Google Generative AI provider
const google = createGoogleGenerativeAI({
apiKey: process.env.GOOGLE_API_KEY, // Set your API key in environment variables
});
const model = google('gemini-2.0-flash');
// Create an MCP client with stdio transport
const mcpClient = await experimental_createMCPClient({
transport: {
type: 'stdio',
command: 'npx', // Command to run the MCP server
args: ['-y', '@tyk-technologies/api-to-mcp', '--spec', 'https://petstore3.swagger.io/api/v3/openapi.json'], // OpenAPI spec
env: {
// You can set environment variables here
// API_KEY: process.env.YOUR_API_KEY,
},
},
});
async function main() {
try {
// Retrieve tools from the MCP server
const tools = await mcpClient.tools();
// Generate text using the AI SDK with MCP tools
const { text } = await generateText({
model,
prompt: 'List all available pets in the pet store using the API.',
tools, // Pass the MCP tools to the model
});
console.log('Generated text:', text);
} catch (error) {
console.error('Error:', error);
} finally {
// Always close the MCP client to release resources
await mcpClient.close();
}
}
main();Configuration
Configuration is managed via environment variables, command-line options, or a JSON configuration file:
Command Line Options
# Start with specific OpenAPI spec file
@tyk-technologies/api-to-mcp --spec=./path/to/openapi.json
# Apply overlays to the spec
@tyk-technologies/api-to-mcp --spec=./path/to/openapi.json --overlays=./path/to/overlay.json,https://example.com/api/overlay.json
# Include only specific operations (supports glob patterns)
@tyk-technologies/api-to-mcp --spec=./path/to/openapi.json --whitelist="getPet*,POST:/users/*"
# Specify target API URL
@tyk-technologies/api-to-mcp --spec=./path/to/openapi.json --targetUrl=https://api.example.com
# Add custom headers to all API requests
@tyk-technologies/api-to-mcp --spec=./path/to/openapi.json --headers='{"X-Api-Version":"1.0.0"}'
# Disable the X-MCP header
@tyk-technologies/api-to-mcp --spec=./path/to/openapi.json --disableXMcpEnvironment Variables
You can set these in a .env file or directly in your environment:
OPENAPI_SPEC_PATH: Path to OpenAPI spec fileOPENAPI_OVERLAY_PATHS: Comma-separated paths to overlay JSON filesTARGET_API_BASE_URL: Base URL for API calls (overrides OpenAPI servers)MCP_WHITELIST_OPERATIONS: Comma-separated list of operation IDs or URL paths to include (supports glob patterns likegetPet*orGET:/pets/*)MCP_BLACKLIST_OPERATIONS: Comma-separated list of operation IDs or URL paths to exclude (supports glob patterns, ignored if whitelist used)API_KEY: API Key for the target API (if required)SECURITY_SCHEME_NAME: Name of the security scheme requiring the API KeySECURITY_CREDENTIALS: JSON string containing security credentials for multiple schemesCUSTOM_HEADERS: JSON string containing custom headers to include in all API requestsHEADER_*: Any environment variable starting withHEADER_will be added as a custom header (e.g.,HEADER_X_API_Version=1.0.0adds the headerX-API-Version: 1.0.0)DISABLE_X_MCP: Set totrueto disable adding theX-MCP: 1header to all API requestsCONFIG_FILE: Path to a JSON configuration file
JSON Configuration
You can also use a JSON configuration file instead of environment variables or command-line options. The MCP server will look for configuration files in the following order:
Path specified by
--configcommand-line optionPath specified by
CONFIG_FILEenvironment variableconfig.jsonin the current directoryopenapi-mcp.jsonin the current directory.openapi-mcp.jsonin the current directory
Example JSON configuration file:
{
"spec": "./path/to/openapi-spec.json",
"overlays": "./path/to/overlay1.json,https://example.com/api/overlay.json",
"targetUrl": "https://api.example.com",
"whitelist": "getPets,createPet,/pets/*",
"blacklist": "deletePet,/admin/*",
"apiKey": "your-api-key",
"securitySchemeName": "ApiKeyAuth",
"securityCredentials": {
"ApiKeyAuth": "your-api-key",
"OAuth2": "your-oauth-token"
},
"headers": {
"X-Custom-Header": "custom-value",
"User-Agent": "OpenAPI-MCP-Client/1.0"
},
"disableXMcp": false
}A full example configuration file with explanatory comments is available at config.example.json in the root directory.
Configuration Precedence
Configuration settings are applied in the following order of precedence (highest to lowest):
Command-line options
Environment variables
JSON configuration file
Development
Installation
# Clone the repository
git clone <repository-url>
cd openapi-to-mcp-generator
# Install dependencies
npm install
# Build the project
npm run buildLocal Testing
# Start the MCP server
npm start
# Development mode with auto-reload
npm run devCustomizing and Publishing Your Own Version
You can use this repository as a base for creating your own customized OpenAPI to MCP server. This section explains how to fork the repository, customize it for your specific APIs, and publish it as a package.
Forking and Customizing
Fork the Repository: Fork this repository on GitHub to create your own copy that you can customize.
Add Your OpenAPI Specs:
# Create a specs directory if it doesn't exist mkdir -p specs # Add your OpenAPI specifications cp path/to/your/openapi-spec.json specs/ # Add any overlay files cp path/to/your/overlay.json specs/Configure Default Settings: Create a custom config file that will be bundled with your package:
# Copy the example config cp config.example.json config.json # Edit the config to point to your bundled specs # and set any default settingsUpdate package.json:
{ "name": "your-custom-mcp-server", "version": "1.0.0", "description": "Your customized MCP server for specific APIs", "files": [ "dist/**/*", "config.json", "specs/**/*", "README.md" ] }Ensure Specs are Bundled: The
filesfield in package.json (shown above) ensures your specs and config file will be included in the published package.
Customizing the GitHub Workflow
The repository includes a GitHub Actions workflow for automatic publishing to npm. To customize it for your forked repo:
Update the Workflow Name: Edit
.github/workflows/publish-npm.yamlto update the name if desired:name: Publish My Custom MCP PackageSet Package Scope (if needed): If you want to publish under an npm organization scope, uncomment and modify the scope line in the workflow file:
- name: Setup Node.js uses: actions/setup-node@v4 with: node-version: "18" registry-url: "https://registry.npmjs.org/" # Uncomment and update with your organization scope: scope: "@your-org"Set Up npm Token: Add your npm token as a GitHub secret named
NPM_TOKENin your forked repository's settings.
Publishing Your Customized Package
Once you've customized the repository:
Create and Push a Tag:
# Update version in package.json (optional, the workflow will update it based on the tag) npm version 1.0.0 # Push the tag git push --tagsGitHub Actions will:
Automatically build the package
Update version in package.json to match the tag
Publish to npm with your bundled specs and config
Usage After Publication
Users of your customized package can install and use it with npm:
# Install your customized package
npm install your-custom-mcp-server -g
# Run it
your-custom-mcp-serverThey can override your default settings via environment variables or command line options as described in the Configuration section.
License
MIT
Available Tools
3 toolscreatePetD
| Name | Required | Description | Default |
|---|---|---|---|
| requestBody | Yes | Parameter: requestBody |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
Tool has no description.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
Tool has no description.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Tool has no description.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Tool has no description.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
Tool has no description.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
Tool has no description.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
getPetByIdD
| Name | Required | Description | Default |
|---|---|---|---|
| petId | Yes | Enhanced pet ID description from overlay |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
Tool has no description.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
Tool has no description.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Tool has no description.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Tool has no description.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
Tool has no description.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
Tool has no description.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
listPetsD
| Name | Required | Description | Default |
|---|---|---|---|
| limit | No | How many items to return at one time |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
Tool has no description.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
Tool has no description.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Tool has no description.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Tool has no description.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
Tool has no description.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
Tool has no description.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections. Dates show when Glama detected each change.
3 tool updates
v1.0.0- First observed
createPet - First observed
getPetById - First observed
listPets
TDQS
The three tools have clearly distinct purposes: createPet for creating a pet, getPetById for retrieving a specific pet by ID, and listPets for listing all pets. There is no overlap or ambiguity between these operations, making it easy for an agent to select the correct tool based on the desired action.
All tool names follow a consistent verb_noun pattern: createPet, getPetById, and listPets. The naming is uniform, with no mixing of conventions (e.g., snake_case or camelCase variations), making the set predictable and readable.
With only 3 tools, the server feels thin for a general OpenAPI-to-MCP conversion purpose, which might imply broader functionality. However, for a specific pet-related API subset, this count is minimal but covers basic CRUD operations (create, read, list), though it lacks update and delete tools.
The tool set covers create, get by ID, and list operations, providing a basic CRUD foundation for pets. However, it lacks update and delete tools, which are common in such domains, and there are no tools for other potential resources or advanced operations, indicating notable gaps in coverage.
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Connectors
MCP server for AI access to Swagger by SmartBear.
MCP server that lets AI assistants use all OneSchema features exposed via the public API.
A comprehensive Model Context Protocol (MCP) server that enables AI assistants to interact with yo…
AI-native mock API server with MCP. Create REST/SOAP mocks from Claude, Cursor, or Windsurf.
Related MCP Servers
- AlicenseNot gradedqualityCmaintenanceA Model Context Protocol (MCP) server that converts OpenAPI/Swagger specifications to MCP format, enabling AI assistants to interact with REST APIs through standardized protocol.74TypeScriptMIT
- FlicenseNot gradedqualityDmaintenanceAutomatically converts Swagger/OpenAPI specifications into MCP servers, enabling AI agents to interact with any REST API through natural language by exposing endpoints as AI-friendly tools.3-
- AlicenseNot gradedqualityBmaintenanceConverts any OpenAPI specification into an MCP server, allowing AI assistants to interact with REST APIs through natural language.161MIT
- FlicenseNot gradedqualityDmaintenanceConverts any Swagger/OpenAPI specification into an MCP server, enabling AI assistants to intelligently query API endpoints, schemas, and generate code examples.18-
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/TykTechnologies/api-to-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server