Skip to content

Commit 6be1873

Browse files
authored
Merge pull request #91 from IBM/migrate-wrapper
Migrate wrapper to mcpgateway.wrapper
2 parents 2ae96ad + 7126bba commit 6be1873

35 files changed

+1149
-2093
lines changed

.dockerignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
.devcontainer
12
.github
23
docker-compose.yml
34
podman-compose-sonarqube.yaml

.github/CODEOWNERS

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
# All files in the repo
22
* @crivetimihai
33

4-
# Ownership for the mcpgateway-wrapper
5-
/mcpgateway-wrapper/ @crivetimihai @kevalmahajan @madhav165
6-
74
# Ownership for all tests
85
/tests/ @crivetimihai @kevalmahajan @madhav165

.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)

.github/workflows/python-package.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ jobs:
3232
# 3️⃣ Install build front-end; Keep pip current
3333
- name: Install build tool
3434
run: |
35-
python -m pip install --upgrade pip
36-
python -m pip install build # PyPA-endorsed PEP 517 builder
35+
python3 -m pip install --upgrade pip
36+
python3 -m pip install build # PyPA-endorsed PEP 517 builder
3737
3838
# 4️⃣ Invoke the Makefile 'dist' target (creates ./dist/*.whl & *.tar.gz)
3939
- name: Build distributions

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ repos:
8989
- id: forbid-ai-stock-phrases
9090
name: ❌ Forbid AI Stock Phrases
9191
description: Prevents common AI-generated phrases from being committed.
92-
entry: '(?i)(source=chatgpt.com|turn0search0|filecite|as an ai language model|i am an ai developed by|this response was generated by|i don''t have real-time information|i don''t have access to real-time|i can''t browse the internet|i cannot browse the internet|my knowledge cutoff|my training data|i''m not able to access|i don''t have the ability to)'
92+
entry: '(?i)(source=chatgpt.com|turn0search0|filecite|unchanged|as an ai language model|i am an ai developed by|this response was generated by|i don''t have real-time information|i don''t have access to real-time|i can''t browse the internet|i cannot browse the internet|my knowledge cutoff|my training data|i''m not able to access|i don''t have the ability to)'
9393
language: pygrep
9494
types: [text]
9595
exclude: ^\.pre-commit-config\.yaml$

CHANGELOG.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,13 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/)
66

77
---
88

9-
## [0.2.0] - 2025-06-08 (pending)
9+
## [0.2.0] - 2025-06-15 (pending)
10+
11+
### Added
12+
13+
* Moved mcpgateway-wrapper to mcpgateway/wrapper.py so it can run as a Python module (python3 -m mcpgateway.wrapper)
14+
* Integrated version into UI. API and separate /version endpoint also available.
15+
* Added /ready endpoint
1016

1117
### Fixed
1218

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+
```

MANIFEST.in

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ include pyproject.toml
99
include gunicorn.config.py
1010
include Containerfile
1111
include Containerfile.lite
12+
include __init__
1213

1314
# 2️⃣ Top-level config, examples and helper scripts
1415
include *.py
@@ -32,12 +33,16 @@ include .pycodestyle
3233
include .pylintrc
3334
include .whitesource
3435
include .coveragerc
35-
#include .gitignore # purely optional but many projects ship it
36+
# include .gitignore # purely optional but many projects ship it
37+
include .bumpversion.cfg
38+
include .yamllint
39+
include .editorconfig
3640

3741
# 4️⃣ Runtime data that lives *inside* the package at import time
3842
recursive-include mcpgateway/templates *.html
3943
recursive-include mcpgateway/static *.css *.js *.gif *.png *.svg
4044
recursive-include mcpgateway *.pyi py.typed
45+
recursive-include mcpgateway *.ico
4146

4247
# 5️⃣ (Optional) include MKDocs-based docs in the sdist
4348
graft docs
@@ -48,3 +53,6 @@ prune build
4853
prune dist
4954
prune .eggs
5055
prune *.egg-info
56+
prune charts
57+
prune k8s
58+
prune .devcontainer

Makefile

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -162,12 +162,12 @@ certs: ## Generate ./certs/cert.pem & ./certs/key.pem
162162
test:
163163
@echo "🧪 Running tests..."
164164
@test -d "$(VENV_DIR)" || make venv
165-
@/bin/bash -c "source $(VENV_DIR)/bin/activate && python -m pip install pytest pytest-asyncio pytest-cov -q && python -m pytest --maxfail=0 --disable-warnings -v"
165+
@/bin/bash -c "source $(VENV_DIR)/bin/activate && python3 -m pip install pytest pytest-asyncio pytest-cov -q && python3 -m pytest --maxfail=0 --disable-warnings -v"
166166

167167
pytest-examples:
168168
@echo "🧪 Testing README examples..."
169169
@test -d "$(VENV_DIR)" || make venv
170-
@/bin/bash -c "source $(VENV_DIR)/bin/activate && python -m pip install pytest pytest-examples -q && pytest -v test_readme.py"
170+
@/bin/bash -c "source $(VENV_DIR)/bin/activate && python3 -m pip install pytest pytest-examples -q && pytest -v test_readme.py"
171171

172172
test-curl:
173173
./test_endpoints.sh
@@ -342,10 +342,10 @@ lint:
342342
## --------------------------------------------------------------------------- ##
343343
autoflake: ## 🧹 Strip unused imports / vars
344344
@$(VENV_DIR)/bin/autoflake --in-place --remove-all-unused-imports \
345-
--remove-unused-variables -r mcpgateway mcpgateway-wrapper tests
345+
--remove-unused-variables -r mcpgateway tests
346346

347347
black: ## 🎨 Reformat code with black
348-
@echo "🎨 black …" && $(VENV_DIR)/bin/black -l 200 mcpgateway mcpgateway-wrapper tests
348+
@echo "🎨 black …" && $(VENV_DIR)/bin/black -l 200 mcpgateway tests
349349

350350
isort: ## 🔀 Sort imports
351351
@echo "🔀 isort …" && $(VENV_DIR)/bin/isort .
@@ -375,19 +375,19 @@ pre-commit: ## 🪄 Run pre-commit hooks
375375
@$(VENV_DIR)/bin/pre-commit run --all-files --show-diff-on-failure
376376

377377
ruff: ## ⚡ Ruff lint + format
378-
@$(VENV_DIR)/bin/ruff check mcpgateway && $(VENV_DIR)/bin/ruff format mcpgateway mcpgateway-wrapper tests
378+
@$(VENV_DIR)/bin/ruff check mcpgateway && $(VENV_DIR)/bin/ruff format mcpgateway tests
379379

380380
ty: ## ⚡ Ty type checker
381-
@$(VENV_DIR)/bin/ty check mcpgateway mcpgateway-wrapper tests
381+
@$(VENV_DIR)/bin/ty check mcpgateway tests
382382

383383
pyright: ## 🏷️ Pyright type-checking
384-
@$(VENV_DIR)/bin/pyright mcpgateway mcpgateway-wrapper tests
384+
@$(VENV_DIR)/bin/pyright mcpgateway tests
385385

386386
radon: ## 📈 Complexity / MI metrics
387-
@$(VENV_DIR)/bin/radon mi -s mcpgateway mcpgateway-wrapper tests && \
388-
$(VENV_DIR)/bin/radon cc -s mcpgateway mcpgateway-wrapper tests && \
389-
$(VENV_DIR)/bin/radon hal mcpgateway mcpgateway-wrapper tests && \
390-
$(VENV_DIR)/bin/radon raw -s mcpgateway mcpgateway-wrapper tests
387+
@$(VENV_DIR)/bin/radon mi -s mcpgateway tests && \
388+
$(VENV_DIR)/bin/radon cc -s mcpgateway tests && \
389+
$(VENV_DIR)/bin/radon hal mcpgateway tests && \
390+
$(VENV_DIR)/bin/radon raw -s mcpgateway tests
391391

392392
pyroma: ## 📦 Packaging metadata check
393393
@$(VENV_DIR)/bin/pyroma -d .
@@ -414,10 +414,10 @@ depend: ## 📦 List dependencies
414414
pdm list --freeze
415415

416416
snakeviz: ## 🐍 Interactive profile visualiser
417-
@python -m cProfile -o mcp.prof app/server.py && snakeviz mcp.prof --server
417+
@python3 -m cProfile -o mcp.prof app/server.py && snakeviz mcp.prof --server
418418

419419
pstats: ## 📊 Static call-graph image
420-
@python -m cProfile -o mcp.pstats app/server.py && \
420+
@python3 -m cProfile -o mcp.pstats app/server.py && \
421421
gprof2dot -w -e 3 -n 3 -s -f pstats mcp.pstats | \
422422
dot -Tpng -o $(DOCS_DIR)/pstats.png
423423

@@ -429,22 +429,22 @@ tox: ## 🧪 Multi-Python tox matrix
429429
uv pip install tox-travis tox-pdm
430430
pdm add -G dev
431431
pdm python install 3.11 3.12
432-
python -m tox -p 2
432+
python3 -m tox -p 2
433433

434434
sbom: ## 🛡️ Generate SBOM & security report
435435
@echo "🛡️ Generating SBOM & security report…"
436436
@rm -Rf "$(VENV_DIR).sbom"
437437
@python3 -m venv "$(VENV_DIR).sbom"
438438
@/bin/bash -c "source $(VENV_DIR).sbom/bin/activate && python3 -m pip install --upgrade pip setuptools pdm uv && python3 -m uv pip install .[dev]"
439439
@/bin/bash -c "source $(VENV_DIR)/bin/activate && python3 -m uv pip install cyclonedx-bom sbom2doc"
440-
@/bin/bash -c "source $(VENV_DIR)/bin/activate && python -m cyclonedx_py environment --validate '$(VENV_DIR).sbom' --pyproject pyproject.toml --gather-license-texts > $(PROJECT_NAME).sbom.json"
440+
@/bin/bash -c "source $(VENV_DIR)/bin/activate && python3 -m cyclonedx_py environment --validate '$(VENV_DIR).sbom' --pyproject pyproject.toml --gather-license-texts > $(PROJECT_NAME).sbom.json"
441441
@/bin/bash -c "source $(VENV_DIR)/bin/activate && sbom2doc -i $(PROJECT_NAME).sbom.json -f markdown -o $(DOCS_DIR)/docs/test/sbom.md"
442442
@trivy sbom $(PROJECT_NAME).sbom.json | tee -a $(DOCS_DIR)/docs/test/sbom.md
443443
@/bin/bash -c "source $(VENV_DIR).sbom/bin/activate && python3 -m pdm outdated | tee -a $(DOCS_DIR)/docs/test/sbom.md"
444444

445445
pytype: ## 🧠 Pytype static type analysis
446446
@echo "🧠 Pytype analysis…"
447-
@$(VENV_DIR)/bin/pytype -V 3.12 -j auto mcpgateway mcpgateway-wrapper tests
447+
@$(VENV_DIR)/bin/pytype -V 3.12 -j auto mcpgateway tests
448448

449449
check-manifest: ## 📦 Verify MANIFEST.in completeness
450450
@echo "📦 Verifying MANIFEST.in completeness…"
@@ -641,7 +641,7 @@ pysonar-scanner:
641641
@echo "🐍 Scanning code with pysonar-scanner (PyPI) …"
642642
@test -f $(SONAR_PROPS) || { echo "$(SONAR_PROPS) not found."; exit 1; }
643643
python3 -m pip install --upgrade --quiet pysonar-scanner
644-
python -m pysonar_scanner \
644+
python3 -m pysonar_scanner \
645645
-Dproject.settings=$(SONAR_PROPS) \
646646
-Dsonar.host.url=$(SONAR_HOST_URL) \
647647
$(if $(SONAR_TOKEN),-Dsonar.login=$(SONAR_TOKEN),)
@@ -739,7 +739,7 @@ pip-audit:
739739
@echo "🔒 pip-audit vulnerability scan…"
740740
@test -d "$(VENV_DIR)" || $(MAKE) venv
741741
@/bin/bash -c "source $(VENV_DIR)/bin/activate && \
742-
python -m pip install --quiet --upgrade pip-audit && \
742+
python3 -m pip install --quiet --upgrade pip-audit && \
743743
pip-audit --progress-spinner ascii --strict || true"
744744

745745
# =============================================================================
@@ -777,15 +777,15 @@ containerfile-update:
777777
.PHONY: dist wheel sdist verify publish
778778

779779
dist: clean ## Build wheel + sdist
780-
python -m build
780+
python3 -m build
781781
@echo "🛠 Wheel & sdist written to ./dist"
782782

783783
wheel: ## Build wheel only
784-
python -m build -w
784+
python3 -m build -w
785785
@echo "🛠 Wheel written to ./dist"
786786

787787
sdist: ## Build source distribution only
788-
python -m build -s
788+
python3 -m build -s
789789
@echo "🛠 Source distribution written to ./dist"
790790

791791
verify: dist ## Build, run metadata & manifest checks
@@ -1897,7 +1897,7 @@ shell-linters-install: ## 🔧 Install shellcheck, shfmt, bashate
18971897
if ! $(VENV_DIR)/bin/bashate -h >/dev/null 2>&1 ; then \
18981898
echo "🛠 Installing bashate (into venv)…" ; \
18991899
test -d "$(VENV_DIR)" || $(MAKE) venv ; \
1900-
/bin/bash -c "source $(VENV_DIR)/bin/activate && python -m pip install --quiet bashate" ; \
1900+
/bin/bash -c "source $(VENV_DIR)/bin/activate && python3 -m pip install --quiet bashate" ; \
19011901
fi
19021902
@echo "✅ Shell linters ready."
19031903

0 commit comments

Comments
 (0)