Skip to main content
{
  "success": true,
  "data": ["amap", "playwright", "slack"]
}

OpenAPI Generation for OpenWebUI Integration

MCPHub now supports generating OpenAPI 3.0.3 specifications from MCP tools, enabling seamless integration with OpenWebUI and other OpenAPI-compatible systems without requiring MCPO as an intermediary proxy.

Features

  • Automatic OpenAPI Generation: Converts MCP tools to OpenAPI 3.0.3 specification
  • OpenWebUI Compatible: Direct integration without MCPO proxy
  • Real-time Tool Discovery: Dynamically includes tools from connected MCP servers
  • Dual Parameter Support: Supports both GET (query params) and POST (JSON body) for tool execution
  • No Authentication Required: OpenAPI endpoints are public for easy integration
  • Comprehensive Metadata: Full OpenAPI specification with proper schemas and documentation

API Endpoints

OpenAPI Specification

curl "http://localhost:3000/api/openapi.json"
Generates and returns the complete OpenAPI 3.0.3 specification for all connected MCP tools. Query Parameters:
title
string
Custom API title
description
string
Custom API description
version
string
Custom API version
serverUrl
string
Custom server URL
includeDisabled
boolean
default:"false"
Include disabled tools
servers
string
Comma-separated list of server names to include

Available Servers

curl "http://localhost:3000/api/openapi/servers"
Returns a list of connected MCP server names.
{
  "success": true,
  "data": ["amap", "playwright", "slack"]
}

Tool Statistics

curl "http://localhost:3000/api/openapi/stats"
Returns statistics about available tools and servers.
{
  "success": true,
  "data": {
    "totalServers": 3,
    "totalTools": 41,
    "serverBreakdown": [
      {"name": "amap", "toolCount": 12, "status": "connected"},
      {"name": "playwright", "toolCount": 21, "status": "connected"},
      {"name": "slack", "toolCount": 8, "status": "connected"}
    ]
  }
}

Tool Execution

curl "http://localhost:3000/api/tools/amap/amap-maps_weather?city=Beijing"
Execute MCP tools via OpenAPI-compatible endpoints. Path Parameters:
serverName
string
required
The name of the MCP server
toolName
string
required
The name of the tool to execute

OpenWebUI Integration

To integrate MCPHub with OpenWebUI:
1

Start MCPHub

Ensure MCPHub is running with your MCP servers configured
2

Get OpenAPI Specification

curl http://localhost:3000/api/openapi.json > mcphub-api.json
3

Add to OpenWebUI

Import the OpenAPI specification file or point to the URL directly in OpenWebUI

Configuration Example

In OpenWebUI, you can add MCPHub as an OpenAPI tool by using:

OpenAPI URL

http://localhost:3000/api/openapi.json

Base URL

http://localhost:3000/api

Generated OpenAPI Structure

The generated OpenAPI specification includes:

Tool Conversion Logic

  • Simple tools (≤10 primitive parameters) → GET endpoints with query parameters
  • Complex tools (objects, arrays, or >10 parameters) → POST endpoints with JSON request body
  • All tools include comprehensive response schemas and error handling

Example Generated Operation

/tools/amap/amap-maps_weather:
  get:
    summary: "根据城市名称或者标准adcode查询指定城市的天气"
    operationId: "amap_amap-maps_weather"
    tags: ["amap"]
    parameters:
      - name: city
        in: query
        required: true
        description: "城市名称或者adcode"
        schema:
          type: string
    responses:
      '200':
        description: "Successful tool execution"
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ToolResponse'

Security

  • Bearer authentication is defined but not enforced for tool execution endpoints
  • Enables flexible integration with various OpenAPI-compatible systems

Benefits over MCPO

Direct Integration

No need for intermediate proxy

Real-time Updates

OpenAPI spec updates automatically as MCP servers connect/disconnect

Better Performance

Direct tool execution without proxy overhead

Simplified Architecture

One less component to manage

Troubleshooting

Ensure MCP servers are connected. Check /api/openapi/stats for server status.
Verify the tool name and parameters match the OpenAPI specification. Check server logs for details.
Ensure MCPHub is accessible from OpenWebUI and the OpenAPI URL is correct.
Check if tools are enabled in your MCP server configuration. Use includeDisabled=true to see all tools.
I