Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 13 additions & 13 deletions .secrets.baseline

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -530,7 +530,7 @@ Run from the worktree root, in order. Each command must pass, or the PR must doc
| `make test` | Full pytest suite |
| `make coverage diff-cover` | Coverage of changed lines vs. base |
| `make docker-nuke docker-prod-rust testing-up RUST_MCP_MODE=` | Rebuilds and launches the production-style gateway stack |
| `make test-mcp-protocol-e2e test-mcp-rbac` | MCP protocol E2E and RBAC against the live gateway |
| `make test-e2e` | MCP protocol E2E and RBAC against the live gateway |
| `make detect-secrets-scan` | No new secrets in files changed vs `main`; exits non-zero on live/unaudited findings (jq merge preserves out-of-scope audited entries; remediate with `make detect-secrets-audit`) |

Distinct from the per-edit hygiene chain in *Essential Commands → Code Quality* (`make autoflake isort black pre-commit`, then `make ruff bandit interrogate pylint verify`): hygiene runs continuously; this gate runs once before declaring a PR ready.
Expand Down
43 changes: 22 additions & 21 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -857,10 +857,11 @@ clean:
# =============================================================================
# help: 🧪 TESTING
# help: smoketest - Run smoketest.py --verbose (build container, add MCP server, test endpoints)
# help: test-mcp-protocol-e2e - MCP protocol E2E via mcp SDK client against live gateway (K=<filter> to pick one; MCP_E2E_CLIENT_TIMEOUT env to extend the 5s client timeout)
# help: test-mcp-cli - [DEPRECATED] Alias for test-mcp-protocol-e2e (accepts same K=<filter>)
# help: test-e2e - Consolidated MCP protocol and RBAC E2E suite against live gateway (K=<filter>; MCP_E2E_CLIENT_TIMEOUT extends 5s client timeout)
# help: test-mcp-protocol-e2e - [DEPRECATED] Alias for test-e2e (accepts same K=<filter>)
# help: test-mcp-cli - [DEPRECATED] Alias for test-e2e (accepts same K=<filter>)
# help: test-bats - Run bats tests for git tooling (tests/bash; requires bats)
# help: test-mcp-rbac - RBAC + multi-transport MCP protocol tests (needs live gateway + SSE)
# help: test-mcp-rbac - [DEPRECATED] Alias for test-e2e (accepts same K=<filter>)
# help: test-mcp-access-matrix - MCP role/access matrix (Rust transport, edge/full mode)
# help: test-mcp-plugin-parity - MCP plugin parity E2E for current Python or Rust stack
# help: test-mcp-session-isolation - MCP session/auth isolation tests for Rust public transport
Expand Down Expand Up @@ -900,7 +901,7 @@ clean:
# help: query-log-analyze - Analyze query log for N+1 patterns and slow queries
# help: query-log-clear - Clear database query log files

.PHONY: smoketest test-mcp-cli test-mcp-rbac test-mcp-plugin-parity test-mcp-access-matrix \
.PHONY: smoketest test-e2e test-mcp-cli test-mcp-protocol-e2e test-mcp-rbac test-mcp-plugin-parity test-mcp-access-matrix \
test-mcp-session-isolation test-mcp-session-isolation-load test-e2e-sso test-oauth-status-live \
test-live-gateway test test-verbose test-profile coverage test-docs pytest-examples \
test-curl htmlcov doctest doctest-verbose doctest-coverage doctest-check test-db-perf \
Expand All @@ -916,7 +917,7 @@ clean:
# a running gateway (`make testing-up`), Keycloak/Entra (sso/), or the Rust
# transport (e2e_rust/).
# Invoke via `make test-live-gateway` (everything) or a targeted helper
# (test-mcp-protocol-e2e, test-mcp-rbac, test-mcp-plugin-parity,
# (test-e2e, test-mcp-plugin-parity,
# test-mcp-access-matrix, test-mcp-session-isolation, test-e2e-sso).
PYTEST_IGNORE := tests/fuzz tests/manual test.py \
tests/live_gateway
Expand All @@ -931,20 +932,24 @@ smoketest:
@$(VENV_DIR)/bin/python ./smoketest.py --verbose || { echo "❌ Smoketest failed!"; exit 1; }
@echo "✅ Smoketest passed!"

test-mcp-protocol-e2e: uv ## MCP protocol E2E via mcp SDK client (K=<filter> to pick one)
@echo "🔌 Running MCP protocol E2E tests against $${MCP_CLI_BASE_URL:-http://localhost:8080}..."
test-e2e: uv ## Consolidated E2E suite against live gateway (3 replicas)
@echo "🧪 Running E2E suite against $${MCP_CLI_BASE_URL:-http://localhost:8080}..."
@echo " Env: MCP_CLI_BASE_URL (gateway URL) JWT_SECRET_KEY PLATFORM_ADMIN_EMAIL"
@echo " MCP Apps: set MCPGATEWAY_MCP_APPS_ENABLED=true for both testing-up and this target"
@echo " Timeout: $${MCP_E2E_CLIENT_TIMEOUT:-5.0}s per client operation (override MCP_E2E_CLIENT_TIMEOUT)"
@echo " Requires: docker-compose stack with SSE gateway registered"
@if [ -n "$(K)" ]; then echo " Filter: -k \"$(K)\""; fi
@$(UV_BIN) run pytest tests/live_gateway/mcp/test_mcp_protocol_e2e.py $(if $(K),-k "$(K)") -v -s --tb=short \
|| { echo "❌ MCP protocol E2E tests failed!"; exit 1; }
@echo "✅ MCP protocol E2E tests passed!"
@$(UV_BIN) run pytest -p playwright tests/live_gateway/e2e/test_e2e.py $(if $(K),-k "$(K)") -v -s --tb=short \
|| { echo "❌ E2E suite failed!"; exit 1; }
@echo "✅ E2E suite passed!"

# deprecated: test-mcp-protocol-e2e - Use "make test-e2e" instead (v1.3.0)
test-mcp-protocol-e2e: test-e2e
$(call deprecated_target,test-mcp-protocol-e2e,make test-e2e,1.3.0)

# deprecated: test-mcp-cli - Use "make test-mcp-protocol-e2e" instead (v1.2.0)
test-mcp-cli:
$(call deprecated_target,test-mcp-cli,make test-mcp-protocol-e2e,1.2.0)
@$(MAKE) --no-print-directory test-mcp-protocol-e2e K="$(K)"
# deprecated: test-mcp-cli - Use "make test-e2e" instead (v1.3.0)
test-mcp-cli: test-e2e
$(call deprecated_target,test-mcp-cli,make test-e2e,1.3.0)

.PHONY: test-bats
test-bats: ## 🧪 Run bats tests for git tooling (tests/bash)
Expand All @@ -958,13 +963,9 @@ test-bats: ## 🧪 Run bats tests for git tooling (tests/ba
@echo "🧪 Running bats tests for git tooling (tests/bash)..."
@bats tests/bash/ && echo "✅ bats tests passed!" || { echo "❌ bats tests failed!"; exit 1; }

test-mcp-rbac: uv ## RBAC + multi-transport MCP protocol tests (needs live gateway + SSE)
@echo "🔐 Running RBAC + multi-transport MCP protocol tests against $${MCP_CLI_BASE_URL:-http://localhost:8080}..."
@echo " Requires: docker-compose stack with SSE gateway registered"
@$(UV_BIN) run playwright install --with-deps chromium >/dev/null
@$(UV_BIN) run pytest -p playwright tests/live_gateway/mcp/test_mcp_rbac_transport.py -v -s --tb=short \
|| { echo "❌ MCP RBAC transport tests failed!"; exit 1; }
@echo "✅ MCP RBAC transport tests passed!"
# deprecated: test-mcp-rbac - Use "make test-e2e" instead (v1.3.0)
test-mcp-rbac: test-e2e
$(call deprecated_target,test-mcp-rbac,make test-e2e,1.3.0)

test-mcp-access-matrix: uv ## Detailed Rust MCP role/access matrix test with strong tool/resource/prompt sentinels
@echo "🧪 Running MCP role/access matrix tests against $${MCP_CLI_BASE_URL:-http://localhost:8080}..."
Expand Down
29 changes: 10 additions & 19 deletions crates/mcp_runtime/DEVELOPING.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ Use the smallest set that matches your change.
| --- | --- |
| Pure Rust refactor in `src/` or `tests/` | `make -C crates/mcp_runtime fmt-check clippy-all test test-rmcp` |
| Rust + Python integration change | Rust-local checks plus `make doctest test htmlcov` |
| MCP protocol, auth, session, or transport behavior | Rebuild stack and run `make test-mcp-protocol-e2e test-mcp-rbac`; add `make test-mcp-plugin-parity` with `PLUGINS_CONFIG_FILE=plugins/plugin_parity_config.yaml` for live plugin parity, `make test-mcp-access-matrix` for detailed role/output verification, `make test-mcp-session-isolation` for Rust public path work, and `make test-mcp-session-isolation-load` for correctness-under-load changes |
| MCP protocol, auth, session, or transport behavior | Rebuild stack and run `make test-e2e`; add `make test-mcp-plugin-parity` with `PLUGINS_CONFIG_FILE=plugins/plugin_parity_config.yaml` for live plugin parity, `make test-mcp-access-matrix` for detailed role/output verification, `make test-mcp-session-isolation` for Rust public path work, and `make test-mcp-session-isolation-load` for correctness-under-load changes |
| Overview / Version Info / templates / JS / CSS | `make test-js-coverage lint-web bandit interrogate pylint`, plus `make test-ui-smoke` and targeted Playwright tests |
| Packaging / release readiness | `make verify` |
| Performance-sensitive hot path | relevant tests plus benchmark and profiling targets |
Expand Down Expand Up @@ -180,8 +180,7 @@ make testing-down
make compose-clean
make docker-prod DOCKER_BUILD_ARGS="--no-cache"
make testing-up
make test-mcp-protocol-e2e
make test-mcp-rbac
make test-e2e
make test-mcp-access-matrix
PLUGINS_CONFIG_FILE=plugins/plugin_parity_config.yaml make testing-up
MCP_PLUGIN_PARITY_EXPECTED_RUNTIME=python make test-mcp-plugin-parity
Expand All @@ -190,8 +189,7 @@ MCP_PLUGIN_PARITY_EXPECTED_RUNTIME=python make test-mcp-plugin-parity
Expected outcome:

- `/health` reports Python MCP mode
- `make test-mcp-protocol-e2e` passes, with the Rust-only raw-header assertion skipped
- `make test-mcp-rbac` passes
- `make test-e2e` passes, with the Rust-only raw-header assertion skipped
- `make test-mcp-access-matrix` passes and verifies scoped-user access with
strong tool/resource/prompt sentinels
- `make test-mcp-plugin-parity` passes with the Python runtime header and proves
Expand All @@ -205,8 +203,7 @@ path.

```bash
make testing-rebuild-rust-shadow
make test-mcp-protocol-e2e
make test-mcp-rbac
make test-e2e
make test-mcp-access-matrix
```

Expand All @@ -222,8 +219,7 @@ session/event-store stack.

```bash
make testing-rebuild-rust
make test-mcp-protocol-e2e
make test-mcp-rbac
make test-e2e
make test-mcp-access-matrix
```

Expand All @@ -234,8 +230,7 @@ stream/auth reuse changes.

```bash
make testing-rebuild-rust-full
make test-mcp-protocol-e2e
make test-mcp-rbac
make test-e2e
make test-mcp-access-matrix
make test-mcp-session-isolation
make test-mcp-session-isolation-load MCP_ISOLATION_LOAD_RUN_TIME=30s
Expand All @@ -247,8 +242,7 @@ MCP_PLUGIN_PARITY_EXPECTED_RUNTIME=rust make test-mcp-plugin-parity
Expected outcome:

- `/health` reports Rust-managed runtime and Rust-mounted public transport
- `make test-mcp-protocol-e2e` passes
- `make test-mcp-rbac` passes
- `make test-e2e` passes
- `make test-mcp-access-matrix` passes on the Rust path
- `make test-mcp-session-isolation` passes on the Rust path
- `make test-mcp-session-isolation-load` validates owner traffic and hijack
Expand Down Expand Up @@ -450,8 +444,7 @@ make -C crates/mcp_runtime fmt-check clippy-all test-rmcp
make doctest test htmlcov
make bandit interrogate pylint
make testing-rebuild-rust-full
make test-mcp-protocol-e2e
make test-mcp-rbac
make test-e2e
make test-mcp-access-matrix
make test-mcp-session-isolation
```
Expand Down Expand Up @@ -494,8 +487,7 @@ If the change affects fallback behavior or public MCP mounting:

```bash
make testing-up
make test-mcp-protocol-e2e
make test-mcp-rbac
make test-e2e
```

## What "Good" Looks Like
Expand All @@ -518,8 +510,7 @@ make autoflake isort black pre-commit
make test-js-coverage lint-web bandit interrogate pylint verify
make doctest test htmlcov
make testing-rebuild-rust-full
make test-mcp-protocol-e2e
make test-mcp-rbac
make test-e2e
make test-mcp-access-matrix
make test-mcp-session-isolation
cargo test --release --manifest-path crates/mcp_runtime/Cargo.toml
Expand Down
9 changes: 3 additions & 6 deletions crates/mcp_runtime/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,7 @@ make testing-up-rust-full

```bash
make test
make test-mcp-protocol-e2e
make test-mcp-rbac
make test-e2e
make test-mcp-session-isolation
make test-mcp-session-isolation-load
cargo test --release --manifest-path crates/mcp_runtime/Cargo.toml
Expand Down Expand Up @@ -424,8 +423,7 @@ For the full-Rust public path:

```bash
make testing-rebuild-rust-full
make test-mcp-protocol-e2e
make test-mcp-rbac
make test-e2e
make test-mcp-session-isolation
cargo test --release --manifest-path crates/mcp_runtime/Cargo.toml
make benchmark-mcp-tools
Expand All @@ -444,8 +442,7 @@ For the safe fallback path:

```bash
make testing-rebuild-rust-shadow
make test-mcp-protocol-e2e
make test-mcp-rbac
make test-e2e
```

## Further reading
Expand Down
12 changes: 4 additions & 8 deletions crates/mcp_runtime/RELEASE-CHECKLIST.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,7 @@ Rules:
- [ ] Confirm `/health` reports Python MCP mode
- [ ] Confirm admin Overview shows `🐍 Python MCP Core`
- [ ] Confirm Version Info shows the MCP Runtime card in Python mode
- [ ] `make test-mcp-protocol-e2e`
- [ ] `make test-mcp-rbac`
- [ ] `make test-e2e`
- [ ] `make test-mcp-access-matrix`
- [ ] `make 2025-11-25-core`
- [ ] `make 2025-11-25-auth`
Expand All @@ -80,8 +79,7 @@ Rules:
- [ ] `curl -sD - http://localhost:8080/health -o /dev/null | rg 'x-contextforge-mcp-'`
- [ ] Confirm `/health` reports `rust-managed` runtime with Python transport mounted
- [ ] Confirm admin Overview shows Rust runtime present but Python public transport semantics
- [ ] `make test-mcp-protocol-e2e`
- [ ] `make test-mcp-rbac`
- [ ] `make test-e2e`
- [ ] `make test-mcp-access-matrix`
- [ ] `make 2025-11-25-core`
- [ ] `make 2025-11-25-auth`
Expand All @@ -93,8 +91,7 @@ Rules:
- [ ] Confirm `/health` reports Rust transport mounted
- [ ] Confirm admin Overview shows `🦀 Rust MCP Core`
- [ ] Confirm Version Info shows MCP Runtime card with Rust transport mounted
- [ ] `make test-mcp-protocol-e2e`
- [ ] `make test-mcp-rbac`
- [ ] `make test-e2e`
- [ ] `make test-mcp-access-matrix`
- [ ] `make 2025-11-25-core`
- [ ] `make 2025-11-25-auth`
Expand All @@ -106,8 +103,7 @@ Rules:
- [ ] Confirm `/health` reports Rust transport/session/event-store/resume/live-stream/affinity/auth-reuse mounted as expected
- [ ] Confirm admin Overview shows `🦀 Rust MCP Core`
- [ ] Confirm Version Info shows MCP Runtime card with the expected mounted/core modes
- [ ] `make test-mcp-protocol-e2e`
- [ ] `make test-mcp-rbac`
- [ ] `make test-e2e`
- [ ] `make test-mcp-access-matrix`
- [ ] `make test-mcp-session-isolation`
- [ ] `make test-mcp-session-isolation-load MCP_ISOLATION_LOAD_RUN_TIME=30s`
Expand Down
2 changes: 1 addition & 1 deletion crates/mcp_runtime/TESTING-DESIGN.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ The following invariants should stay explicit and testable:

Useful existing coverage already lives in:

- [tests/live_gateway/mcp/test_mcp_rbac_transport.py](../../tests/live_gateway/mcp/test_mcp_rbac_transport.py)
- [tests/live_gateway/e2e/test_e2e.py](../../tests/live_gateway/e2e/test_e2e.py)
- [tests/integration/test_streamable_http_redis.py](../../tests/integration/test_streamable_http_redis.py)
- [tests/e2e/test_session_pool_e2e.py](../../tests/e2e/test_session_pool_e2e.py)
- [tests/loadtest/locustfile_mcp_protocol.py](../../tests/loadtest/locustfile_mcp_protocol.py)
Expand Down
3 changes: 1 addition & 2 deletions docs/docs/architecture/rust-mcp-runtime.md
Original file line number Diff line number Diff line change
Expand Up @@ -415,8 +415,7 @@ Recommended stack-backed validation:

```bash
make testing-rebuild-rust-full
make test-mcp-protocol-e2e
make test-mcp-rbac
make test-e2e
make test-mcp-session-isolation
cargo test --release --manifest-path crates/mcp_runtime/Cargo.toml
```
Expand Down
Loading
Loading