rest-to -adapter
A Python library for converting REST API specifications into MCP (Model Context Protocol) tools for AI agents.
claude mcp add --transport stdio pawneetdev-rest-to-mcp-adapter python -m rest_to_mcp_adapter \ --env REST_TO_MCP_ADAPTER_LOG_LEVEL="Logging level (e.g., INFO, DEBUG)" \ --env REST_TO_MCP_ADAPTER_API_TIMEOUT="Default API request timeout in seconds"
How to use
This MCP server provides a Python-based adapter that converts REST API specifications into MCP tools for AI agents. It ingests formats such as OpenAPI 3.x, Swagger 2.x, and OpenAPI Actions, normalizes endpoints, and generates MCP-compatible tool definitions that can be discovered and executed via the MCP protocol (JSON-RPC 2.0 over stdio). You can run the server to expose a tool registry that agents can list and call through the tools/list and tools/call endpoints, enabling agents to perform authenticated requests to the underlying REST APIs with built-in error handling and retry logic. The adapter supports built-in authentication handlers, automatic parameter filtering (hiding auth params from tool schemas), and a hybrid approach that blends defaults with auto-detection and overrides for precise control.
How to install
Prerequisites:
- Python 3.11+ installed on your system
- pip (comes with Python)
- Git (optional, for cloning the repository)
Step-by-step installation:
# Install the package from PyPI (stable release)
pip install rest-to-mcp-adapter
# Or install the latest beta features
pip install --pre rest-to-mcp-adapter
# Install a specific beta version
pip install rest-to-mcp-adapter==0.2.0b1
From source (for development):
git clone https://github.com/pawneetdev/rest-to-mcp-adapter.git
cd rest-to-mcp-adapter
pip install -e .
Dependencies installed automatically include:
- pydantic>=2.0.0
- pyyaml>=6.0
- requests>=2.31.0
- optional: langchain-community>=0.0.20 (if you need enhanced OpenAPI validation via extras: pip install rest-to-mcp-adapter[langchain])
Additional notes
Tips and considerations:
- The tool naming enforces a 64-character limit with truncation logic; plan endpoint/tool names accordingly.
- Auth handling is built-in; sensitive auth parameters are automatically hidden from tool schemas unless explicitly overridden.
- The MCP server exposes discovery at tools/list and supports execution via tools/call; you can integrate with Claude, GPT, or other agents that support MCP.
- When loading specifications, the library auto-detects input type (URL, file path, or raw content) and supports multiple formats (OpenAPI 3.x, Swagger 2.x, OpenAPI Actions).
- If you encounter timeouts or rate limits against target APIs, adjust REST_TO_MCP_ADAPTER_API_TIMEOUT and implement custom retry behavior as needed.
- For development, consider enabling verbose logging to diagnose issues with spec parsing or tool generation.
Related MCP Servers
MCP-Bridge
A middleware to provide an openAI compatible endpoint that can call MCP tools
mcp -odoo
A Model Context Protocol (MCP) server that enables AI assistants to securely interact with Odoo ERP systems through standardized resources and tools for data retrieval and manipulation.
mcp-rquest
A MCP server providing realistic browser-like HTTP request capabilities with accurate TLS/JA3/JA4 fingerprints for bypassing anti-bot measures. It also supports converting PDF and HTML documents to Markdown for easier processing by LLMs.
pfsense
pfSense MCP Server enables security administrators to manage their pfSense firewalls using natural language through AI assistants like Claude Desktop. Simply ask "Show me blocked IPs" or "Run a PCI compliance check" instead of navigating complex interfaces. Supports REST/XML-RPC/SSH connections, and includes built-in complian
gtm
An MCP server for Google Tag Manager. Connect it to your LLM, authenticate once, and start managing GTM through natural language.
Skolverket
MCP server for Swedish National Agency for Education (Skolverket) open data. Tuned for LLMs to query, parse, and integrate info, data, and stats from three public API endpoints.