How to Convert a REST API to an MCP Server
Step-by-step guide to converting any REST API into an MCP-compatible server using AnythingMCP. No coding required.
What is the Model Context Protocol (MCP)?
The Model Context Protocol (MCP) is an open standard that allows AI agents like Claude, ChatGPT, and others to interact with external tools and data sources in a structured way. MCP defines how AI models can discover, understand, and use tools.
Why Convert REST APIs to MCP?
Most business applications expose REST APIs. By converting these into MCP servers, you enable AI agents to:
- Read and write data from your internal systems
- Execute business workflows through natural language
- Access real-time information from databases and services
Step-by-Step Guide
Step 1: Deploy AnythingMCP
Clone the repository and start the application with Docker Compose:
git clone https://github.com/HelpCode-ai/anythingmcp.git
cd anythingmcp && docker compose up -d
This starts PostgreSQL, the backend API (port 4000), and the dashboard (port 3000).
Step 2: Create a REST Connector
Open the AnythingMCP dashboard at http://localhost:3000 and create a new REST connector. You can import your API definition from multiple sources:
- OpenAPI/Swagger — Upload or paste your OpenAPI spec URL
- Postman Collection — Import directly from a Postman JSON export
- cURL commands — Paste cURL commands and AnythingMCP will parse them into endpoints
Step 3: Configure Authentication
In the connector settings, configure authentication for your API. AnythingMCP supports Bearer tokens, API keys, Basic auth, and OAuth2. Environment variables can be used for secrets.
Step 4: Review and Customize Tools
AnythingMCP auto-generates MCP tools from your API endpoints. In the dashboard, you can review each tool, customize names and descriptions, and choose which endpoints to expose or hide.
Step 5: Test Tools in the Dashboard
Use the built-in tool testing interface to call each tool directly from the dashboard and verify the responses before connecting an AI agent.
Step 6: Connect to AI Agents
Configure your MCP client (Claude Desktop, Cursor, Windsurf, or any MCP-compatible agent) to connect to your AnythingMCP server:
{
"mcpServers": {
"my-api": {
"url": "http://localhost:4000/mcp"
}
}
}
Best Practices
- Start with read-only endpoints — Expose GET endpoints first, then add write operations
- Use meaningful names — Customize tool names in the dashboard for clarity
- Add descriptions — Help AI agents understand what each tool does
- Rate limiting — Configure rate limits to protect your API
Next Steps
- SOAP to MCP Guide — Convert SOAP services
- Database to MCP Guide — Connect databases directly