Any API MCP Server
Dynamically converts any API with an OpenAPI v3 specification into MCP tools for AI assistants. It supports multiple authentication methods including OAuth2, Bearer tokens, and API keys for flexible integration.
README
ANY API MCP Server
An MCP (Model Context Protocol) server designed to interact with any API that exposes an OpenAPI v3 specification. The server dynamically parses the OpenAPI spec and exposes the API endpoints as tools usable by AI assistants.
Features
- Compatible with any API: Just provide your API's OpenAPI spec file.
- Multiple authentication methods: Supports the most common auth systems.
- Flexible configuration: Via JSON file or environment variables.
- Dynamic tool generation: Automatically converts endpoints into MCP tools.
Architecture
The project is built using the following technologies and patterns:
- Node.js & TypeScript: The runtime environment and base language.
- Model Context Protocol (MCP) SDK: Uses
@modelcontextprotocol/sdkto implement the MCP server overstdio. - Modular Authentication System: Adapter-based architecture supporting multiple authentication types.
- Dynamic Tool Generation: Reads the OpenAPI file and converts each operation into an MCP Tool.
Prerequisites
- Node.js (v16 or higher)
- The API to expose must be network accessible.
- Your API's OpenAPI spec file (JSON or YAML).
Installation and Build
-
Install dependencies:
npm install -
Compile the TypeScript code:
npm run build
Configuration
Configuration can be done in two ways:
Option 1: Configuration file (Recommended)
Create a config.json file in the project root:
{
"apiUrl": "https://api.example.com",
"openApiSpecPath": "./open-api.json",
"serverName": "my-api-mcp",
"serverVersion": "1.0.0",
"auth": {
"type": "bearer-endpoint",
"endpoint": "/auth/token",
"method": "POST",
"body": {
"key": "${API_KEY}",
"secret": "${API_SECRET}"
},
"tokenPath": "token"
}
}
See
config.example.jsonfor more configuration examples.
Option 2: Environment variables
Create a .env file in the project root:
API_URL=http://localhost:8080/api
AUTH_TYPE=bearer-endpoint
AUTH_ENDPOINT=/auth/token
AUTH_TOKEN_PATH=token
API_KEY=your_api_key
API_SECRET=your_api_secret
Supported Authentication Types
1. No Authentication (none)
{
"auth": {
"type": "none"
}
}
2. HTTP Basic Auth (basic)
{
"auth": {
"type": "basic",
"username": "myuser",
"password": "mypassword"
}
}
3. API Key (api-key)
Supports sending via header, query param, or cookie:
{
"auth": {
"type": "api-key",
"keyName": "X-API-Key",
"keyValue": "your-api-key",
"location": "header",
"prefix": ""
}
}
4. Static Bearer Token (bearer-token)
For tokens that don't expire or are managed externally:
{
"auth": {
"type": "bearer-token",
"token": "your-static-bearer-token"
}
}
5. Bearer Token from Endpoint (bearer-endpoint)
Obtains the token from an authentication endpoint:
{
"auth": {
"type": "bearer-endpoint",
"endpoint": "/auth/token",
"method": "POST",
"body": {
"key": "${API_KEY}",
"secret": "${API_SECRET}"
},
"tokenPath": "token",
"expiresIn": 3600
}
}
Note: Use
${VAR_NAME}to reference environment variables in the body.
6. OAuth2 Client Credentials (oauth2-client-credentials)
{
"auth": {
"type": "oauth2-client-credentials",
"tokenUrl": "https://auth.example.com/oauth/token",
"clientId": "your-client-id",
"clientSecret": "your-client-secret",
"scopes": ["read", "write"],
"credentialsInBody": false
}
}
Environment Variables
| Variable | Description |
|---|---|
CONFIG_PATH |
Path to configuration file |
API_URL |
API base URL |
OPENAPI_SPEC_PATH |
Path to OpenAPI spec file |
SERVER_NAME |
MCP server name |
AUTH_TYPE |
Authentication type |
API_KEY |
API Key (for bearer-endpoint) |
API_SECRET |
API Secret (for bearer-endpoint) |
Usage in MCP Clients
To use this server in tools like Claude Desktop or VS Code extensions that support MCP:
{
"mcpServers": {
"any-api": {
"command": "node",
"args": ["/absolute/path/to/any-api-mcp/build/index.js"]
}
}
}
Make sure to replace /absolute/path/to/any-api-mcp/ with the actual path where you cloned this repository.
Extending the Authentication System
To add a new authentication type:
- Create a new adapter in
src/auth/adapters/that extendsBaseAuthAdapter - Add the new type to
AuthTypeinsrc/auth/types.ts - Create the corresponding configuration interface
- Register the adapter in
AuthFactory.createAdapter()insrc/auth/factory.ts
Development
To make changes to the server:
- Modify the code in
src/. - Recompile with
npm run build. - Restart your MCP client to reload the changes.
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.
Neon Database
MCP server for interacting with Neon Management API and databases
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
E2B
Using MCP to run code via e2b.