Content
# mcp-gateway
> **Projet 06 — Suite ModelContextProtocol**
> Niveau : Avancé
Patterns avancés de production MCP : **authentification**, **permissions par tool**, et **composition de plusieurs serveurs MCP** en un seul point d'entrée.
Reprend les serveurs des projets 02, 03 et 04 et les compose dans un **MCP Gateway** HTTP/SSE.
## Architecture
Client (Claude)
│ HTTP/SSE
▼
mcp-gateway ←── auth (API key / JWT)
│ └── permissions par tool
├──► mcp-filesystem (stdio upstream)
├──► mcp-database (stdio upstream)
└──► mcp-rest-proxy (stdio upstream)
## Fonctionnalités
### Authentification
- **API Key** : header `X-Api-Key` — simple et rapide
- **JWT** : header `Authorization: Bearer <token>` — claims avec rôle
### Permissions par tool
| Rôle | Tools autorisés |
|------|----------------|
| `readonly` | `read_*`, `list_*`, `get_*`, `query`, `explain_*` |
| `readwrite` | Tous sauf admin |
| `admin` | Tous les tools |
### Composition (routing)
Le gateway maintient un pool de processus upstream et route chaque `tools/call` vers le bon serveur selon un registre statique.
### Observabilité
- Tracing structuré avec `tracing` + `tracing-subscriber`
- Chaque appel tool : durée, résultat, user ID
## Transport : HTTP/SSE
Ce projet passe du transport `stdio` (dev) au transport **HTTP/SSE** (production) :
POST /mcp ← JSON-RPC requests
GET /mcp/events ← SSE stream pour les réponses asynchrones
## Stack
- **SDK** : `rmcp`
- **HTTP** : `axum` (même stack que la suite WebDev)
- **Auth** : `jsonwebtoken`
- **Tracing** : `tracing` + `tracing-subscriber`
- **Config** : `.env` — `JWT_SECRET`, `ALLOWED_API_KEYS`, ports upstream
## Prérequis
Les 3 serveurs upstream doivent être compilés :
- `mcp-filesystem` binary
- `mcp-database` binary (+ PostgreSQL)
- `mcp-rest-proxy` binary (+ `api-rest-axum`)
---
*Suite ModelContextProtocol — [FCHEHIDI](https://github.com/FCHEHIDI)*
Connection Info
You Might Also Like
everything-claude-code
Complete Claude Code configuration collection - agents, skills, hooks,...
markitdown
MarkItDown-MCP is a lightweight server for converting URIs to Markdown.
cc-switch
All-in-One Assistant for Claude Code, Codex & Gemini CLI across platforms.
servers
Model Context Protocol Servers
servers
Model Context Protocol Servers
Time
A Model Context Protocol server for time and timezone conversions.