Integrate Any API into MCP Tools
MCP connector that turns any REST API into MCP tools at runtime, with multi-auth support and configurable endpoints.
1.0.0Add to Favorites
Why it matters
Dynamically create MCP-compatible tools from any web API (REST, GraphQL, etc.). Seamlessly integrate external services into your AI assistant's capabilities.
Outcomes
What it gets done
Register and unregister APIs at runtime.
Generate MCP tools for individual API endpoints.
Call any registered API endpoint using a universal tool.
Test API connections and retrieve schema information.
Install
Add it to your toolbox
Run in your project directory:
curl -fsSL https://spark.entire.vc/get/vb-apiweaver | bash Capabilities
Tools your agent gets
Registers a new API and creates tools for its endpoints
Lists all registered APIs and their endpoints
Removes an API and its tools
Tests the connection to a registered API
Universal tool for calling any registered API endpoint
Retrieves schema information for an API and its endpoints
Overview
APIWeaver MCP Server
An MCP connector that dynamically registers any REST API as MCP tools at runtime, supporting multiple auth types and configurable endpoint parameters. Use it when you need Claude to call a REST API that has no existing MCP integration, without writing custom code for it.
What it does
This MCP server dynamically registers any web API - REST, GraphQL, or other HTTP-based service - as a set of MCP tools at runtime, without writing custom integration code. Given a JSON API configuration (base URL, authentication, and a list of endpoints with their HTTP method, path, and parameters), it turns each endpoint into a callable tool for an AI assistant. It supports five authentication types (Bearer token, API key via header or query parameter, Basic auth, and fully custom headers), all HTTP methods, and four parameter locations (query, path, header, body) with typed parameters (string, integer, number, boolean, array, object) including enums and defaults. It offers three transport modes - STDIO for local desktop use, legacy SSE, and the recommended Streamable HTTP for web/cloud deployments - and provides built-in tools to register, list, test, unregister, and call any configured API, plus schema introspection.
When to use - and when NOT to
Use this connector when you need an AI assistant to call a REST API that has no existing MCP integration - registering a new API by its base URL, auth, and endpoint list, testing connectivity before relying on it, calling a generic endpoint through the call_api tool, or exposing a whole family of endpoints (like GitHub's or OpenWeatherMap's) as individually callable tools.
It does not provide GraphQL, WebSocket, or OAuth2-token-refresh support out of the box (these are listed as potential future contributions) - it is built for straightforward REST-style HTTP APIs with standard auth schemes. The upstream repository (GongRzhe/APIWeaver on GitHub) is archived and no longer receiving updates.
Capabilities
- register_api: register a new API by name, base URL, auth config, and endpoint list, generating a tool per endpoint
- list_apis: list all currently registered APIs and their endpoints
- unregister_api: remove a registered API and its generated tools
- test_api_connection: verify connectivity and auth for a registered API before use
- call_api: generically call any registered API endpoint with the appropriate parameters
- get_api_schema: retrieve schema information for a registered API or specific endpoint
How to install
Install the package and register it with Claude Desktop, choosing STDIO for local use or Streamable HTTP for web deployments:
pip install -r requirements.txt
{
"mcpServers": {
"apiweaver": {
"command": "apiweaver",
"args": ["run", "--transport", "streamable-http", "--host", "127.0.0.1", "--port", "8000"]
}
}
}
Once connected, use the register_api tool to define an API with a config like:
{
"name": "github",
"base_url": "https://api.github.com",
"auth": {"type": "bearer", "bearer_token": "ghp_your_token_here"},
"endpoints": [
{"name": "get_user", "method": "GET", "path": "/users/{username}", "params": [{"name": "username", "type": "string", "location": "path", "required": true}]}
]
}
Who it's for
Developers who want to expose an arbitrary REST API to Claude as callable tools without writing a custom MCP server for every API they need to integrate.
Source README
APIWeaver
A FastMCP server that dynamically creates MCP (Model Context Protocol) servers from web API configurations. This allows you to easily integrate any REST API, GraphQL endpoint, or web service into an MCP-compatible tool that can be used by AI assistants like Claude.
Features
- ๐ Dynamic API Registration: Register any web API at runtime
- ๐ Multiple Authentication Methods: Bearer tokens, API keys, Basic auth, OAuth2, and custom headers
- ๐ ๏ธ All HTTP Methods: Support for GET, POST, PUT, DELETE, PATCH, and more
- ๐ Flexible Parameters: Query params, path params, headers, and request bodies
- ๐ Automatic Tool Generation: Each API endpoint becomes an MCP tool
- ๐งช Built-in Testing: Test API connections before using them
- ๐ Response Handling: Automatic JSON parsing with fallback to text
- ๐ Multiple Transport Types: STDIO, SSE, and Streamable HTTP transport support
Transport Types
APIWeaver supports three different transport types to accommodate various deployment scenarios:
STDIO Transport (Default)
- Usage:
apiweaver runorapiweaver run --transport stdio - Best for: Local tools, command-line usage, and MCP clients that connect via standard input/output
- Characteristics: Direct process communication, lowest latency, suitable for desktop applications
- Endpoint: N/A (uses stdin/stdout)
SSE Transport (Legacy)
- Usage:
apiweaver run --transport sse --host 127.0.0.1 --port 8000 - Best for: Legacy MCP clients that only support Server-Sent Events
- Characteristics: HTTP-based, one-way streaming from server to client
- Endpoint:
http://host:port/mcp - Note: This transport is deprecated in favor of Streamable HTTP
Streamable HTTP Transport (Recommended)
- Usage:
apiweaver run --transport streamable-http --host 127.0.0.1 --port 8000 - Best for: Modern web deployments, cloud environments, and new MCP clients
- Characteristics: Full HTTP-based communication, bidirectional streaming, better error handling
- Endpoint:
http://host:port/mcp - Recommended: This is the preferred transport for new deployments
Installation
# Clone or download this repository
cd ~/Desktop/APIWeaver
# Install dependencies
pip install -r requirements.txt
Usage
Claude Desktop
{
"mcpServers": {
"apiweaver": {
"command": "uvx",
"args": ["apiweaver", "run"]
}
}
}
Starting the Server
There are several ways to run the APIWeaver server with different transport types:
1. After installation (recommended):
If you have installed the package (e.g., using pip install . from the project root after installing requirements):
# Default STDIO transport
apiweaver run
# Streamable HTTP transport (recommended for web deployments)
apiweaver run --transport streamable-http --host 127.0.0.1 --port 8000
# SSE transport (legacy compatibility)
apiweaver run --transport sse --host 127.0.0.1 --port 8000
2. Directly from the repository (for development):
# From the root of the repository
python -m apiweaver.cli run [OPTIONS]
Transport Options:
--transport: Choose fromstdio(default),sse, orstreamable-http--host: Host address for HTTP transports (default: 127.0.0.1)--port: Port for HTTP transports (default: 8000)--path: URL path for MCP endpoint (default: /mcp)
Run apiweaver run --help for all available options.
Using with AI Assistants (like Claude Desktop)
APIWeaver is designed to expose web APIs as tools for AI assistants that support the Model Context Protocol (MCP). Here's how to use it:
Start the APIWeaver Server:
For modern MCP clients (recommended):
apiweaver run --transport streamable-http --host 127.0.0.1 --port 8000For legacy compatibility:
apiweaver run --transport sse --host 127.0.0.1 --port 8000For local desktop applications:
apiweaver run # Uses STDIO transportConfigure Your AI Assistant:
The MCP endpoint will be available at:- Streamable HTTP:
http://127.0.0.1:8000/mcp - SSE:
http://127.0.0.1:8000/mcp - STDIO: Direct process communication
- Streamable HTTP:
Register APIs and Use Tools:
Once connected, use the built-inregister_apitool to define web APIs, then use the generated endpoint tools.
Core Tools
The server provides these built-in tools:
- register_api - Register a new API and create tools for its endpoints
- list_apis - List all registered APIs and their endpoints
- unregister_api - Remove an API and its tools
- test_api_connection - Test connectivity to a registered API
- call_api - Generic tool to call any registered API endpoint
- get_api_schema - Get schema information for APIs and endpoints
API Configuration Format
{
"name": "my_api",
"base_url": "https://api.example.com",
"description": "Example API integration",
"auth": {
"type": "bearer",
"bearer_token": "your-token-here"
},
"headers": {
"Accept": "application/json"
},
"endpoints": [
{
"name": "list_users",
"description": "Get all users",
"method": "GET",
"path": "/users",
"params": [
{
"name": "limit",
"type": "integer",
"location": "query",
"required": false,
"default": 10,
"description": "Number of users to return"
}
]
}
]
}
Examples
Example 1: OpenWeatherMap API
{
"name": "weather",
"base_url": "https://api.openweathermap.org/data/2.5",
"description": "OpenWeatherMap API",
"auth": {
"type": "api_key",
"api_key": "your-api-key",
"api_key_param": "appid"
},
"endpoints": [
{
"name": "get_current_weather",
"description": "Get current weather for a city",
"method": "GET",
"path": "/weather",
"params": [
{
"name": "q",
"type": "string",
"location": "query",
"required": true,
"description": "City name"
},
{
"name": "units",
"type": "string",
"location": "query",
"required": false,
"default": "metric",
"enum": ["metric", "imperial", "kelvin"]
}
]
}
]
}
Example 2: GitHub API
{
"name": "github",
"base_url": "https://api.github.com",
"description": "GitHub REST API",
"auth": {
"type": "bearer",
"bearer_token": "ghp_your_token_here"
},
"headers": {
"Accept": "application/vnd.github.v3+json"
},
"endpoints": [
{
"name": "get_user",
"description": "Get a GitHub user's information",
"method": "GET",
"path": "/users/{username}",
"params": [
{
"name": "username",
"type": "string",
"location": "path",
"required": true,
"description": "GitHub username"
}
]
}
]
}
Authentication Types
Bearer Token
{
"auth": {
"type": "bearer",
"bearer_token": "your-token-here"
}
}
API Key (Header)
{
"auth": {
"type": "api_key",
"api_key": "your-key-here",
"api_key_header": "X-API-Key"
}
}
API Key (Query Parameter)
{
"auth": {
"type": "api_key",
"api_key": "your-key-here",
"api_key_param": "api_key"
}
}
Basic Authentication
{
"auth": {
"type": "basic",
"username": "your-username",
"password": "your-password"
}
}
Custom Headers
{
"auth": {
"type": "custom",
"custom_headers": {
"X-Custom-Auth": "custom-value",
"X-Client-ID": "client-123"
}
}
}
Parameter Locations
- query: Query string parameters (
?param=value) - path: Path parameters (
/users/{id}) - header: HTTP headers
- body: Request body (for POST, PUT, PATCH)
Parameter Types
- string: Text values
- integer: Whole numbers
- number: Decimal numbers
- boolean: true/false
- array: Lists of values
- object: JSON objects
Advanced Features
Custom Timeouts
{
"timeout": 60.0 // Timeout in seconds
}
Enum Values
{
"name": "status",
"type": "string",
"enum": ["active", "inactive", "pending"]
}
Default Values
{
"name": "page",
"type": "integer",
"default": 1
}
Claude Desktop Configuration
For Streamable HTTP Transport (Recommended)
{
"mcpServers": {
"apiweaver": {
"command": "apiweaver",
"args": ["run", "--transport", "streamable-http", "--host", "127.0.0.1", "--port", "8000"]
}
}
}
For STDIO Transport (Traditional)
{
"mcpServers": {
"apiweaver": {
"command": "apiweaver",
"args": ["run"]
}
}
}
Error Handling
The server provides detailed error messages for:
- Missing required parameters
- HTTP errors (with status codes)
- Connection failures
- Authentication errors
- Invalid configurations
Tips
- Choose the Right Transport: Use
streamable-httpfor modern deployments,stdiofor local tools - Test First: Always use
test_api_connectionafter registering an API - Start Simple: Begin with GET endpoints before moving to complex POST requests
- Check Auth: Ensure your authentication credentials are correct
- Use Descriptions: Provide clear descriptions for better AI understanding
- Handle Errors: The server will report HTTP errors with details
Troubleshooting
Common Issues
- 401 Unauthorized: Check your authentication credentials
- 404 Not Found: Verify the base URL and endpoint paths
- Timeout Errors: Increase the timeout value for slow APIs
- SSL Errors: Some APIs may require specific SSL configurations
Debug Mode
Run with verbose logging (if installed):
apiweaver run --verbose
Transport-Specific Issues
- STDIO: Ensure the client properly handles stdin/stdout communication
- SSE: Check that the HTTP endpoint is accessible and CORS is configured
- Streamable HTTP: Verify the MCP endpoint responds to HTTP requests
FAQ
Common questions
Discussion
Questions & comments ยท 0
Sign In Sign in to leave a comment.