Get the FREE Ultimate OpenClaw Setup Guide →

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.

Installation
Run this command in your terminal to add the MCP server to Claude Code.
Run in terminal:
Command
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:

  1. Install the MCP server globally via npm:
npm install -g anyapi-mcp-server
  1. Prepare your OpenAPI or Postman spec and base URL. Place the spec locally or point to a remote URL in your MCP config.
  2. 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"
      }
    }
  }
}
  1. If using a remote spec, ensure the environment can access it and that caching is allowed as per the server’s docs.
  2. 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

Sponsor this space

Reach thousands of developers