For specific tasks, see also: llms/api.md llms/helm.md llms/mcpgateway.md llms/mcp-server-go.md llms/mcp-server-python.md llms/mkdocs.md llms/plugins-llms.md llms/testing.md
mcpgateway/: FastAPI gateway source (entrymain.py,cli.py, services, transports, templates/static, Alembic).- Services:
mcpgateway/services/(gateway, server, tool, resource, prompt logic). - Transports:
mcpgateway/transports/(SSE, WebSocket, stdio, streamable HTTP). - Plugins:
plugins/(framework/, plugin configs inplugins/config.yaml). - Plugins:
plugins/(built-in filters and utilities likepii_filter/,deny_filter/,regex_filter/,resource_filter/; main configuration inplugins/config.yaml). - Tests:
tests/unit,tests/integration,tests/e2e,tests/playwright. - Docs & ops:
docs/,deployment/,charts/,examples/. Build artefacts:build/,dist/.
- Pre-commit:
make autoflake isort black pre-commit - Setup:
make venv,make install-dev. - Run:
make dev(hot reload on :8000),make serve(gunicorn), ormcpgateway --host 0.0.0.0 --port 4444. - Quality:
make lint,make lint-web,make check-manifest. - Tests:
make test,make doctest,make htmlcov(HTML todocs/docs/coverage/index.html). - Final check:
make doctest test htmlcov smoketest lint-web flake8 bandit interrogate pylint verify
make dev: Run fast-reload dev server on:8000.make serve: Run production Gunicorn server on:4444.make certs: Generate self-signed TLS certs in./certs/.make serve-ssl: Run Gunicorn behind HTTPS on:4444(uses./certs).make lint: Run full lint suite;make install-web-lintersonce beforemake lint-web.make test: Run unit tests;make coveragewrites HTML todocs/docs/coverage/.make doctest: Run doctests acrossmcpgateway/modules.make check-env: Verify.envkeys match.env.example.make clean: Remove caches, build artefacts, venv, coverage, docs, certs.
MCP helpers
- JWT token:
python -m mcpgateway.utils.create_jwt_token --username admin@example.com --exp 10080 --secret KEY. - Expose stdio server:
python -m mcpgateway.translate --stdio "uvx mcp-server-git" --port 9000.
- Python >= 3.11. Type hints required; strict
mypysettings. - Formatters/linters: Black (line length 200), isort (profile=black), Ruff (F,E,W,B,ASYNC), Pylint as configured in
pyproject.tomland dotfiles. - Naming:
snake_casefor modules/functions,PascalCasefor classes,UPPER_CASEfor constants. - Group imports per isort sections (stdlib, third-party, first-party
mcpgateway, local).
- Pytest with async; discovery configured in
pyproject.toml. - Layout: unit (
tests/unit), integration (tests/integration), e2e (tests/e2e), UI (tests/playwright). - Naming: files
test_*.py, classesTest*, functionstest_*; marks:slow,ui,api,smoke,e2e. - Commands:
make test,pytest -k "name",pytest -m "not slow". Usemake coveragefor reports. - Keep tests deterministic, isolated, and fast by default.
- Conventional Commits (
feat:,fix:,docs:,refactor:,chore:). Link issues (e.g.,Closes #123). - Sign every commit with DCO:
git commit -s. - Do not mention Claude or Claude Code in PRs/diffs. Do not include effort estimates or "phases".
- Include tests and docs for behavior changes; attach screenshots for UI changes when relevant.
- Require green lint and tests locally before opening a PR.
- Core: FastAPI + Pydantic with SQLAlchemy. Architectural decisions live under
docs/docs/architecture/adr/. - Data: SQLite by default; PostgreSQL via extras. Migrations managed with Alembic in
mcpgateway/alembic/. - Caching & Federation: Optional Redis, mDNS/Zeroconf discovery, peer registration, health checks and failover.
- Virtual Servers: Compose tools, prompts, and resources across multiple MCP servers; control tool visibility per server.
- Transports: SSE, WebSocket, stdio wrapper, and streamable HTTP endpoints.
- Copy
.env.example→.env; verify withmake check-env. Never commit secrets. - Auth: set
JWT_SECRET_KEY; exportMCPGATEWAY_BEARER_TOKENusing the token utility for API calls. - Wrapper: set
MCP_SERVER_URLandMCP_AUTHwhen usingmcpgateway.wrapper. - TLS:
make certs→make serve-ssl. Prefer environment variables for config; seeREADME.md.