Skip to content

cc-yuxi/mcp-gateway

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MCP Gateway

A centralized MCP server that acts as a proxy for REST microservices, built with FastMCP and SQLite.

Hierarchy & Discovery Logic

The gateway follows a strict discovery hierarchy to guide the LLM:

  1. Agent Identification: Call list_agents to find an agent matching the user's intent.
  2. Skill Discovery: Call list_skills(agent_ids) to find high-level business logic (prompts).
  3. Global Fallback: If no agent matches, calling list_skills([]) returns standalone skills.
  4. Tool Selection: Use get_details to read the skill's prompt and identify required tools.
  5. Atomic Fallback: If no skills are relevant, calling list_tools([]) exposes all atomic REST endpoints.
  6. Proxy Execution: All actions are performed via execute(name, params).

Quick Start

# Install dependencies
pip install -e .

# Run the MCP server (stdio transport)
python -m mcp_gateway.main

# Run with admin API enabled (port 8080)
python -m mcp_gateway.main --admin

# Use MCP Inspector for interactive testing
npx @modelcontextprotocol/inspector --config src/mcp_gateway/mcp.json --server mcp-gateway

Architecture

LLM ──► FastMCP Server (5 tools) ──► SQLite DB ──► REST Microservices
                                                      (via proxy executor)
Developer ──► FastAPI Admin (/apis, /skills, /agents) ──► SQLite DB

MCP Tools

Tool Purpose
list_agents() Scope check — find the right agent for the job
list_skills(agent_ids) Find skills belonging to agents (or all if filtered list is empty)
list_tools(skills) Find tools in skills (empty = all tools)
get_details(name, type) Full config for a skill or tool
execute(name, params) Proxy executor (httpx)

Admin REST API

The Admin API runs on port 8080 (by default) when started with the --admin flag. Interactive documentation is available at http://localhost:8080/docs.

Area Endpoints Operations
APIs /apis, /apis/{name} Register (OpenAPI), List, Re-sync, Delete
Skills /skills, /skills/{name} Create, List, Update (prompt/tools), Delete
Agents /agents, /agents/{id} Create, List, Get, Update, Delete
Tools /tools, /tools/{name} List recorded tools, Get schema, Delete

About

Enterprise AI Capability Gateway running as an MCP (Model Context Protocol) Server. Its purpose is to expose internal REST APIs to Large Language Models (LLMs) in a controlled, hierarchical manner.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages