Skip to content

Commit 4d26b75

Browse files
committed
Cleanup mcpgateway-wrapper
Signed-off-by: Mihai Criveti <[email protected]>
1 parent 806f6af commit 4d26b75

File tree

23 files changed

+458
-1712
lines changed

23 files changed

+458
-1712
lines changed

.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

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: 12 additions & 12 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
@@ -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,15 +429,15 @@ 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"
@@ -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+
@/bin/bash -c "source $(VENV_DIR)/bin/activate && python3 -m build"
781781
@echo "🛠 Wheel & sdist written to ./dist"
782782

783783
wheel: ## Build wheel only
784-
python -m build -w
784+
@/bin/bash -c "source $(VENV_DIR)/bin/activate && python3 -m build -w"
785785
@echo "🛠 Wheel written to ./dist"
786786

787787
sdist: ## Build source distribution only
788-
python -m build -s
788+
@/bin/bash -c "source $(VENV_DIR)/bin/activate && 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

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ npx -y supergateway --stdio "uvenv run mcp_server_time -- --local-timezone=Europ
199199
# Start the MCP Gateway Wrapper
200200
export MCP_AUTH_TOKEN=${MCPGATEWAY_BEARER_TOKEN}
201201
export MCP_SERVER_CATALOG_URLS=http://localhost:4444/servers/1
202-
python -m mcpgateway.wrapper
202+
python3 -m mcpgateway.wrapper
203203
```
204204

205205
**Initialize the protocol:**
@@ -445,7 +445,7 @@ uv pip install -e '.[dev]' # IMPORTANT: in zsh, quote to disable glob expansion!
445445
### pip (alternative)
446446

447447
```bash
448-
python -m venv .venv && source .venv/bin/activate
448+
python3 -m venv .venv && source .venv/bin/activate
449449
pip install -e ".[dev]"
450450
```
451451

@@ -518,7 +518,7 @@ You can get started by copying the provided `.env.examples` to `.env` and making
518518
> * Generate tokens via:
519519
>
520520
> ```bash
521-
> python -m mcpgateway.utils.create_jwt_token -u admin -e 10080 > token.txt
521+
> python3 -m mcpgateway.utils.create_jwt_token -u admin -e 10080 > token.txt
522522
> export MCPGATEWAY_BEARER_TOKEN=$(cat token.txt)
523523
> ```
524524
> * Tokens allow non-interactive API clients to authenticate securely.
@@ -772,7 +772,7 @@ Generate an API Bearer token, and test the various API endpoints:
772772
773773
```bash
774774
# Generate a bearer token using the configured secret key (use the same as your .env)
775-
export MCPGATEWAY_BEARER_TOKEN=$(python -m mcpgateway.utils.create_jwt_token -u admin --secret my-test-key)
775+
export MCPGATEWAY_BEARER_TOKEN=$(python3 -m mcpgateway.utils.create_jwt_token -u admin --secret my-test-key)
776776
echo ${MCPGATEWAY_BEARER_TOKEN}
777777
778778
# Quickly confirm that authentication works and the gateway is healthy

TESTING.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,13 +41,13 @@ You can run specific tests by specifying the file or directory:
4141
source ~/.venv/mcpgateway/bin/activate
4242

4343
# Run a specific test file
44-
python -m pytest tests/unit/mcpgateway/test_config.py -v
44+
python3 -m pytest tests/unit/mcpgateway/test_config.py -v
4545

4646
# Run a specific test class
47-
python -m pytest tests/unit/mcpgateway/validation/test_jsonrpc.py::TestJSONRPCValidation -v
47+
python3 -m pytest tests/unit/mcpgateway/validation/test_jsonrpc.py::TestJSONRPCValidation -v
4848

4949
# Run a specific test method
50-
python -m pytest tests/unit/mcpgateway/validation/test_jsonrpc.py::TestJSONRPCValidation::test_validate_valid_request -v
50+
python3 -m pytest tests/unit/mcpgateway/validation/test_jsonrpc.py::TestJSONRPCValidation::test_validate_valid_request -v
5151
```
5252

5353
### Testing README Examples
@@ -67,10 +67,10 @@ To run tests with coverage reporting:
6767
source ~/.venv/mcpgateway/bin/activate
6868

6969
# Run tests with coverage
70-
python -m pytest --cov=mcpgateway tests/
70+
python3 -m pytest --cov=mcpgateway tests/
7171

7272
# Generate a coverage report
73-
python -m pytest --cov=mcpgateway --cov-report=html tests/
73+
python3 -m pytest --cov=mcpgateway --cov-report=html tests/
7474
```
7575

7676
The HTML coverage report will be available in the `htmlcov` directory.

docs/docs/deployment/ibm-code-engine.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ To access the APIs you need to generate your JWT token using the same `JWT_SECRE
8181

8282
```bash
8383
# Generate a one-off token for the default admin user
84-
export MCPGATEWAY_BEARER_TOKEN=$(python -m mcpgateway.utils.create_jwt_token -u admin)
84+
export MCPGATEWAY_BEARER_TOKEN=$(python3 -m mcpgateway.utils.create_jwt_token -u admin)
8585
echo ${MCPGATEWAY_BEARER_TOKEN} # Check that the key was generated
8686
```
8787

@@ -224,7 +224,7 @@ Test the API endpoints with the generated `MCPGATEWAY_BEARER_TOKEN`:
224224
225225
```bash
226226
# Generate a one-off token for the default admin user
227-
export MCPGATEWAY_BEARER_TOKEN=$(python -m mcpgateway.utils.create_jwt_token -u admin)
227+
export MCPGATEWAY_BEARER_TOKEN=$(python3 -m mcpgateway.utils.create_jwt_token -u admin)
228228

229229
# Call a protected endpoint. Since there are not tools, initially this just returns `[]`
230230
curl -H "Authorization: Bearer ${MCPGATEWAY_BEARER_TOKEN}" \

docs/docs/deployment/local.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,6 @@ Visit [http://localhost:4444/admin](http://localhost:4444/admin) and login using
6262
## 🔁 Quick JWT Setup
6363

6464
```bash
65-
export MCPGATEWAY_BEARER_TOKEN=$(python -m mcpgateway.utils.create_jwt_token -u admin)
65+
export MCPGATEWAY_BEARER_TOKEN=$(python3 -m mcpgateway.utils.create_jwt_token -u admin)
6666
curl -H "Authorization: Bearer $MCPGATEWAY_BEARER_TOKEN" http://localhost:4444/tools
6767
```

docs/docs/development/building.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ This will:
2929
## 🐍 Manual Python Setup
3030

3131
```bash
32-
python -m venv .venv
32+
python3 -m venv .venv
3333
source .venv/bin/activate
3434
pip install -e ".[dev]"
3535
```

docs/docs/development/github.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ make compose-up
214214
Quickly confirm that authentication works and the gateway is healthy:
215215

216216
```bash
217-
export MCPGATEWAY_BEARER_TOKEN=$(python -m mcpgateway.utils.create_jwt_token -u admin --secret my-test-key)
217+
export MCPGATEWAY_BEARER_TOKEN=$(python3 -m mcpgateway.utils.create_jwt_token -u admin --secret my-test-key)
218218
curl -s -k -H "Authorization: Bearer $MCPGATEWAY_BEARER_TOKEN" https://localhost:4444/health
219219
```
220220

docs/docs/development/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ Admin UI and API are protected by Basic Auth or JWT.
9595
To generate a JWT:
9696

9797
```bash
98-
python -m mcpgateway.utils.create_jwt_token \
98+
python3 -m mcpgateway.utils.create_jwt_token \
9999
-u admin \
100100
-e 10080 | tee token.txt
101101

0 commit comments

Comments
 (0)