Skip to main content
Glama

MCP Gateway

PyPI version Python License

단일 HTTP/SSE 엔드포인트 뒤에서 여러 MCP(Model Context Protocol) 서버를 집계하는 독립형 CLI 게이트웨이로, Code Mode를 통해 여러 MCP 서버를 사용할 때 LLM 입력 토큰 사용량을 최대 92%까지 줄입니다.

기능

  • 다중 서버 집계 — 여러 MCP 서버(HTTP, SSE, Stdio, Streamable HTTP)에 연결하고 단일 엔드포인트로 노출합니다

  • Code Mode — LLM이 모든 스키마를 미리 로드하지 않고도 도구를 동적으로 발견하고 사용할 수 있게 해주는 4개의 메타 도구

  • OAuth 2.0 지원 — 동적 클라이언트 등록(RFC 7591) 및 토큰 저장 기능을 갖춘 내장 OAuth 흐름

  • 격리된 샌드박스 — 안전한 코드 실행을 위한 Starlark 기반 샌드박스

  • MCP 프로토콜 호환 — Claude Desktop, Cursor 및 모든 MCP 호환 클라이언트에서 작동

Related MCP server: ToolMux

설치

pip install mcp-gway

또는 mise 사용:

mise install
uv sync

빠른 시작

# Add an MCP server
mcp-gway add youtube --type http --url http://localhost:3001/mcp

# Add a stdio server
mcp-gway add filesystem --type stdio --command npx --args '["-y", "@anthropic/mcp-filesystem"]'

# Add a server requiring OAuth
mcp-gway add supabase --type streamable-http --url https://mcp.supabase.com/mcp

# List all servers
mcp-gway list

# Start the gateway
mcp-gway serve --port 8080

Claude Desktop에서 연결

Claude Desktop 구성(~/Library/Application Support/Claude/claude_desktop_config.json)에 추가하세요:

{
  "mcpServers": {
    "gateway": {
      "url": "http://localhost:8080/mcp"
    }
  }
}

명령어

명령어

설명

mcp-gway add

MCP 서버를 추가하고 .pyi 스텁 생성

mcp-gway remove

MCP 서버 제거

mcp-gway update

서버의 도구 업데이트

mcp-gway list

연결된 모든 서버 나열

mcp-gway inspect

서버의 도구 시그니처 표시

mcp-gway refresh

연결을 새로 고치고 도구 재발견

mcp-gway serve

게이트웨이 서버 시작

Code Mode

연결되면 게이트웨이는 4개의 메타 도구를 노출합니다:

도구

설명

listToolFiles

사용 가능한 모든 .pyi 스텁 파일 나열

readToolFile

스텁에서 함수 시그니처 읽기

getToolDocs

도구에 대한 자세한 문서 가져오기

executeToolCode

샌드박스 처리된 Starlark 인터프리터에서 코드 실행

OAuth 인증

OAuth가 필요한 서버(예: Supabase)의 경우:

# Trigger OAuth flow
mcp-gway refresh supabase --auth

# Or store token manually
mkdir -p ~/.config/mcp-gway/tokens
echo '{"access_token": "YOUR_TOKEN"}' > ~/.config/mcp-gway/tokens/supabase.json

개발

# Install dependencies
mise install
uv sync

# Run tests
uv run pytest -v

# Lint and format
uv run ruff check src/ tests/
uv run ruff format src/ tests/

아키텍처

┌─────────────────────────────────────────────────────────┐
│                    MCP Gateway                          │
├─────────────────────────────────────────────────────────┤
│  CLI (click)     │  HTTP/SSE Server (Starlette)        │
│  - add           │  - POST /mcp (JSON-RPC)             │
│  - remove        │  - GET /mcp (SSE stream)            │
│  - list          │  - POST /mcp/messages               │
│  - refresh       │                                     │
├─────────────────────────────────────────────────────────┤
│  Code Mode (4 meta-tools)     │  Starlark Sandbox      │
│  - listToolFiles               │  - Hermetic execution  │
│  - readToolFile                │  - Server injection    │
│  - getToolDocs                 │                        │
│  - executeToolCode             │                        │
├─────────────────────────────────────────────────────────┤
│  Registry (.pyi files)        │  OAuth2 (RFC 7591)     │
│  - servers/*.pyi               │  - Dynamic registration│
│  - Tool signatures             │  - Token storage       │
└─────────────────────────────────────────────────────────┘
         │                │                │
    ┌────┴────┐      ┌────┴────┐      ┌────┴────┐
    │ Server1 │      │ Server2 │      │ Server3 │
    │ (HTTP)  │      │ (SSE)   │      │ (Stdio) │
    └─────────┘      └─────────┘      └─────────┘

라이선스

MIT

Maintenance

ActivityNo data
ResponsivenessUnresponsive

Related MCP Connectors

Related MCP Servers

  • A
    license
    Not graded
    quality
    D
    maintenance
    Aggregates multiple MCP servers into a single endpoint, enabling LLM clients to access tools, resources, and prompts from various backends through one connection.
    9 npm
    MIT
  • A
    license
    B
    quality
    C
    maintenance
    Aggregates multiple MCP servers via a single interface with token optimization and multiple operating modes (Gateway, Meta, Proxy, Search, Code).
    7
    8
    MIT
  • A
    license
    Not graded
    quality
    A
    maintenance
    Centralizes management and routing of multiple MCP servers, exposing them to AI clients via HTTP/SSE endpoints with configurable visibility, sharing, and smart routing.
    1,706 npm
    Apache 2.0
  • A
    license
    Not graded
    quality
    B
    maintenance
    Centralized management and routing of multiple MCP servers via unified Streamable HTTP/SSE endpoints, with granular group visibility, smart routing, and authentication.
    1,706 npm
    Apache 2.0