forked from IBM/mcp-context-forge
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpyproject.toml
More file actions
544 lines (489 loc) · 17.3 KB
/
pyproject.toml
File metadata and controls
544 lines (489 loc) · 17.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
# ----------------------------------------------------------------
# 💡 Build system (PEP 517)
# - setuptools ≥ 77 gives SPDX licence support (PEP 639)
# - wheel is needed by most build front-ends
# ----------------------------------------------------------------
[build-system]
requires = ["setuptools>=77", "wheel"]
build-backend = "setuptools.build_meta"
# ----------------------------------------------------------------
# 📦 Core project metadata (PEP 621)
# ----------------------------------------------------------------
[project]
name = "mcp-contextforge-gateway"
version = "0.7.0"
description = "A production-grade MCP Gateway & Proxy built with FastAPI. Supports multi-server registration, virtual server composition, authentication, retry logic, observability, protocol translation, and a unified federated tool catalog."
keywords = ["MCP","API","gateway","proxy","tools",
"agents","agentic ai","model context protocol","multi-agent","fastapi",
"json-rpc","sse","websocket","federation","security","authentication"
]
classifiers = [
"Development Status :: 4 - Beta",
"Intended Audience :: Developers",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Framework :: FastAPI",
"Framework :: AsyncIO",
"Topic :: Internet :: WWW/HTTP :: WSGI :: Application",
"Topic :: Software Development :: Libraries :: Application Frameworks"
]
readme = "README.md"
requires-python = ">=3.11,<3.14"
# SPDX licence expression + explicit licence file (PEP 639)
license = "Apache-2.0"
license-files = ["LICENSE"]
# Maintainers
maintainers = [
{name = "Mihai Criveti", email = "redacted@ibm.com"}
]
# ----------------------------------------------------------------
# Runtime dependencies
# ----------------------------------------------------------------
dependencies = [
"aiohttp>=3.12.15",
"alembic>=1.16.5",
"argon2-cffi>=25.1.0",
"copier>=9.10.2",
"cryptography>=45.0.7",
"fastapi>=0.116.1",
"filelock>=3.19.1",
"gunicorn>=23.0.0",
"httpx>=0.28.1",
"httpx[http2]>=0.28.1",
"jinja2>=3.1.6",
"jq>=1.10.0",
"jsonpath-ng>=1.7.0",
"jsonschema>=4.25.1",
"mcp>=1.14.0",
"oauthlib>=3.3.1",
"parse>=1.20.2",
"psutil>=7.0.0",
"pydantic>=2.11.9",
"pydantic[email]>=2.11.9",
"pydantic-settings>=2.10.1",
"pyjwt>=2.10.1",
"python-json-logger>=3.3.0",
"PyYAML>=6.0.2",
"requests-oauthlib>=2.0.0",
"sqlalchemy>=2.0.43",
"sse-starlette>=3.0.2",
"starlette>=0.47.3,<0.48.0",
"typer>=0.17.4",
"uvicorn>=0.35.0",
"zeroconf>=0.147.2",
]
# ----------------------------------------------------------------
# Optional dependency groups (extras)
# ----------------------------------------------------------------
[project.optional-dependencies]
# Optional dependency groups (runtime)
redis = [
"redis>=6.4.0",
]
postgres = [
"psycopg2-binary>=2.9.10",
]
mysql = [
"pymysql>=1.1.2",
]
# Fuzzing and property-based testing
fuzz = [
"hypothesis>=6.138.16",
"pytest-benchmark>=5.1.0",
"pytest-xdist>=3.8.0",
"schemathesis>=4.1.4",
]
# Coverage-guided fuzzing (requires clang/libfuzzer)
fuzz-atheris = [
"atheris>=2.3.0",
]
alembic = [
"alembic>=1.16.5",
]
# Observability dependencies (optional)
observability = [
"opentelemetry-api>=1.37.0",
"opentelemetry-exporter-otlp>=1.37.0",
"opentelemetry-exporter-otlp-proto-grpc>=1.37.0",
"opentelemetry-sdk>=1.37.0",
]
# Additional observability backends (optional)
observability-jaeger = [
"opentelemetry-exporter-jaeger>=1.21.0",
]
observability-zipkin = [
"opentelemetry-exporter-zipkin>=1.37.0",
]
observability-all = [
"mcp-contextforge-gateway[observability]>=0.6.0",
"opentelemetry-exporter-jaeger>=1.21.0",
"opentelemetry-exporter-zipkin>=1.37.0",
]
# Async SQLite Driver (optional)
aiosqlite = [
"aiosqlite>=0.21.0",
]
# Async PostgreSQL driver (optional)
asyncpg = [
"asyncpg>=0.30.0",
]
# Chuck/Chuk MCP Runtime (optional) - External plugin server runtime
# Provides MCP tool decorators, plugin hooks, and multi-transport server support
# Used by: mcpgateway/plugins/framework/external/mcp/server/runtime.py
# Required only if you plan to create external MCP plugin servers
chuck = [
"chuk-mcp-runtime>=0.6.5",
]
# Optional dependency groups (development)
dev = [
"aiohttp>=3.12.15",
"argparse-manpage>=4.7",
"autoflake>=2.3.1",
"bandit>=1.8.6",
"black>=25.1.0",
"bump2version>=1.0.1",
"check-manifest>=0.50",
"chuk-mcp-runtime>=0.6.5",
"code2flow>=2.5.1",
"cookiecutter>=2.6.0",
"coverage>=7.10.6",
"coverage-badge>=1.1.2",
"darglint>=1.8.1",
"dlint>=0.16.0",
"dodgy>=0.2.1",
"fawltydeps>=0.20.0",
"flake8>=7.3.0",
"gprof2dot>=2025.4.14",
"importchecker>=3.0",
"interrogate>=1.7.0",
"isort>=6.0.1",
"mypy>=1.18.1",
"pexpect>=4.9.0",
"pip-licenses>=5.0.0",
"pip_audit>=2.9.0",
"pre-commit>=4.3.0",
"prospector[with_everything]>=1.17.3",
"pydocstyle>=6.3.0",
"pylint>=3.3.8",
"pylint-pydantic>=0.3.5",
"pyre-check>=0.9.25",
"pyrefly>=0.32.0",
"pyright>=1.1.405",
"pyroma>=5.0",
"pyspelling>=2.11",
"pytest>=8.4.2",
"pytest-asyncio>=1.2.0",
"pytest-cov>=7.0.0",
"pytest-env>=1.1.5",
"pytest-examples>=0.0.18",
"pytest-md-report>=0.7.0",
"pytest-rerunfailures>=16.0.1",
"pytest-trio>=0.8.0",
"pytest-xdist>=3.8.0",
"pytype>=2024.10.11",
"pyupgrade>=3.20.0",
"radon>=6.0.1",
"redis>=6.4.0",
"ruff>=0.13.0",
"semgrep>=1.136.0",
"settings-doc>=4.3.2",
"snakeviz>=2.2.2",
"tomlcheck>=0.2.3",
"tomlkit>=0.13.3",
"tox>=4.30.2",
"tox-uv>=1.28.0",
"twine>=6.2.0",
"ty>=0.0.1a20",
"types-tabulate>=0.9.0.20241207",
"unimport>=1.2.1",
"uv>=0.8.17",
"vulture>=2.14",
"websockets>=15.0.1",
"yamllint>=1.37.1",
]
# UI Testing
playwright = [
"playwright>=1.55.0",
"pytest-html>=4.1.1",
"pytest-playwright>=0.7.1",
"pytest-timeout>=2.4.0",
]
# Convenience meta-extras
all = [
"mcp-contextforge-gateway[redis]>=0.6.0",
]
dev-all = [
"mcp-contextforge-gateway[redis,dev]>=0.6.0",
]
# --------------------------------------------------------------------
# Authors and URLs
# --------------------------------------------------------------------
[[project.authors]]
name = "Mihai Criveti"
email = "redacted@ibm.com"
[project.urls]
Homepage = "https://ibm.github.io/mcp-context-forge/"
Documentation = "https://ibm.github.io/mcp-context-forge/"
Repository = "https://github.com/IBM/mcp-context-forge"
"Bug Tracker" = "https://github.com/IBM/mcp-context-forge/issues"
Changelog = "https://github.com/IBM/mcp-context-forge/blob/main/CHANGELOG.md"
# --------------------------------------------------------------------
# 💻 Project scripts (cli entrypoint)
# --------------------------------------------------------------------
[project.scripts]
mcpgateway = "mcpgateway.cli:main"
mcpplugins = "mcpgateway.plugins.tools.cli:main"
# --------------------------------------------------------------------
# 🔧 setuptools-specific configuration
# --------------------------------------------------------------------
[tool.setuptools]
include-package-data = true # ensure wheels include the data files
# Automatic discovery: keep every package that starts with "mcpgateway"
[tool.setuptools.packages.find]
include = ["mcpgateway*"]
exclude = ["tests*"]
## Runtime data files ------------------------------------------------
# - py.typed -> advertises inline type hints (PEP 561)
# - static/* -> CSS/JS for the admin UI
# - templates -> Jinja2 templates shipped at runtime
[tool.setuptools.package-data]
mcpgateway = [
"py.typed",
"static/*.css",
"static/*.js",
"templates/*.html",
"alembic.ini",
"alembic/*.py",
"alembic/*.mako",
"alembic/*.md",
"alembic/versions/*.py",
]
# --------------------------------------------------------------------
# 🛠 Tool configurations (black, mypy, etc.)
# --------------------------------------------------------------------
[tool.pytype]
# Directory-specific options:
inputs = ["mcpgateway"]
python_version = "3.11" # match default runtime
[tool.check-manifest]
ignore = [
"docs/**",
"tests/**",
".github/**",
"Makefile",
]
[tool.black]
line-length = 200
target-version = ["py310", "py311", "py312"]
include = "\\.pyi?$"
# isort configuration
# --------------------------------------------------------------------
# 🛠 Async tool configurations (async-test, async-lint, etc.)
# --------------------------------------------------------------------
[tool.ruff]
select = ["F", "E", "W", "B", "ASYNC"]
unfixable = ["B"] # Never auto-fix critical bugbear warnings
[tool.ruff.flake8-bugbear]
extend-immutable-calls = ["fastapi.Depends", "fastapi.Query"]
[[tool.mypy.overrides]]
module = "tests.*"
disallow_untyped_defs = false
[tool.isort]
###############################################################################
# Core behaviour
###############################################################################
profile = "black" # inherit Black's own import-sorting profile
line_length = 200 # match Black's custom line length
multi_line_output = 3 # vertical-hanging-indent style
include_trailing_comma = true # keep trailing commas for Black
from_first = true # place all "from ... import ..." before plain "import ..."
###############################################################################
# Section ordering & headings
###############################################################################
sections = ["FUTURE", "STDLIB", "THIRDPARTY", "FIRSTPARTY", "LOCALFOLDER"]
import_heading_future = "Future" # header above FUTURE imports (if headings enabled)
import_heading_stdlib = "Standard" # header for built-in Stdlib imports
import_heading_thirdparty = "Third-Party" # header for pip-installed packages
import_heading_firstparty = "First-Party" # header for internal 'mcpgateway' code
import_heading_localfolder = "Local" # header for ad-hoc scripts / tests
###############################################################################
# What belongs where
###############################################################################
known_first_party = ["mcpgateway"] # treat "mcpgateway.*" as FIRSTPARTY
known_local_folder = ["tests", "scripts"] # treat these folders as LOCALFOLDER
known_third_party = ["alembic"] # treat "alembic" as THIRDPARTY
# src_paths = ["src/mcpgateway"] # uncomment only if package moves under src/
###############################################################################
# Style niceties
###############################################################################
force_sort_within_sections = true # always alphabetise names inside each block
order_by_type = false # don't group imports by "type vs. straight name"
balanced_wrapping = true # spread wrapped imports evenly between lines
lines_between_sections = 1 # exactly one blank line between the five groups
lines_between_types = 1 # one blank line between 'import X' and 'from X import ...'
no_lines_before = ["LOCALFOLDER"] # suppress blank line *before* the LOCALFOLDER block
ensure_newline_before_comments = true # newline before any inline # comment after an import
###############################################################################
# Ignore junk we never want to touch
###############################################################################
extend_skip = [
".md", ".json", ".yaml", ".yml",
"dist", "build", ".venv", ".tox",
"*.tmp", "*.bak",
]
skip_glob = ["**/__init__.py"] # leave namespace init files alone
# ---- Optional CI toggles ----------------------------------------------------
# check_only = true # dry-run mode: non-zero exit if files would change
# verbose = true # print every file name processed
# case_sensitive = true # treat upper/lowercase differences as significant
[tool.mypy]
# Target Python version
python_version = "3.11"
# Full strictness and individual checks
strict = true # Enable all strict checks
check_untyped_defs = true # Type-check the bodies of untyped functions
no_implicit_optional = true # Require explicit Optional for None default
disallow_untyped_defs = true # Require type annotations for all functions
disallow_untyped_calls = true # Disallow calling functions without type info
disallow_any_unimported = true # Disallow Any from missing imports
warn_return_any = true # Warn if a function returns Any
warn_unreachable = true # Warn about unreachable code
warn_unused_ignores = true # Warn if a "# type: ignore" is unnecessary
warn_unused_configs = true # Warn about unused config options
warn_redundant_casts = true # Warn if a cast does nothing
warn_unused_coroutine = true # Warn if an unused async coroutine is defined
strict_equality = true # Disallow ==/!= between incompatible types
# Output formatting
show_error_codes = true # Show error codes in output
pretty = true # Format output nicely
# Exclude these paths from analysis
exclude = [
'^build/',
'^\\.venv/',
'^\\.mypy_cache/',
]
# Plugins to use with mypy
plugins = ["pydantic.mypy"] # Enable mypy plugin for Pydantic models
[tool.pytest.ini_options]
minversion = "6.0"
addopts = "-ra -q --cov=mcpgateway --ignore=tests/playwright --ignore=tests/migration"
testpaths = [ "tests",]
asyncio_mode = "auto"
filterwarnings = [
"ignore:Passing 'msg' argument to .*\\.cancel\\(\\) is deprecated:DeprecationWarning", # From 3rd party libraries
]
# Set environment variables for all tests
env = [
"MCPGATEWAY_ADMIN_API_ENABLED=true",
"MCPGATEWAY_UI_ENABLED=true",
"DATABASE_URL=sqlite:///:memory:",
"TEST_DATABASE_URL=sqlite:///:memory:"
]
# ===== PLAYWRIGHT-SPECIFIC CONFIGURATIONS =====
# Pytest test markers
markers = [
"slow: marks tests as slow (deselect with '-m \"not slow\"')",
"ui: marks tests as UI tests",
"api: marks tests as API tests",
"smoke: marks tests as smoke tests for quick validation",
"e2e: marks tests as end-to-end tests",
"fuzz: marks tests as fuzz tests (excluded from main test suite)",
"benchmark: marks tests as performance benchmarks (migration testing)",
]
# Playwright-specific test discovery patterns
python_files = ["test_*.py", "*_test.py"]
python_classes = ["Test*"]
python_functions = ["test_*"]
# Playwright browser configuration (can be overridden via CLI)
# These are custom options that your conftest.py can read
# playwright_browser = "chromium" # default browser
# playwright_headed = false # run headless by default
# playwright_slow_mo = 0 # milliseconds delay between actions
# playwright_screenshot = "only-on-failure"
# playwright_video = "retain-on-failure"
# playwright_trace = "retain-on-failure"
# ── fawltydeps ─────────────────────────────────────────────────────
[tool.fawltydeps]
# only parse main pyproject.toml
deps = ["pyproject.toml"]
# ignore 'dev' extras so they won't show up in fawltydeps
ignore_unused = [
"autoflake",
"argparse-manpage",
"bandit",
"black",
"bump2version",
"check-manifest",
"code2flow",
"cookiecutter",
"coverage",
"coverage-badge",
"darglint",
"flake8",
"fawltydeps",
"gprof2dot",
"gunicorn",
"importchecker",
"isort",
"ty",
"tomlcheck",
"mypy",
"pexpect",
"pip-licenses",
"pip_audit",
"pre-commit",
"pydocstyle",
"pylint",
"pylint-pydantic",
"pyre-check",
"pyright",
"pyroma",
"pyspelling",
"pytest",
"pytest-asyncio",
"pytest-cov",
"pytest-examples",
"pytest-md-report",
"pytest-rerunfailures",
"pytest-xdist",
"pytype",
"radon",
"ruff",
"settings-doc",
"snakeviz",
"types-tabulate",
"twine",
"uvicorn"
]
# --------------------------------------------------------------------
# 🛠 https://github.com/facebook/pyrefly (replaces pyre)
# --------------------------------------------------------------------
[tool.pyrefly]
project-excludes = [
"**/build/",
'**/\.venv/',
'**/\.mypy_cache/',
]
python-version = "3.11.0"
# --------------------------------------------------------------------
# 🧬 mutmut - Mutation testing configuration
# --------------------------------------------------------------------
[tool.mutmut]
paths_to_mutate = ["mcpgateway/"]
tests_dir = ["tests/"]
do_not_mutate = ["mcpgateway/services/gateway_service.py"]
also_copy = ["plugins/", "pyproject.toml", "mutmut_config.py"]
# --------------------------------------------------------------------
# 📊 coverage - Code coverage configuration
# --------------------------------------------------------------------
[tool.coverage.run]
source = ["mcpgateway"]
omit = [
"*/tests/*",
"*/test_*.py",
"*/__init__.py",
"*/alembic/*",
"*/version.py"
]