Automatically Convert APIs to MCP Tools with mcp-server-openapi
The author built an open-source Go CLI called mcp-server-openapi that automatically converts OpenAPI specifications into MCP tools, allowing AI assistants to easily integrate with existing APIs.
Why it matters
mcp-server-openapi streamlines the integration of existing APIs with AI assistants, making it easier for developers to leverage external data and functionality.
Key Points
- 1mcp-server-openapi parses OpenAPI specs, filters operations, generates JSON schemas, and serves tools via stdio or HTTP
- 2It eliminates the need to manually build custom MCP servers for each API integration
- 3Only endpoints tagged with 'mcp' in the OpenAPI spec are exposed as MCP tools
- 4The tool executes HTTP requests and maps responses when an MCP client calls a tool
Details
The author found that connecting Large Language Models (LLMs) to existing APIs was overly complex, requiring custom MCP server development from scratch for each integration. To solve this problem, they built mcp-server-openapi, an open-source Go CLI that automatically converts OpenAPI specifications into MCP tools. The tool parses the OpenAPI spec, filters operations, generates JSON schemas for the tool inputs, and serves the tools via stdio or HTTP using the mcp-go SDK. When an MCP client calls a tool, mcp-server-openapi executes the corresponding HTTP request and maps the response back to the client. This eliminates the need to manually wire up the API integration, as the OpenAPI spec already contains all the necessary information to generate the MCP tools.
No comments yet
Be the first to comment