mcp-common 0.4.9__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (87) hide show
  1. mcp_common-0.4.9/.github/FUNDING.yml +1 -0
  2. mcp_common-0.4.9/.gitignore +158 -0
  3. mcp_common-0.4.9/AGENTS.md +31 -0
  4. mcp_common-0.4.9/CHANGELOG.md +158 -0
  5. mcp_common-0.4.9/CLAUDE.md +629 -0
  6. mcp_common-0.4.9/LICENSE +28 -0
  7. mcp_common-0.4.9/PKG-INFO +733 -0
  8. mcp_common-0.4.9/README.md +701 -0
  9. mcp_common-0.4.9/RULES.md +380 -0
  10. mcp_common-0.4.9/complexipy.json +380 -0
  11. mcp_common-0.4.9/docs/MCP_SERVER_MIGRATION_SUMMARY.md +386 -0
  12. mcp_common-0.4.9/docs/MIGRATION_COMPLETE_SUMMARY.md +315 -0
  13. mcp_common-0.4.9/docs/ONEIRIC_CLI_AUDIT_RESPONSE.md +763 -0
  14. mcp_common-0.4.9/docs/ONEIRIC_CLI_FACTORY_IMPLEMENTATION.md +1739 -0
  15. mcp_common-0.4.9/docs/ONEIRIC_CLI_FACTORY_PLAN.md +85 -0
  16. mcp_common-0.4.9/docs/ONEIRIC_CLI_FACTORY_SPEC_REVIEW.md +972 -0
  17. mcp_common-0.4.9/docs/PHASE1_COMPLETE_SUMMARY.md +299 -0
  18. mcp_common-0.4.9/docs/SECURITY_IMPLEMENTATION.md +531 -0
  19. mcp_common-0.4.9/docs/SERVER_INTEGRATION.md +789 -0
  20. mcp_common-0.4.9/docs/reference/COVERAGE_POLICY.md +16 -0
  21. mcp_common-0.4.9/examples/README.md +531 -0
  22. mcp_common-0.4.9/examples/cli_server.py +236 -0
  23. mcp_common-0.4.9/examples/settings/example-server.yaml +17 -0
  24. mcp_common-0.4.9/examples/settings/weather.yaml +26 -0
  25. mcp_common-0.4.9/examples/weather_server.py +267 -0
  26. mcp_common-0.4.9/mcp_common/.skylos/cache.sqlite +0 -0
  27. mcp_common-0.4.9/mcp_common/README.md +36 -0
  28. mcp_common-0.4.9/mcp_common/__init__.py +70 -0
  29. mcp_common-0.4.9/mcp_common/cli/__init__.py +43 -0
  30. mcp_common-0.4.9/mcp_common/cli/factory.py +800 -0
  31. mcp_common-0.4.9/mcp_common/cli/health.py +201 -0
  32. mcp_common-0.4.9/mcp_common/cli/security.py +206 -0
  33. mcp_common-0.4.9/mcp_common/cli/settings.py +169 -0
  34. mcp_common-0.4.9/mcp_common/cli/signals.py +86 -0
  35. mcp_common-0.4.9/mcp_common/config/README.md +30 -0
  36. mcp_common-0.4.9/mcp_common/config/__init__.py +11 -0
  37. mcp_common-0.4.9/mcp_common/config/base.py +473 -0
  38. mcp_common-0.4.9/mcp_common/config/validation_mixin.py +273 -0
  39. mcp_common-0.4.9/mcp_common/exceptions.py +238 -0
  40. mcp_common-0.4.9/mcp_common/health.py +203 -0
  41. mcp_common-0.4.9/mcp_common/interfaces/__init__.py +139 -0
  42. mcp_common-0.4.9/mcp_common/py.typed +0 -0
  43. mcp_common-0.4.9/mcp_common/schemas/__init__.py +194 -0
  44. mcp_common-0.4.9/mcp_common/security/README.md +12 -0
  45. mcp_common-0.4.9/mcp_common/security/__init__.py +23 -0
  46. mcp_common-0.4.9/mcp_common/security/api_keys.py +351 -0
  47. mcp_common-0.4.9/mcp_common/security/sanitization.py +307 -0
  48. mcp_common-0.4.9/mcp_common/server/__init__.py +47 -0
  49. mcp_common-0.4.9/mcp_common/server/availability.py +101 -0
  50. mcp_common-0.4.9/mcp_common/server/base.py +313 -0
  51. mcp_common-0.4.9/mcp_common/server/runtime.py +163 -0
  52. mcp_common-0.4.9/mcp_common/ui/README.md +13 -0
  53. mcp_common-0.4.9/mcp_common/ui/__init__.py +10 -0
  54. mcp_common-0.4.9/mcp_common/ui/panels.py +552 -0
  55. mcp_common-0.4.9/mcp_common/validation/__init__.py +155 -0
  56. mcp_common-0.4.9/mypy.ini +23 -0
  57. mcp_common-0.4.9/pyproject.toml +218 -0
  58. mcp_common-0.4.9/tests/__init__.py +1 -0
  59. mcp_common-0.4.9/tests/cli/__init__.py +1 -0
  60. mcp_common-0.4.9/tests/cli/test_factory.py +467 -0
  61. mcp_common-0.4.9/tests/cli/test_factory_branches.py +593 -0
  62. mcp_common-0.4.9/tests/cli/test_health.py +493 -0
  63. mcp_common-0.4.9/tests/cli/test_security.py +435 -0
  64. mcp_common-0.4.9/tests/cli/test_security_atomic_write.py +37 -0
  65. mcp_common-0.4.9/tests/cli/test_settings.py +309 -0
  66. mcp_common-0.4.9/tests/cli/test_signals.py +83 -0
  67. mcp_common-0.4.9/tests/cli/test_smoke.py +205 -0
  68. mcp_common-0.4.9/tests/conftest.py +58 -0
  69. mcp_common-0.4.9/tests/server/__init__.py +1 -0
  70. mcp_common-0.4.9/tests/server/test_availability.py +260 -0
  71. mcp_common-0.4.9/tests/server/test_base.py +354 -0
  72. mcp_common-0.4.9/tests/server/test_runtime.py +230 -0
  73. mcp_common-0.4.9/tests/test_config.py +359 -0
  74. mcp_common-0.4.9/tests/test_config_layering.py +77 -0
  75. mcp_common-0.4.9/tests/test_config_security.py +464 -0
  76. mcp_common-0.4.9/tests/test_config_security_fallback.py +51 -0
  77. mcp_common-0.4.9/tests/test_config_validation_mixin.py +443 -0
  78. mcp_common-0.4.9/tests/test_exceptions.py +56 -0
  79. mcp_common-0.4.9/tests/test_health.py +362 -0
  80. mcp_common-0.4.9/tests/test_interfaces.py +160 -0
  81. mcp_common-0.4.9/tests/test_schemas.py +165 -0
  82. mcp_common-0.4.9/tests/test_security_api_keys.py +433 -0
  83. mcp_common-0.4.9/tests/test_security_sanitization.py +464 -0
  84. mcp_common-0.4.9/tests/test_ui_panels.py +615 -0
  85. mcp_common-0.4.9/tests/test_validation.py +220 -0
  86. mcp_common-0.4.9/tests/test_version.py +8 -0
  87. mcp_common-0.4.9/uv.lock +4432 -0
@@ -0,0 +1 @@
1
+ github: [lesleslie]
@@ -0,0 +1,158 @@
1
+ # Python
2
+ __pycache__/
3
+ *.py[cod]
4
+ *$py.class
5
+ *.so
6
+ .Python
7
+ build/
8
+ develop-eggs/
9
+ dist/
10
+ downloads/
11
+ eggs/
12
+ .eggs/
13
+ lib/
14
+ lib64/
15
+ parts/
16
+ sdist/
17
+ var/
18
+ wheels/
19
+ *.egg-info/
20
+ .installed.cfg
21
+ *.egg
22
+ MANIFEST
23
+
24
+ # Virtual environments
25
+ venv/
26
+ ENV/
27
+ env/
28
+ .venv/
29
+
30
+ # Testing
31
+ .pytest_cache/
32
+ .coverage
33
+ .coverage.*
34
+ htmlcov/
35
+ .tox/
36
+ .nox/
37
+ coverage.xml
38
+ *.cover
39
+ .hypothesis/
40
+
41
+ # Type checking
42
+ .mypy_cache/
43
+ .dmypy.json
44
+ dmypy.json
45
+ .pytype/
46
+
47
+ # IDEs
48
+ .vscode/
49
+ .idea/
50
+ *.swp
51
+ *.swo
52
+ *~
53
+ .DS_Store
54
+
55
+ # Ruff
56
+ .ruff_cache/
57
+
58
+ # Environment
59
+ .env
60
+ .env.local
61
+ .env.*.local
62
+
63
+ # Documentation builds
64
+ docs/_build/
65
+ site/
66
+
67
+ # Hatch
68
+ .hatch/
69
+ /.benchmarks/
70
+ /.claude/
71
+ /.envrc
72
+ /.mcp.json
73
+ /.crackerjack/
74
+ /coverage.json
75
+ /.complexipy_cache/
76
+ /.jbeval/
77
+ /NOTES.md
78
+ /.oneiric_cache/
79
+
80
+ # Crackerjack patterns
81
+
82
+
83
+
84
+
85
+ # Build/Distribution
86
+ # Caches
87
+ # Coverage
88
+ # Crackerjack specific
89
+ # Development
90
+ *$py.class
91
+ *.cover
92
+ *.egg
93
+ *.egg-info/
94
+ *.py[cod]
95
+ *.pyc
96
+ *.so
97
+ *.swo
98
+ *.swp
99
+ *~
100
+ .DS_STORE
101
+ .DS_Store
102
+ .Python
103
+ .coverage
104
+ .coverage*
105
+ .coverage.*
106
+ .crackerjack-*
107
+ .dmypy.json
108
+ .eggs/
109
+ .env
110
+ .env.*.local
111
+ .env.local
112
+ .hatch/
113
+ .hypothesis/
114
+ .idea/
115
+ .installed.cfg
116
+ .mypy_cache/
117
+ .nox/
118
+ .pytest_cache/
119
+ .pytype/
120
+ .ruff_cache/
121
+ .tox/
122
+ .venv/
123
+ .vscode/
124
+ /.benchmarks/
125
+ /.claude/
126
+ /.complexipy_cache/
127
+ /.crackerjack/
128
+ /.envrc
129
+ /.jbeval/
130
+ /.mcp.json
131
+ /.oneiric_cache/
132
+ /NOTES.md
133
+ /build/
134
+ /coverage.json
135
+ /dist/
136
+ ENV/
137
+ MANIFEST
138
+ __pycache__/
139
+ build/
140
+ coverage.xml
141
+ crackerjack-ai-debug-*.log
142
+ crackerjack-debug-*.log
143
+ develop-eggs/
144
+ dist/
145
+ dmypy.json
146
+ docs/_build/
147
+ downloads/
148
+ eggs/
149
+ env/
150
+ htmlcov/
151
+ lib/
152
+ lib64/
153
+ parts/
154
+ sdist/
155
+ site/
156
+ var/
157
+ venv/
158
+ wheels/
@@ -0,0 +1,31 @@
1
+ # Repository Guidelines
2
+
3
+ ## Project Structure & Module Organization
4
+
5
+ The production code lives under `mcp_common/` with subpackages for `adapters`, `config`, `security`, `ui`, and `cli`. Shared type hints ship via `py.typed`. Tests sit in `tests/`, mixing unit coverage (`test_http_client.py`, `test_config_*`) with scenario suites such as `tests/performance/`. Example servers for manual validation are under `examples/`, while architecture notes and implementation guides live in `docs/`. Build artifacts (`dist/`, `htmlcov/`) should stay out of PRs.
6
+
7
+ ## Build, Test, and Development Commands
8
+
9
+ Install dev tooling with `uv pip install -e ".[dev]"` to match the lockfile. Key commands (run with `uv run`):
10
+
11
+ - `pytest --cov=mcp_common --cov-report=html` for the full test matrix.
12
+ - `ruff check` and `ruff format` for linting and auto-format.
13
+ - `mypy mcp_common tests` for static typing.
14
+ - `crackerjack --all` to execute the quality gate used in CI.
15
+ Use `uv run pre-commit run --all-files` before pushing; hooks invoke bandit, codespell, and other safety nets.
16
+
17
+ ## Coding Style & Naming Conventions
18
+
19
+ Follow PEP 8 with 4-space indents and 100-character line limits (configured in Ruff). Prefer explicit type hints and async-first patterns; new adapters should follow the Oneiric pattern with direct instantiation and lifecycle methods. Modules and packages use snake_case; classes stick to PascalCase; async tools keep `*_tool` or `_adapter` suffixes for clarity. Use global instance patterns with proper initialization in `main()`.
20
+
21
+ ## Testing Guidelines
22
+
23
+ Pytest powers the suite; name files `test_*.py` and async tests `async def test_*`. Maintain ≥90% coverage, extending fixtures in `tests/conftest.py` when possible. For performance-sensitive features, mirror the structure in `tests/performance/`. Generate local coverage reports with `uv run pytest --cov ...` and ensure Rich UI assertions remain stable by using the helper utilities in `tests/test_ui_panels.py`.
24
+
25
+ ## Commit & Pull Request Guidelines
26
+
27
+ Commit history follows Conventional Commits (e.g., `feat: add redis adapter`, `fix(test): adjust rate limit assertion`). Each PR should describe scope, link relevant issues, list new adapters/settings, and note test commands executed. Include screenshots or terminal captures when UI panels change. Verify pre-commit hooks pass before requesting review.
28
+
29
+ ## Security & Configuration Notes
30
+
31
+ Guard secrets by using MCPBaseSettings with YAML + environment variables—never hard-code keys. Validate new regexes with `uv run python -m crackerjack.tools.validate_regex_patterns`. Update `docs/` when configuration surfaces change so downstream MCP servers stay in sync.
@@ -0,0 +1,158 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [0.4.9] - 2026-01-21
9
+
10
+ ### Changed
11
+
12
+ - Update config, core, deps, docs, tests
13
+
14
+ ## [0.4.8] - 2026-01-05
15
+
16
+ ### Changed
17
+
18
+ - Update dependencies
19
+
20
+ ## [0.4.7] - 2026-01-05
21
+
22
+ ### Changed
23
+
24
+ - Update core, deps
25
+
26
+ ## [0.4.6] - 2026-01-03
27
+
28
+ ### Changed
29
+
30
+ - Update core, deps, tests
31
+
32
+ ## [0.4.5] - 2026-01-03
33
+
34
+ ### Changed
35
+
36
+ - Update deps, docs
37
+
38
+ ### Fixed
39
+
40
+ - Resolve all ruff violations for crackerjack compliance
41
+
42
+ ### Internal
43
+
44
+ - Session checkpoint - Phase 3 migration complete
45
+ - Session cleanup - optimize repository after Phase 3 migration
46
+
47
+ ## [0.4.4] - 2026-01-02
48
+
49
+ ### Added
50
+
51
+ #### New Server Module (`mcp_common/server/`)
52
+
53
+ - `BaseOneiricServerMixin` - Reusable server lifecycle methods with template pattern
54
+ - `_init_runtime_components()` - Initialize Oneiric runtime components
55
+ - `_create_startup_snapshot()` - Create server startup snapshots
56
+ - `_create_shutdown_snapshot()` - Create server shutdown snapshots
57
+ - `_build_health_components()` - Build health check components
58
+ - `_extract_config_snapshot()` - Extract config for snapshots
59
+ - `check_serverpanels_available()` - Check if mcp_common.ui module exists
60
+ - `check_security_available()` - Check if mcp_common.security module exists
61
+ - `check_rate_limiting_available()` - Check if FastMCP rate limiting exists
62
+ - `get_availability_status()` - Get all dependency statuses as dict
63
+ - `create_runtime_components()` - Factory for Oneiric runtime initialization
64
+ - All availability functions cached with `@lru_cache` for performance
65
+
66
+ #### CLI Factory Enhancements
67
+
68
+ - `MCPServerCLIFactory.create_server_cli()` - Support server_class pattern
69
+ - Bridges gap between handler and server_class patterns
70
+ - Enables all MCP servers to use production-ready factory
71
+ - Maintains backward compatibility with existing handler pattern
72
+
73
+ #### Documentation
74
+
75
+ - `docs/SERVER_INTEGRATION.md` - Comprehensive integration and migration guide
76
+ - Architecture patterns (server class vs handler functions)
77
+ - Migration guide from oneiric.core.cli
78
+ - Before/after code examples showing 100+ line savings per server
79
+ - Complete usage examples and best practices
80
+ - `docs/PHASE1_COMPLETE_SUMMARY.md` - Detailed Phase 1 completion summary
81
+
82
+ #### Testing
83
+
84
+ - 35 new tests for server module (all passing, 100% pass rate)
85
+ - 97.83% coverage on base.py
86
+ - 91.30% coverage on runtime.py
87
+ - 77.78% coverage on availability.py
88
+ - Integration tests with actual Oneiric runtime components
89
+
90
+ ### Changed
91
+
92
+ - Enhanced CLI factory to support both handler and server_class patterns
93
+ - Improved documentation structure with integration guides
94
+
95
+ ### Deprecated
96
+
97
+ - `oneiric.core.cli.MCPServerCLIFactory` - Use `mcp_common.cli.MCPServerCLIFactory.create_server_cli()` instead
98
+
99
+ ## [0.4.1] - 2025-12-27
100
+
101
+ ### Changed
102
+
103
+ - Update config, core, deps, docs, tests
104
+
105
+ ## [0.4.0] - 2025-12-27
106
+
107
+ ### Changed
108
+
109
+ - Update config, core, deps, docs, tests
110
+
111
+ ## [0.3.6] - 2025-12-22
112
+
113
+ ### Changed
114
+
115
+ - Update config, deps, docs
116
+
117
+ ## [0.3.5] - 2025-12-20
118
+
119
+ ### Changed
120
+
121
+ - Update config, deps, docs
122
+
123
+ ## [0.3.4] - 2025-12-20
124
+
125
+ ### Changed
126
+
127
+ - Update config, deps, docs, tests
128
+
129
+ ## [0.3.3] - 2025-11-17
130
+
131
+ ### Changed
132
+
133
+ - Mcp-common (quality: 68/100) - 2025-11-05 15:15:47
134
+ - Mcp-common (quality: 68/100) - 2025-11-09 03:08:23
135
+ - Update config, deps, docs, tests
136
+
137
+ ### Documentation
138
+
139
+ - config: Update CHANGELOG, pyproject, uv
140
+
141
+ ## [0.3.2] - 2025-11-05
142
+
143
+ ### Documentation
144
+
145
+ - config: Update CHANGELOG, pyproject, uv
146
+
147
+ ## [0.3.1] - 2025-10-31
148
+
149
+ ### Fixed
150
+
151
+ - test: Update 66 files
152
+
153
+ ## [0.3.0] - 2025-10-31
154
+
155
+ ### Fixed
156
+
157
+ - Fix ruff check issues and improve code quality
158
+ - test: Update 36 files