openapi2mcptools
OpenAPI specifications => MCP (Model Context Protocol) tools
Documentation
OPENAPI Specifications => MCP (Model Context Protocol) Tools
- ๐ง An utility library for converting OpenAPI specifications to MCP tools.
- ๐ Faster the development of MCP servers based on OPENAPI specifications.
Usage
import { Server } from '@modelcontextprotocol/sdk/server/index.js';
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
import {
CallToolRequestSchema,
ListToolsRequestSchema,
} from '@modelcontextprotocol/sdk/types.js';
import { Converter } from 'openapi2mcptools';
const converter = new Converter({
baseURL, // optional
httpClient // optional
});
await converter.load({
// specs
});
const tools = converter.getToolsList();
const toolCaller = converter.getToolsCaller();
const server = new Server(
{
name: 'mcp-server-openapi',
version: '1.0.0',
},
{
capabilities: {
tools: {},
},
},
);
// Define available tools
server.setRequestHandler(ListToolsRequestSchema, async () => {
return {
tools,
};
});
// Handle tool execution
server.setRequestHandler(CallToolRequestSchema, async (request) => {
return await toolCaller(request);
});
const transport = new StdioServerTransport();
await server.connect(transport);Custom client
Set `baseURL`, `headers`, etc for http client.
export type RequestConfig = {
url?: string;
method?: string;
headers?: any;
params?: any;
data?: any;
}
export interface HTTPClient {
request: (requestConfig: RequestConfig) => Promise;
}Example:
import axios from axios;
import { Converter } from 'openapi2mcptools';
const converter = new Converter({
httpClient: axios
});Frequently asked questions
What is openapi2mcptools?
openapi2mcptools is OpenAPI specifications => MCP (Model Context Protocol) tools
How do I install openapi2mcptools?
Open the GitHub repository and follow its README. Most MCP servers are added to your client's MCP config, then called by your agent.
Is openapi2mcptools open source?
Yes โ it is hosted on GitHub at https://github.com/2013xile/openapi2mcptools and has 19 stars.
Related MCP tools
MCP Aggregator, Orchestrator, Middleware, Gateway in one docker TypeScript-based implementation. Trusted by 1400+ developers.
A Unified MCP Server Management App TypeScript-based implementation. Trusted by 800+ developers. Trusted by 800+ developers.
AWS MCP Servers โ helping you get the most out of AWS, wherever you use MCP. Python-based implementation. Trusted by 6900+ developers.
AI Agents & MCPs & AI Workflow Automation โข (~400 MCP servers for AI agents) โข AI Automation / AI Agent with MCPs โข AI Workflows & AI Agents โข MCPs for AI Ag...
A powerful VSCode extension that lets you find and install MCP servers to use with GitHub Copilot.. TypeScript-based implementation.
A Minecraft MCP Server powered by Mineflayer API. It allows to control a Minecraft character in real-time, allowing AI assistants to build structures, explor...
Run your own MCP server? See who uses it and what to fix.
Measure it with TrackMCP