APIWeaver

APIWeaver

gongrzhe

Converts any REST API into MCP tools that AI assistants can use by registering API configurations at runtime. Supports multiple authentication methods and automatically generates callable tools from API endpoints.

Dynamically converts any REST API into MCP tools by registering web API configurations at runtime. Supports multiple authentication methods and automatically generates MCP-compatible tools for AI assistants to interact with external web services.

48116 views14Local (stdio)

What it does

  • Register REST APIs dynamically at runtime
  • Generate MCP tools from API endpoints automatically
  • Authenticate with Bearer tokens, API keys, Basic auth, and OAuth2
  • Call registered API endpoints with dynamic parameters
  • Test API connections before use
  • Get API schemas and endpoint documentation

Best for

AI assistant developers integrating external APIsRapidly prototyping API integrations without custom codeCreating MCP-compatible tools from existing web services
Dynamic registration at runtimeMultiple transport types (STDIO, SSE, HTTP)No hardcoded API configurations needed

About APIWeaver

APIWeaver is a community-built MCP server published by gongrzhe that provides AI assistants with tools and capabilities via the Model Context Protocol. APIWeaver converts any REST API into MCP tools at runtime, supporting multiple auth methods and auto-generating MCP-comp It is categorized under developer tools. This server exposes 6 tools that AI clients can invoke during conversations and coding sessions.

How to install

You can install APIWeaver in your AI client of choice. Use the install panel on this page to get one-click setup for Cursor, Claude Desktop, VS Code, and other MCP-compatible clients. This server runs locally on your machine via the stdio transport.

License

APIWeaver is released under the MIT license. This is a permissive open-source license, meaning you can freely use, modify, and distribute the software.

Tools (6)

register_api

Register a new API configuration and create MCP tools for its endpoints. Args: config: API configuration dictionary containing: - name: API name - base_url: Base URL for the API - description: Optional API description - auth: Optional authentication configuration - headers: Optional global headers - endpoints: List of endpoint configurations Returns: Success message with list of created tools

list_apis

List all registered APIs and their endpoints. Returns: Dictionary of registered APIs with their configurations

unregister_api

Unregister an API and remove its tools. Args: api_name: Name of the API to unregister Returns: Success message

test_api_connection

Test connection to a registered API. Args: api_name: Name of the API to test Returns: Connection test results

call_api

Call any registered API endpoint with dynamic parameters. This is a generic tool that allows calling any registered API endpoint without having to use the specific endpoint tools. Useful for ad-hoc API calls or when you want more flexibility. Args: api_name: Name of the registered API to call endpoint_name: Name of the endpoint within the API parameters: Dictionary of parameters to pass to the endpoint ctx: Optional context for logging Returns: API response data and metadata Example: # Call OpenWeatherMap API result = await call_api( api_name="OpenWeatherMap", endpoint_name="get_weather", parameters={"q": "London", "units": "metric"} ) # Call GitHub API result = await call_api( api_name="GitHub", endpoint_name="get_user", parameters={"username": "octocat"} )

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 run or apiweaver 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 from stdio (default), sse, or streamable-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:

  1. Start the APIWeaver Server:

    For modern MCP clients (recommended):

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

    For legacy compatibility:

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

    For local desktop applications:

    apiweaver run  # Uses STDIO transport
    
  2. 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
  3. Register APIs and Use Tools: Once connected, use the built-in register_api tool to define web APIs, then use the generated endpoint tools.

Core Tools

The server provides these built-in tools:

  1. register_api - Register a new API and create tools for its endpoints
  2. list_apis - List all registered APIs and their endpoints
  3. unregister_api - Remove an API and its tools
  4. test_api_connection - Test connectivity to a registered API
  5. call_api - Generic tool to call any registered API endpoint
  6. 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

  1. Choose the Right Transport: Use streamable-http for modern deployments, stdio for local tools
  2. Test First: Always use test_api_connection after registering an API
  3. Start Simple: Begin with GET endpoints before moving to complex POST requests
  4. Check Auth: Ensure your authentication credentials are correct
  5. Use Descriptions: Provide clear descriptions for better AI understanding
  6. Handle Errors: The server will report HTTP errors with details

Troubleshooting

Common Issues

  1. 401 Unauthorized: Check your authentication credentials
  2. 404 Not Found: Verify the base URL and endpoint paths
  3. Timeout Errors: Increase the timeout value for slow APIs
  4. SSL Errors: Some APIs may require specific SSL configurations

Debug Mode

Run with ver


README truncated. View full README on GitHub.

Alternatives

Related Skills

Browse all skills
ui-design-system

UI design system toolkit for Senior UI Designer including design token generation, component documentation, responsive design calculations, and developer handoff tools. Use for creating design systems, maintaining visual consistency, and facilitating design-dev collaboration.

18
ai-sdk

Answer questions about the AI SDK and help build AI-powered features. Use when developers: (1) Ask about AI SDK functions like generateText, streamText, ToolLoopAgent, embed, or tools, (2) Want to build AI agents, chatbots, RAG systems, or text generation features, (3) Have questions about AI providers (OpenAI, Anthropic, Google, etc.), streaming, tool calling, structured output, or embeddings, (4) Use React hooks like useChat or useCompletion. Triggers on: "AI SDK", "Vercel AI SDK", "generateText", "streamText", "add AI to my app", "build an agent", "tool calling", "structured output", "useChat".

6
api-documenter

Master API documentation with OpenAPI 3.1, AI-powered tools, and modern developer experience practices. Create interactive docs, generate SDKs, and build comprehensive developer portals. Use PROACTIVELY for API documentation or developer portal creation.

4
openai-knowledge

Use when working with the OpenAI API (Responses API) or OpenAI platform features (tools, streaming, Realtime API, auth, models, rate limits, MCP) and you need authoritative, up-to-date documentation (schemas, examples, limits, edge cases). Prefer the OpenAI Developer Documentation MCP server tools when available; otherwise guide the user to enable `openaiDeveloperDocs`.

4
cli-builder

Guide for building TypeScript CLIs with Bun. Use when creating command-line tools, adding subcommands to existing CLIs, or building developer tooling. Covers argument parsing, subcommand patterns, output formatting, and distribution.

3
ydc-ai-sdk-integration

Integrate Vercel AI SDK applications with You.com tools (web search, AI agent, content extraction). Use when developer mentions AI SDK, Vercel AI SDK, generateText, streamText, or You.com integration with AI SDK.

2