APIWeaver

by gongrzhe

Not rated
GitHub

About

A universal bridge to convert any web API into an MCP server, supporting multiple transport types.

Details

Author
gongrzhe
Categories
Developer Tools, API, Automation

Setup

Install APIWeaver in your MCP client (Claude Desktop, Cursor, Windsurf, and others).

Repository: https://github.com/gongrzhe/APIWeaver

Follow the installation instructions in the repository README, then restart your MCP client.

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.

- πŸš€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

APIWeaver supports three different transport types to accommodate various deployment scenarios:

- 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)

- 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

- 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

# Clone or download this repository cd ~/Desktop/APIWeaver # Install dependencies pip install -r requirements.txt
{ "mcpServers": { "apiweaver": { "command": "uvx", "args": ["apiweaver", "run"] } } }

There are several ways to run the APIWeaver server with different transport types:

If you have installed the package (e.g., usingpip 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: 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)

Runapiweaver run --helpfor 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:

apiweaver run --transport streamable-http --host 127.0.0.1 --port 8000
apiweaver run --transport sse --host 127.0.0.1 --port 8000

Configure 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

Register APIs and Use Tools:Once connected, use the built-inregister_apitool to define web APIs, then use the generated endpoint 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

{ "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" } ] } ] }
{ "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"] } ] } ] }
{ "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" } ] } ] }
{ "auth": { "type": "bearer", "bearer_token": "your-token-here" } }
{ "auth": { "type": "api_key", "api_key": "your-key-here", "api_key_header": "X-API-Key" } }
{ "auth": { "type": "api_key", "api_key": "your-key-here", "api_key_param": "api_key" } }
{ "auth": { "type": "basic", "username": "your-username", "password": "your-password" } }
{ "auth": { "type": "custom", "custom_headers": { "X-Custom-Auth": "custom-value", "X-Client-ID": "client-123" } } }

- query: Query string parameters (?param=value)
- path: Path parameters (/users/{id})
- header: HTTP headers
- body: Request body (for POST, PUT, PATCH)

- string: Text values
- integer: Whole numbers
- number: Decimal numbers
- boolean: true/false
- array: Lists of values
- object: JSON objects

{ "timeout": 60.0 // Timeout in seconds }
{ "name": "status", "type": "string", "enum": ["active", "inactive", "pending"] }
{ "name": "page", "type": "integer", "default": 1 }

For Streamable HTTP Transport (Recommended)

{ "mcpServers": { "apiweaver": { "command": "apiweaver", "args": ["run", "--transport", "streamable-http", "--host", "127.0.0.1", "--port", "8000"] } } }
{ "mcpServers": { "apiweaver": { "command": "apiweaver", "args": ["run"] } } }

The server provides detailed error messages for:

- Missing required parameters
- HTTP errors (with status codes)
- Connection failures
- Authentication errors
- Invalid configurations
- Choose the Right Transport: Usestreamable-httpfor modern deployments,stdiofor local tools
- Test First: Always usetest_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
- 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

Run with verbose logging (if installed):

- 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

Feel free to extend this server with additional features:

- OAuth2 token refresh
- GraphQL support
- WebSocket endpoints
- Response caching
- Rate limiting
- Request retries

MIT License - feel free to use and modify as needed.

This is a web browser that enables your coding agent, such as Claude Code, to visit websites on your behalf and assist you in identifying bugs or creating UI test cases.

The MCP server for Bitrix24 provides AI assistants with structured access to the Bitrix24 API. It delivers up-to-date method descriptions, parameters, and valid values, allowing assistants to work with precise data instead of guesswork. This reduces code errors and accelerates Bitrix24 integration development.

One remote MCP server for 500+ production APIs β€” Stripe, HubSpot, Postgres, Gmail, and more. OAuth and API key auth, credential management, and a CLI.

Single tool to control all 100+ API integrations, and UI components

Agent-native developer Q&A API with MCP + A2A endpoints for citations, job pickup, and answer submission.

Self-hosted MCP gateway: convert REST/SOAP/GraphQL/SQL APIs into MCP tools with 29 pre-built adapters, OAuth2, RBAC and audit log.

Dynamically creates MCP servers from web API configurations, integrating any REST API, GraphQL endpoint, or web service into MCP-compatible tools.

Hosted MCP server and coordination layer for AI coding agents β€” live API contracts, database schema, frontend/backend mismatch detection, and shared handoff tickets for Claude Code, Cursor, Codex, and Lovable.

An MCP server that dynamically loads tools from an external JSON file configured via an environment variable.

A lightweight server exposing Axone's capabilities through the Model-Context Protocol.

A universal framework for easily creating and deploying Model Context Protocol servers with any tools.

No reviews yet β€” be the first

Sign in to leave a review

Use Google, GitHub, or an email account so ratings stay tied to real people.

Email sign in

No reviews posted yet.