Get the FREE Ultimate OpenClaw Setup Guide →

openapi2mcptools

OpenAPI specifications => MCP (Model Context Protocol) tools

Installation
Run this command in your terminal to add the MCP server to Claude Code.
Run in terminal:
Command
claude mcp add --transport stdio 2013xile-openapi2mcptools node server.js \
  --env MCPSERVER_NAME="openapi2mcptools" \
  --env MCPSERVER_VERSION="1.0.0"

How to use

This MCP server is a utility-based server that exposes tools generated from OpenAPI specifications via the MCP (Model Context Protocol) framework. It leverages the openapi2mcptools converter to produce a list of tools and a tool-calling interface that can be executed through the MCP tooling stack. The server is configured by creating a Server instance, registering two handlers (one to list available tools and another to execute a specific tool), and then connecting via a standard IO transport (StdioServerTransport) or any compatible MCP transport. Clients can query the server for the tools (ListToolsRequestSchema) and invoke a specific tool (CallToolRequestSchema) using the produced toolCaller. This setup enables dynamic tool discovery and execution based on an OpenAPI spec-derived toolset, streamlining MCP server development against OpenAPI definitions.

How to install

Prerequisites:

  • Node.js (LTS recommended)
  • npm or pnpm
  • A working OpenAPI specification to convert (optional at setup time)
  1. Install Node.js from https://nodejs.org/
  2. Create a new project directory and initialize: mkdir mcp-openapi2mcptools && cd mcp-openapi2mcptools npm init -y
  3. Install required packages: npm install @modelcontextprotocol/sdk openapi2mcptools
  4. Add your server file (e.g., server.js) that wires Converter from openapi2mcptools to an MCP Server instance as shown in the README usage example. If you already have a converter setup, ensure you export or instantiate the server according to your MCP environment.
  5. Create a simple run script or use your existing CLI entry point to start the server. For example, you can run: node server.js

Note: If you prefer to run via npx or a packaged CLI, ensure the package exposes a compatible entry point that bootstraps the MCP server similarly to the example in the README.

Additional notes

Tips and considerations:

  • The MCP server is driven by an OpenAPI-to-MCP conversion, so ensure your OpenAPI specs are correctly formatted and accessible to the Converter.
  • The provided example uses StdioServerTransport for local testing; you can substitute other MCP transports as needed (e.g., HTTP, WebSocket) depending on your deployment.
  • Environment variables like MCPSERVER_NAME and MCPSERVER_VERSION help identify the server in multi-server deployments. Add additional environment variables if your implementation requires authentication or API keys.
  • When wiring ListToolsRequestSchema and CallToolRequestSchema, ensure your tool set (tools) is consistent with what Converter.getToolsList() returns and that the CallToolRequestSchema matches the expected call signature of your tools.
  • Keep dependencies up to date to align with updates in @modelcontextprotocol/sdk and openapi2mcptools, as breaking changes could affect request/response shapes.
  • If you run into transport binding issues, verify that the MCP transport implementation is compatible with your Server instance and that connect() is awaited properly before handling requests.

Related MCP Servers

Sponsor this space

Reach thousands of developers