anyapi
A universal MCP server that connects any REST API to AI assistants (Claude, Cursor, etc.) via OpenAPI or Postman specs. Features GraphQL-style field selection, automatic schema inference, mutation support, and smart query suggestions.
claude mcp add --transport stdio quiloos39-anyapi-mcp-server npx -y anyapi-mcp-server --name your-api --spec path/to/openapi.json --base-url https://api.example.com --header Authorization: Bearer ${API_KEY} \
--env API_KEY="your-api-key"How to use
anyapi-mcp-server is a universal MCP server that exposes every endpoint of a REST API described by an OpenAPI spec or Postman collection. Once configured, you can connect it to your MCP client (such as Claude Desktop or Cursor) so AI assistants can discover, understand, and query the API without writing custom integration code. Use list_api to browse available endpoints, call_api to inspect an endpoint and infer its GraphQL schema, and query_api to fetch data with a GraphQL-like query while benefiting from automatic field selection and data caching. If the API requires OAuth, you can enable the auth tool to manage token exchange and refreshing. The server supports remote specs, schema inference, and smart suggestions for constructing queries, making it suitable for integrating any REST API into your AI workflows.
How to install
Prerequisites:
- Node.js and npm installed on your system
- Git (optional, for cloning or contributing)
Installation steps:
- Install the MCP server globally via npm:
npm install -g anyapi-mcp-server
- Prepare your OpenAPI or Postman spec and base URL. Place the spec locally or point to a remote URL in your MCP config.
- Run the server in your MCP client configuration. For example, add the following to your MCP config under mcpServers (adjust paths and credentials as needed):
{
"mcpServers": {
"your-api": {
"command": "npx",
"args": [
"-y",
"anyapi-mcp-server",
"--name", "your-api",
"--spec", "path/to/openapi.json",
"--base-url", "https://api.example.com",
"--header", "Authorization: Bearer ${API_KEY}"
],
"env": {
"API_KEY": "your-api-key"
}
}
}
}
- If using a remote spec, ensure the environment can access it and that caching is allowed as per the server’s docs.
- Restart your MCP client after adding the configuration so the new server is available to your AI tools.
Additional notes
Tips and common considerations:
- If your API uses OAuth, enable the auth tool flags and provide the required OAuth credentials (client ID, client secret, token URL).
- The server caches remote specs to ~/.cache/anyapi-mcp/ for performance and offline access.
- Use list_api to browse endpoints and call_api to inspect endpoint schemas before building GraphQL queries with query_api.
- You can pass environment variables in the mcp config to keep secrets out of the command line; reference them like ${ENV_VAR} in headers or URLs.
- The tooling supports GraphQL-style field selection, which means you can request only the fields you need to reduce payload size and improve latency.
- For security, avoid exposing your API keys in logs or in shared configurations; prefer environment-based secrets management where possible.
Related MCP Servers
iterm
A Model Context Protocol server that executes commands in the current iTerm session - useful for REPL and CLI assistance
mcp
Octopus Deploy Official MCP Server
furi
CLI & API for MCP management
editor
MCP Server for Phaser Editor
DoorDash
MCP server from JordanDalton/DoorDash-MCP-Server
mcp
MCP сервер для автоматического создания и развертывания приложений в Timeweb Cloud