Skip to content

Commit 820379b

Browse files
committed
Update mcpgateway.wrapper docs
Signed-off-by: Mihai Criveti <[email protected]>
1 parent 9e9be3d commit 820379b

File tree

9 files changed

+542
-313
lines changed

9 files changed

+542
-313
lines changed

.github/ISSUE_TEMPLATE/bug-report-code.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ Select the area of the project impacted:
1717

1818
- [ ] `mcpgateway` - API
1919
- [ ] `mcpgateway` - UI (admin panel)
20-
- [ ] `mcpgateway-wrapper` - stdio wrapper
20+
- [ ] `mcpgateway.wrapper` - stdio wrapper
2121
- [ ] Federation or Transports
2222
- [ ] CLI, Makefiles, or shell scripts
2323
- [ ] Container setup (Docker/Podman/Compose)

DEVELOPING.md

Lines changed: 44 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,58 @@
1-
## Development Testing with MCP Inspector
1+
# Development Quick-Start
22

3-
```
3+
## 🧪 Development Testing with **MCP Inspector**
4+
5+
```bash
6+
# Gateway & auth
47
export MCP_GATEWAY_BASE_URL=http://localhost:4444
58
export MCP_SERVER_CATALOG_URLS=http://localhost:4444/servers/1
6-
export MCP_AUTH_TOKEN="your_bearer_token"
9+
export MCP_AUTH_TOKEN="<your_bearer_token>"
10+
```
711

12+
| Mode | Command | Notes |
13+
| ----------------------------------------------------------- | ---------------------------------------------------------------------------- | ----------------------------------------------------------------------------- |
14+
| **SSE (direct)** | `npx @modelcontextprotocol/inspector` | Connects straight to the Gateway's SSE endpoint. |
15+
| **Stdio wrapper** <br/>*(for clients that can't speak SSE)* | `npx @modelcontextprotocol/inspector python -m mcpgateway.wrapper` | Spins up the wrapper **in-process** and points Inspector to its stdio stream. |
16+
| **Stdio wrapper via uv / uvenv** | `npx @modelcontextprotocol/inspector uvenv run python -m mcpgateway.wrapper` | Uses the lightning-fast `uv` virtual-env if installed. |
817

9-
npx @modelcontextprotocol/inspector # SSE
10-
npx @modelcontextprotocol/inspector uv --directory "/home/cmihai/mcpgateway-wrapper" run mcpgateway-wrapper # wrapper
11-
```
18+
🔍 MCP Inspector boots at **[http://localhost:5173](http://localhost:5173)** – open it in a browser and add:
1219

13-
🔍 MCP Inspector is up and running at http://localhost:5173 🚀
20+
```text
21+
Server URL: http://localhost:4444/servers/1/sse
22+
Headers: Authorization: Bearer <your_bearer_token>
23+
```
1424

25+
---
1526

16-
## SuperGateway
27+
## 🌉 SuperGateway (stdio-in ⇢ SSE-out bridge)
1728

18-
Supergateway runs a MCP stdio-based servers over SSE (Server-Sent Events) with one command. This is useful for remote access, debugging, or connecting to SSE-based clients when your MCP server only speaks stdio.
29+
SuperGateway lets you expose *any* MCP **stdio** server over **SSE** with a single command – perfect for
30+
remote debugging or for clients that only understand SSE.
1931

20-
`npx -y supergateway --stdio "uvx run mcp-server-git"``
21-
or
22-
```
32+
```bash
33+
# Using uvx (ships with uv)
34+
npx -y supergateway --stdio "uvx run mcp-server-git"
35+
# OR: using uvenv (pip-based)
2336
pip install uvenv
2437
npx -y supergateway --stdio "uvenv run mcp-server-git"
2538
```
2639

27-
SSE endpoint: GET http://localhost:8000/sse
28-
POST messages: POST http://localhost:8000/message
40+
| Endpoint | Method | URL |
41+
| ------------------------ | ------ | -------------------------------------------------------------- |
42+
| **SSE stream** | `GET` | [http://localhost:8000/sse](http://localhost:8000/sse) |
43+
| **Message back-channel** | `POST` | [http://localhost:8000/message](http://localhost:8000/message) |
44+
45+
Combine this with the Gateway:
46+
47+
```bash
48+
# Register the SuperGateway SSE endpoint as a peer
49+
curl -X POST -H "Authorization: Bearer $MCPGATEWAY_BEARER_TOKEN" \
50+
-H "Content-Type: application/json" \
51+
-d '{"name":"local-supergateway","url":"http://localhost:8000/sse"}' \
52+
http://localhost:4444/gateways
53+
```
54+
55+
The tools hosted by **`mcp-server-git`** are now available in the Gateway catalog, and therefore
56+
also visible through `mcpgateway.wrapper` or any other MCP client.
57+
58+
```

README.md

Lines changed: 25 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ docker run --rm -i \
206206
python3 -m mcpgateway.wrapper
207207
```
208208

209-
**Testing `mcpgateway-wrapper` by hand:**
209+
**Testing `mcpgateway.wrapper` by hand:**
210210

211211
Because the wrapper speaks JSON-RPC over stdin/stdout, you can interact with it using nothing more than a terminal or pipes.
212212

@@ -221,7 +221,8 @@ export MCP_SERVER_CATALOG_URLS=http://localhost:4444/servers/1
221221
python3 -m mcpgateway.wrapper
222222
```
223223

224-
**Initialize the protocol:**
224+
<details>
225+
<summary><strong>Initialize the protocol</strong></summary>
225226

226227
```json
227228
# Initialize the protocol
@@ -243,7 +244,10 @@ python3 -m mcpgateway.wrapper
243244
{"jsonrpc":"2.0","id":3,"method":"tools/call","params":{"name":"get_current_time","arguments":{"timezone":"Europe/Dublin"}}}
244245
```
245246

246-
Expected:
247+
</details>
248+
249+
<details>
250+
<summary><strong>Expected responses from mcpgateway.wrapper</strong></summary>
247251

248252
```json
249253
{"jsonrpc":"2.0","id":1,"result":{"protocolVersion":"2025-03-26","capabilities":{"experimental":{},"prompts":{"listChanged":false},"resources":{"subscribe":false,"listChanged":false},"tools":{"listChanged":false}},"serverInfo":{"name":"mcpgateway-wrapper","version":"0.1.0"}}}
@@ -256,9 +260,9 @@ Expected:
256260

257261
# Running the time tool:
258262
{"jsonrpc":"2.0","id":3,"result":{"content":[{"type":"text","text":"{'content': [{'type': 'text', 'text': '{\\n \"timezone\": \"Europe/Dublin\",\\n \"datetime\": \"2025-06-08T21:47:07+01:00\",\\n \"is_dst\": true\\n}'}], 'is_error': False}"}],"isError":false}}
259-
260263
```
261264

265+
</details>
262266

263267
### 🧩 Running from an MCP Client (`mcpgateway.wrapper`)
264268

@@ -341,7 +345,7 @@ pipx install uv
341345
uv venv ~/.venv/mcpgateway
342346
source ~/.venv/mcpgateway/bin/activate
343347

344-
# Install the gateway package very quickly
348+
# Install the gateway package very quicmcpkly
345349
uv pip install mcp-contextforge-gateway
346350

347351
# Launch wrapper
@@ -552,7 +556,10 @@ A `make compose-up` target is provided along with a [docker-compose.yml](docker-
552556

553557
> ⚠️ If any required `.env` variable is missing or invalid, the gateway will fail fast at startup with a validation error via Pydantic.
554558

555-
You can get started by copying the provided `.env.examples` to `.env` and making the necessary edits to fit your environment.
559+
You can get started by copying the provided [.env.examples](.env.example) to `.env` and making the necessary edits to fit your environment.
560+
561+
<details>
562+
<summary><strong>🔧 Environment Configuration Variables</strong></summary>
556563

557564
### Basic
558565

@@ -710,6 +717,8 @@ You can get started by copying the provided `.env.examples` to `.env` and making
710717
| `RELOAD` | Auto-reload on changes | `false` | bool |
711718
| `DEBUG` | Debug logging | `false` | bool |
712719

720+
</details>
721+
713722
---
714723

715724
## Running
@@ -1174,6 +1183,9 @@ make lint # Run lint tools
11741183

11751184
## Project Structure
11761185

1186+
<details>
1187+
<summary><strong>📁 Directory and file structure for mcpgateway</strong></summary>
1188+
11771189
```bash
11781190
# ────────── CI / Quality & Meta-files ──────────
11791191
├── .bumpversion.cfg # Automated semantic-version bumps
@@ -1346,6 +1358,8 @@ make lint # Run lint tools
13461358
│ └── unit/… # Pure unit tests for business logic
13471359
```
13481360

1361+
</details>
1362+
13491363
---
13501364

13511365
## API Documentation
@@ -1358,7 +1372,10 @@ make lint # Run lint tools
13581372

13591373
## Makefile targets
13601374

1361-
This project offer the following Makefile targets. Type `make` in the project root to show all targets:
1375+
This project offer the following Makefile targets. Type `make` in the project root to show all targets.
1376+
1377+
<details>
1378+
<summary><strong>🔧 Available Makefile targets</strong></summary>
13621379

13631380
```bash
13641381
🐍 MCP CONTEXT FORGE (An enterprise-ready Model Context Protocol Gateway)
@@ -1540,6 +1557,7 @@ devpi-clean - Full cycle: build → upload → install locally
15401557
devpi-status - Show devpi server status
15411558
devpi-web - Open devpi web interface
15421559
```
1560+
</details>
15431561
15441562
## Contributing
15451563
Lines changed: 79 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,71 +1,107 @@
1-
# Claude Desktop
1+
# Claude Desktop × MCP Gateway
22

3-
[Claude Desktop](https://www.anthropic.com/index/claude-desktop) is a desktop application that supports MCP integration via stdio. You can configure it to launch `mcpgateway-wrapper`, enabling Claude to access all tools registered in MCP Gateway.
3+
[Claude Desktop](https://www.anthropic.com/index/claude-desktop) can launch a local **stdio**
4+
process for every chat "backend".
5+
By pointing it at **`mcpgateway.wrapper`** you give Claude instant access to every tool,
6+
prompt and resource registered in your Gateway.
47

58
---
69

7-
## 🖥️ Where to Configure
10+
## 📂 Where to edit the config
811

9-
Depending on your OS, edit the Claude configuration file:
10-
11-
- **macOS**:
12-
`~/Library/Application Support/Claude/claude_desktop_config.json`
13-
14-
- **Windows**:
15-
`%APPDATA%/Claude/claude_desktop_config.json`
12+
| OS | Path |
13+
|----|------|
14+
| **macOS** | `~/Library/Application Support/Claude/claude_desktop_config.json` |
15+
| **Windows** | `%APPDATA%\Claude\claude_desktop_config.json` |
16+
| **Linux (Flatpak / AppImage)** | `$HOME/.config/Claude/claude_desktop_config.json` |
1617

1718
---
1819

19-
## ⚙️ Example Configuration
20-
21-
Add this block to the `"mcpServers"` section of your config:
22-
23-
```json
24-
"mcpServers": {
25-
"mcpgateway-wrapper": {
26-
"command": "uv",
27-
"args": [
28-
"--directory",
29-
"/path/to/mcpgateway-wrapper",
30-
"run",
31-
"mcpgateway-wrapper"
32-
],
33-
"env": {
34-
"MCP_GATEWAY_BASE_URL": "http://localhost:4444",
35-
"MCP_SERVER_CATALOG_URLS": "http://localhost:4444/servers/2",
36-
"MCP_AUTH_TOKEN": "your_bearer_token"
20+
## ⚙️ Minimal JSON block
21+
22+
```jsonc
23+
{
24+
"mcpServers": {
25+
"mcpgateway-wrapper": {
26+
"command": "python3",
27+
"args": ["-m", "mcpgateway.wrapper"],
28+
"env": {
29+
"MCP_SERVER_CATALOG_URLS": "http://localhost:4444/servers/1",
30+
"MCP_AUTH_TOKEN": "<YOUR_JWT_TOKEN>",
31+
"MCP_TOOL_CALL_TIMEOUT": "120"
32+
}
3733
}
3834
}
3935
}
4036
```
4137

42-
> 🔁 Adjust `path/to/mcpgateway-wrapper` and server ID as needed.
38+
> *Use the real server ID instead of `1` and paste your bearer token.*
4339
4440
---
4541

46-
## 🧪 Test it in Claude
47-
48-
Once Claude launches:
42+
### 🐳 Docker alternative
43+
44+
```jsonc
45+
{
46+
"command": "docker",
47+
"args": [
48+
"run", "--rm", "--network=host", "-i",
49+
"-e", "MCP_SERVER_CATALOG_URLS=http://localhost:4444/servers/1",
50+
"-e", "MCP_AUTH_TOKEN=<YOUR_JWT_TOKEN>",
51+
"ghcr.io/ibm/mcp-context-forge:latest",
52+
"python3", "-m", "mcpgateway.wrapper"
53+
]
54+
}
55+
```
4956

50-
1. Choose the `mcpgateway-wrapper` backend
51-
2. Type a tool invocation (e.g., `weather`, `hello`, etc.)
52-
3. The tool should be fetched from the Gateway and executed dynamically
57+
*(Mac / Windows users should replace `localhost` with `host.docker.internal`.)*
5358

5459
---
5560

56-
## 🚀 Advanced: Pre-installed Wrapper Mode
61+
### ⚡ pipx / uvx one-liner (wrapper already installed)
5762

58-
If you've published the wrapper to PyPI or have it globally installed:
63+
If you installed the package globally:
5964

60-
```json
61-
"mcpServers": {
62-
"mcpgateway-wrapper": {
63-
"command": "uvx",
64-
"args": ["mcpgateway-wrapper"]
65+
```jsonc
66+
{
67+
"command": "pipx",
68+
"args": ["run", "python3", "-m", "mcpgateway.wrapper"],
69+
"env": {
70+
"MCP_SERVER_CATALOG_URLS": "http://localhost:4444/servers/1",
71+
"MCP_AUTH_TOKEN": "<YOUR_JWT_TOKEN>"
6572
}
6673
}
6774
```
6875

69-
This assumes your environment variables are managed globally or set in the terminal session launching Claude.
76+
---
77+
78+
## 🧪 Smoke-test inside Claude
79+
80+
1. **Restart** Claude Desktop (quit from system-tray).
81+
2. Select **"mcpgateway-wrapper"** in the chat dropdown.
82+
3. Type:
83+
84+
```
85+
#get_current_time { "timezone": "Europe/Dublin" }
86+
```
87+
4. The wrapper should proxy the call → Gateway → tool → chat reply.
88+
89+
If tools don't appear, open *File ▸ Settings ▸ Developer ▸ View Logs* to see wrapper output.
90+
91+
---
92+
93+
## 🔑 Environment variables recap
94+
95+
| Var | Purpose |
96+
| ------------------------- | ------------------------------------------------- |
97+
| `MCP_SERVER_CATALOG_URLS` | One or more `/servers/{id}` endpoints (comma-sep) |
98+
| `MCP_AUTH_TOKEN` | JWT bearer for Gateway auth |
99+
| `MCP_TOOL_CALL_TIMEOUT` | Per-tool timeout (seconds, optional) |
100+
| `MCP_WRAPPER_LOG_LEVEL` | `DEBUG`, `INFO`, `OFF` (optional) |
101+
102+
You can place them:
103+
104+
* under `"env"` in the **mcpServers** block (preferred)
105+
* in your user/environment shell before launching Claude.
70106

71107
---

0 commit comments

Comments
 (0)