Skip to content

Commit 9f3830d

Browse files
committed
Documentation review, update mcpgateway-wrapper to use token
Signed-off-by: Mihai Criveti <[email protected]>
1 parent 80f3afb commit 9f3830d

File tree

7 files changed

+111
-22
lines changed

7 files changed

+111
-22
lines changed

DEVELOPING.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@
33
```
44
export MCP_GATEWAY_BASE_URL=http://localhost:4444
55
export MCP_SERVER_CATALOG_URLS=http://localhost:4444/servers/1
6-
export MCP_AUTH_USER=admin
7-
export MCP_AUTH_PASS=changeme
6+
export MCP_AUTH_TOKEN="your_bearer_token"
87
98
109
npx @modelcontextprotocol/inspector # SSE

README.md

Lines changed: 104 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -56,25 +56,73 @@ MCP Gateway is [published on PyPi](https://pypi.org/project/mcp-contextforge-gat
5656

5757
```bash
5858
# Create a virtual environment and activate it
59+
mkdir mcpgateway && cd mcpgateway # directory to store Python venv and mcp.db
5960
python3 -m venv .venv
6061
. ./.venv/bin/activate
6162

6263
# Install mcp-contextforge-gateway
6364
pip install mcp-contextforge-gateway
6465

65-
# Run mcpgateway with default options, listening on port 4444
66+
# Run mcpgateway with default options, listening on port 4444 with admin:changeme
6667
mcpgateway
6768

68-
# Optional: configure env, and login with admin:password at http://127.0.0.1:9999/admin
69-
BASIC_AUTH_PASSWORD=password mcpgateway --host 127.0.0.1 --port 9999
69+
# Optional: run in background with configured password/key - login at http://127.0.0.1:4444/admin
70+
BASIC_AUTH_PASSWORD=password JWT_SECRET_KEY=my-test-key mcpgateway --host 127.0.0.1 --port 4444 & bg
7071

7172
# List all options
7273
mcpgateway --help
74+
75+
# Generate your JWT token from the key
76+
export MCPGATEWAY_BEARER_TOKEN=$(python3 -m mcpgateway.utils.create_jwt_token --username admin --exp 10080 --secret my-test-key)
77+
78+
# Run a local MCP Server (github) listening on SSE http://localhost:8000/sse
79+
pip install uvenv
80+
npx -y supergateway --stdio "uvenv run mcp-server-git"
81+
82+
#--------------------------------------------
83+
# Register the MCP Server with the gateway and test it
84+
# The curl steps can also from the admin ui: http://localhost:4444/admin
85+
# For more info on the API see /docs and /redoc *after* login to /admin
86+
#---------------------------------------------
87+
# Test the API (assume you have curl and jq installed)
88+
curl -s -H "Authorization: Bearer $MCPGATEWAY_BEARER_TOKEN" http://localhost:4444/version | jq
89+
90+
# Register the MCP server as a new gateway provider
91+
curl -s -X POST -H "Authorization: Bearer $MCPGATEWAY_BEARER_TOKEN" \
92+
-H "Content-Type: application/json" \
93+
-d '{"name":"github_mcp_server","url":"http://localhost:8000/sse"}' \
94+
http://localhost:4444/gateways
95+
96+
# List gateways - you should see [{"id":1,"name":"github_mcp_server","url":"http://localhost:8000/sse" ...
97+
curl -s -H "Authorization: Bearer $MCPGATEWAY_BEARER_TOKEN" http://localhost:4444/gateways | jq
98+
99+
# Get gateway by ID
100+
curl -s -H "Authorization: Bearer $MCPGATEWAY_BEARER_TOKEN" http://localhost:4444/gateways/1
101+
102+
# List the global tools
103+
curl -s -H "Authorization: Bearer $MCPGATEWAY_BEARER_TOKEN" http://localhost:4444/tools | jq
104+
105+
# Create a virtual server with tool 1,2,3 form global tools catalog
106+
# You can configure virtual servers with multiple tools/resources/prompts from registered MCP server (gateways)
107+
curl -X POST -H "Authorization: Bearer $MCPGATEWAY_BEARER_TOKEN" \
108+
-H "Content-Type: application/json" \
109+
-d '{"name":"devtools_mcp_server","description":"My developer tools","associatedTools": ["1","2","3"]}' \
110+
http://localhost:4444/servers
111+
112+
# List servers
113+
curl -H "Authorization: Bearer $MCPGATEWAY_BEARER_TOKEN" http://localhost:4444/servers
114+
115+
# Get an individual server
116+
curl -H "Authorization: Bearer $MCPGATEWAY_BEARER_TOKEN" http://localhost:4444/servers/1
117+
118+
# You can now use http://localhost:4444/servers/1 as an SSE server with the configured JWT token in any MCP client
73119
```
74120

75-
## Quick Start (Pre-built Image)
121+
See [.env.example](.env.example) for full list of ENV variables you can use to override the configuration.
122+
123+
## Quick Start (Pre-built Container Image)
76124

77-
If you just want to run the gateway using the official image from GitHub Container Registry:
125+
If you just want to run the gateway using the official OCI container image from GitHub Container Registry:
78126

79127
```bash
80128
docker run -d --name mcpgateway \
@@ -93,6 +141,8 @@ docker logs mcpgateway
93141
You can now access the UI at [http://localhost:4444/admin](http://localhost:4444/admin)
94142

95143
> 💡 You can also use `--env-file .env` if you have a config file already. See the provided [.env.example](.env.example)
144+
> 💡 To access local tools, consider using `--network=host`
145+
> 💡 Consider using a stable / release version of the image, ex: `ghcr.io/ibm/mcp-context-forge:v0.1.0`
96146
97147
### Optional: Mount a local volume for persistent SQLite storage
98148

@@ -120,7 +170,7 @@ curl -s -H "Authorization: Bearer $MCPGATEWAY_BEARER_TOKEN" \
120170

121171
### Running the mcpgateway-wrapper
122172

123-
The mcpgateway-wrapper lets you connect to the gateway over stdio.
173+
The mcpgateway-wrapper lets you connect to the gateway over stdio, while retaining authentication using the JWT token when the wrapper connect to a remote gateway. You should run this from a MCP client. You can test this from a shell with:
124174

125175
```bash
126176
docker run -i --name mcpgateway-wrapper \
@@ -130,10 +180,15 @@ docker run -i --name mcpgateway-wrapper \
130180
-e MCP_AUTH_TOKEN=$MCPGATEWAY_BEARER_TOKEN \
131181
ghcr.io/ibm/mcp-context-forge:latest \
132182
run --directory mcpgateway-wrapper mcpgateway-wrapper
183+
# You'll see a message similar to: Installed 21 packages in 6ms - it's now expecting input from an MCP client
133184
```
134185

135186
### Running from a MCP Client
136187

188+
The `mcpgateway-wrapper` should be used with an MCP Client that does not support SSE. You can configure it as such.
189+
190+
Remember to replace the `MCP_SERVER_CATALOG_URL` with the actual URL of your MCP Gateway. Consider container networking - when running this via a container engine, this should represent a network accessible from Docker/Podman, ex: `http://host.docker.internal:4444/servers/1`
191+
137192
```json
138193
{
139194
"servers": {
@@ -142,9 +197,10 @@ docker run -i --name mcpgateway-wrapper \
142197
"args": [
143198
"run",
144199
"--rm",
200+
"--network=host",
145201
"-i",
146202
"-e",
147-
"MCP_SERVER_CATALOG_URLS=http://host.docker.internal:4444/servers/1",
203+
"MCP_SERVER_CATALOG_URLS=http://localhost:4444/servers/1",
148204
"-e",
149205
"MCP_AUTH_TOKEN=${MCPGATEWAY_BEARER_TOKEN}",
150206
"--entrypoint",
@@ -162,14 +218,53 @@ docker run -i --name mcpgateway-wrapper \
162218
}
163219
}
164220
```
221+
222+
## Quick Start (Claude Desktop)
223+
224+
To add the mcpgateway to Claude Desktop (or similar MCP Clients) go to `File > Settings > Developer > Edit Config` and add:
225+
226+
```json
227+
{
228+
"mcpServers": {
229+
"mcpgateway-wrapper": {
230+
"command": "docker",
231+
"args": [
232+
"run",
233+
"--rm",
234+
"--network=host",
235+
"-i",
236+
"-e",
237+
"MCP_SERVER_CATALOG_URLS=http://localhost:4444/servers/1",
238+
"-e",
239+
"MCP_AUTH_TOKEN=${MCPGATEWAY_BEARER_TOKEN}",
240+
"--entrypoint",
241+
"uv",
242+
"ghcr.io/ibm/mcp-context-forge:latest",
243+
"run",
244+
"--directory",
245+
"mcpgateway-wrapper",
246+
"mcpgateway-wrapper"
247+
],
248+
"env": {
249+
"MCPGATEWAY_BEARER_TOKEN": "<place your token here>"
250+
}
251+
}
252+
}
253+
}
254+
```
255+
256+
Restart Claude Desktop (exiting from system tray). Go back to `File > Settings > Developer > Edit Config` to check on your configuration and view the logs.
257+
258+
For more details, see the [Claude MCP quickstart](https://modelcontextprotocol.io/quickstart/server). For issues, see [MCP Debugging](https://modelcontextprotocol.io/docs/tools/debugging).
259+
165260
---
166261

167262
## Quick Start (manual install)
168263

169264
### Prerequisites
170265

171266
* **Python ≥ 3.10**
172-
* **GNU Make** (all common workflows are Make targets)
267+
* **GNU Make** (optional, but all common workflows are available as Make targets)
173268
* Optional: **Docker / Podman** for containerised runs
174269

175270
### One-liner (dev)
@@ -812,7 +907,7 @@ curl -H "Authorization: Bearer $MCPGATEWAY_BEARER_TOKEN" http://localhost:4444/s
812907
# Create server
813908
curl -X POST -H "Authorization: Bearer $MCPGATEWAY_BEARER_TOKEN" \
814909
-H "Content-Type: application/json" \
815-
-d '{"name":"db","description":"Database"}' \
910+
-d '{"name":"db","description":"Database","associatedTools": ["1","2","3"]}' \
816911
http://localhost:4444/servers
817912
818913
# Update server

docs/docs/using/agents/bee.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,7 @@ To use MCP tools in the Bee Agent Framework, follow these steps:
3636

3737
```bash
3838
export MCP_GATEWAY_BASE_URL=http://localhost:4444
39-
export MCP_AUTH_USER=admin
40-
export MCP_AUTH_PASS=changeme
39+
export MCP_AUTH_TOKEN="your_bearer_token"
4140
```
4241

4342
---

docs/docs/using/clients/claude-desktop.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,7 @@ Add this block to the `"mcpServers"` section of your config:
3333
"env": {
3434
"MCP_GATEWAY_BASE_URL": "http://localhost:4444",
3535
"MCP_SERVER_CATALOG_URLS": "http://localhost:4444/servers/2",
36-
"MCP_AUTH_USER": "admin",
37-
"MCP_AUTH_PASS": "changeme"
36+
"MCP_AUTH_TOKEN": "your_bearer_token"
3837
}
3938
}
4039
}

docs/docs/using/clients/continue.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,7 @@ Replace `"mcpgateway-wrapper"` with the appropriate command or path to your MCP
5555

5656
* `MCP_GATEWAY_BASE_URL`: Base URL of your MCP Gateway (e.g., `http://localhost:4444`).
5757
* `MCP_SERVER_CATALOG_URLS`: URL(s) to the server catalog(s) (e.g., `http://localhost:4444/servers/2`).
58-
* `MCP_AUTH_USER`: Username for authentication (e.g., `admin`).
59-
* `MCP_AUTH_PASS`: Password for authentication (e.g., `changeme`).
58+
* `MCP_AUTH_TOKEN`: JWT token used for authentication (as generated by `python3 -m mcpgateway.utils.create_jwt_token`).
6059

6160
You can set these in your system environment or within the Continue configuration if supported.
6261

docs/docs/using/clients/copilot.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,7 @@ Point Copilot to the local wrapper process:
9999
"env": {
100100
"MCP_GATEWAY_BASE_URL": "http://localhost:4444",
101101
"MCP_SERVER_CATALOG_URLS": "http://localhost:4444/servers/1",
102-
"MCP_AUTH_USER": "admin",
103-
"MCP_AUTH_PASS": "changeme"
102+
"MCP_AUTH_TOKEN": "your_bearer_token"
104103
}
105104
}
106105
}

docs/docs/using/clients/mcp-inspector.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,12 @@ npx @modelcontextprotocol/inspector \
3838

3939
## 🔐 Auth & Config
4040

41-
Ensure you provide the necessary `MCP_AUTH_USER` and `MCP_AUTH_PASS` as environment variables if your gateway requires authentication:
41+
Ensure you provide the necessary `MCP_AUTH_TOKEN` as environment variable if your gateway requires authentication:
4242

4343
```bash
4444
export MCP_GATEWAY_BASE_URL=http://localhost:4444
4545
export MCP_SERVER_CATALOG_URLS=http://localhost:4444/servers/2
46-
export MCP_AUTH_USER=admin
47-
export MCP_AUTH_PASS=changeme
46+
export MCP_AUTH_TOKEN="your_bearer_token"
4847
```
4948

5049
Then run the Inspector again.

0 commit comments

Comments
 (0)