Overview of the overall architecture of MCP Gateway system, including the gateway itself, management backend, supporting APIs, storage mechanisms, and integration methods with external services.

Architecture Diagram

The architecture diagram is being updated and will provide detailed system architecture diagrams in future versions.

Core Modules

MCP Gateway (mcp-gateway)

MCP Gateway is the core component of the system, responsible for handling all MCP protocol requests:

Request Processing

  • Unified Entry: /* listens to all HTTP requests
  • Route Distribution: Dynamic request distribution based on route prefix

Protocol Conversion

  • Protocol Parsing: Parse JSON-RPC format requests
  • Tool Distribution: Parse tool names and construct call parameters

Main Functions

1

Request Routing

Request distribution based on route prefix and suffix (/sse, /message, /mcp)

2

Protocol Parsing

Parse JSON-RPC format to extract methods and parameters

3

Service Invocation

Invoke external services and parse results

4

Configuration Reading

Dynamically load and apply configuration information

Management Backend (web)

Provides a visual management interface with the following core modules:

Management Backend Service (apiserver)

Provides complete backend API services:

API Services

  • Configuration management API
  • User interface management
  • Chat history queries

Configuration Management

  • Configuration write storage
  • Hot update notifications
  • Permission control

Storage System

Configuration Storage

Stores all MCP services, tools, routing and other configuration information:

Disk Storage

YAML file format, suitable for development environments

SQLite

Lightweight database, suitable for single-machine deployment

PostgreSQL/MySQL

Enterprise-grade database, suitable for production environments

Web Data Storage

Stores user data, session records, etc.:

  • User account information
  • Chat session history
  • System configuration data
  • Operation log records

External Service Integration

MCP Gateway is designed for seamless integration with existing business systems:

Data Flow

1

Request Reception

MCP Client sends requests to specified endpoints of MCP Gateway

2

Protocol Parsing

Gateway parses MCP protocol format and extracts tool invocation information

3

Configuration Lookup

Look up corresponding configuration information based on tool name

4

Service Invocation

Call backend services using configured templates and parameters

5

Response Processing

Process backend service responses and convert to MCP protocol format

6

Result Return

Return processing results to MCP Client

Deployment Architecture

Single Machine Deployment

All-in-One Deployment

All services run on the same machine, suitable for development and testing environments

Distributed Deployment

Microservice Architecture

Each component is deployed independently, supporting horizontal scaling and load balancing

Containerized Deployment

Use Docker and Kubernetes for containerized deployment

Extensibility Design

MCP Gateway adopts a modular design and supports the following extensions:

  • Protocol Extensions: Support for new MCP protocol versions
  • Storage Extensions: Support for new storage backends
  • Authentication Extensions: Support for multiple authentication mechanisms
  • Monitoring Extensions: Integration with various monitoring and logging systems

To deeply understand the specific implementation of each component, please refer to the corresponding configuration documentation and development guides.