MCP-Gateway
MCP-Gateway is a service that provides MCP Server unified management capabilities, helping AI Agents quickly connect to various data sources. Through MCP Server, AI Agents can easily access databases, REST APIs, and other external services without worrying about specific connection details.
adcwa
README
MCP-Gateway
MCP-Gateway is a service that provides MCP Server unified management capabilities, helping AI Agents quickly connect to various data sources. Through MCP Server, AI Agents can easily access databases, REST APIs, and other external services without worrying about specific connection details.
Features
- HTTP interface management: Support for exporting OpenAPI structures, converting HTTP to MCP Server YAML format, and versioning of interfaces.
- Convert curl commands to HTTP interfaces: Easily transform curl commands into properly formatted HTTP interfaces.
- Import/Export OpenAPI: Convert between HTTP interfaces and OpenAPI specifications for easy integration with existing API frameworks.
- MCP Server management: Support for managing MCP Server metadata, selecting multiple HTTP structures to update metadata, publishing MCP Servers (compiling to WebAssembly for dynamic loading), and version control.
- Routing management: Support for route configuration, such as matching
xxx/mcp-server/{name}
to MCP Server with name{name}
.
Architecture
MCP-Gateway consists of three core modules:
- HTTP Interface Management: Defines and manages API configurations.
- MCP Server Management: Manages MCP Server instances, compiles them to WebAssembly, and handles runtime execution.
- Routing Management: Manages routing rules for MCP Servers.
Getting Started
Prerequisites
- Go 1.19 or higher
- Git
Installation
-
Clone the repository:
git clone https://github.com/wangfeng/mcp-gateway2.git cd mcp-gateway2
-
Install dependencies:
go mod tidy
-
Run the server:
go run cmd/server/main.go
-
The server will start on port 8080 by default. You can customize the port by setting the
PORT
environment variable.
Testing
To test the API, run the test client:
go run test/client.go
This will:
- List available HTTP interfaces
- Create an MCP Server using one of the interfaces
- Compile the MCP Server to WebAssembly
- Activate the MCP Server
- Invoke a tool on the MCP Server
To test the curl conversion feature, run the curl test client:
go run test/curl/curl_client.go
This will:
- Convert several curl commands to HTTP interfaces
- Create an MCP Server using the converted interfaces
- Compile and activate the MCP Server
- Invoke a tool from the MCP Server
To test the OpenAPI conversion feature, run the OpenAPI test client:
go run test/openapi/openapi_client.go
This will:
- Export an existing HTTP interface to OpenAPI format
- Import a sample OpenAPI specification to create new HTTP interfaces
- Perform a round-trip conversion (export to OpenAPI and import back)
API Documentation
HTTP Interfaces
GET /api/http-interfaces
: List all HTTP interfacesGET /api/http-interfaces/:id
: Get a specific HTTP interfacePOST /api/http-interfaces
: Create a new HTTP interfacePUT /api/http-interfaces/:id
: Update an HTTP interfaceDELETE /api/http-interfaces/:id
: Delete an HTTP interfaceGET /api/http-interfaces/:id/versions
: Get all versions of an HTTP interfaceGET /api/http-interfaces/:id/versions/:version
: Get a specific version of an HTTP interfaceGET /api/http-interfaces/:id/openapi
: Export an HTTP interface to OpenAPI formatPOST /api/http-interfaces/from-curl
: Create a new HTTP interface from a curl commandPOST /api/http-interfaces/from-openapi
: Create new HTTP interfaces from an OpenAPI specification
MCP Servers
GET /api/mcp-servers
: List all MCP ServersGET /api/mcp-servers/:id
: Get a specific MCP ServerPOST /api/mcp-servers
: Create a new MCP Server from HTTP interfacesPUT /api/mcp-servers/:id
: Update an MCP ServerDELETE /api/mcp-servers/:id
: Delete an MCP ServerGET /api/mcp-servers/:id/versions
: Get all versions of an MCP ServerGET /api/mcp-servers/:id/versions/:version
: Get a specific version of an MCP ServerPOST /api/mcp-servers/:id/compile
: Compile an MCP Server to WebAssemblyPOST /api/mcp-servers/:id/activate
: Activate an MCP ServerPOST /api/mcp-servers/:id/tools/:tool
: Invoke a tool in an MCP Server
Curl to HTTP Interface Conversion
The system supports converting curl commands to HTTP interfaces. Simply send a POST request to /api/http-interfaces/from-curl
with the following JSON body:
{
"command": "curl -H \"Content-Type: application/json\" https://api.example.com/resource",
"name": "example-api",
"description": "Example API endpoint"
}
The system will parse the curl command and create a properly formatted HTTP interface that can be used to create MCP Servers.
OpenAPI Conversion
Export to OpenAPI
You can export any HTTP interface to OpenAPI format by sending a GET request to /api/http-interfaces/:id/openapi
. The response will be a properly formatted OpenAPI 3.0.0 specification that can be used with other OpenAPI tools.
Import from OpenAPI
You can create new HTTP interfaces from an OpenAPI specification by sending a POST request to /api/http-interfaces/from-openapi
with the following JSON body:
go run test/openapi/openapi_client.go
{
"name": "my-api",
"description": "My API description",
"spec": {
"openapi": "3.0.0",
"info": {
"title": "Sample API",
"description": "A sample API",
"version": "1.0.0"
},
"paths": {
"/users": {
"get": {
"summary": "Get all users",
"responses": {
"200": {
"description": "A list of users"
}
}
}
}
}
}
}
The system will parse the OpenAPI specification and create HTTP interfaces for each path/operation combination.
License
MIT
References
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.
MCP Package Docs Server
Facilitates LLMs to efficiently access and fetch structured documentation for packages in Go, Python, and NPM, enhancing software development with multi-language support and performance optimization.
Claude Code MCP
An implementation of Claude Code as a Model Context Protocol server that enables using Claude's software engineering capabilities (code generation, editing, reviewing, and file operations) through the standardized MCP interface.
@kazuph/mcp-taskmanager
Model Context Protocol server for Task Management. This allows Claude Desktop (or any MCP client) to manage and execute tasks in a queue-based system.
Linear MCP Server
Enables interaction with Linear's API for managing issues, teams, and projects programmatically through the Model Context Protocol.
mermaid-mcp-server
A Model Context Protocol (MCP) server that converts Mermaid diagrams to PNG images.
Jira-Context-MCP
MCP server to provide Jira Tickets information to AI coding agents like Cursor

Linear MCP Server
A Model Context Protocol server that integrates with Linear's issue tracking system, allowing LLMs to create, update, search, and comment on Linear issues through natural language interactions.

Sequential Thinking MCP Server
This server facilitates structured problem-solving by breaking down complex issues into sequential steps, supporting revisions, and enabling multiple solution paths through full MCP integration.