guard-core-mcp 0.0.1__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.
@@ -0,0 +1,218 @@
1
+ # Byte-compiled / optimized / DLL files
2
+ __pycache__/
3
+ *.py[codz]
4
+ *$py.class
5
+
6
+ # C extensions
7
+ *.so
8
+
9
+ # Distribution / packaging
10
+ .Python
11
+ build/
12
+ develop-eggs/
13
+ dist/
14
+ downloads/
15
+ eggs/
16
+ .eggs/
17
+ lib/
18
+ lib64/
19
+ parts/
20
+ sdist/
21
+ var/
22
+ wheels/
23
+ share/python-wheels/
24
+ *.egg-info/
25
+ .installed.cfg
26
+ *.egg
27
+ MANIFEST
28
+
29
+ # PyInstaller
30
+ # Usually these files are written by a python script from a template
31
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
32
+ *.manifest
33
+ *.spec
34
+
35
+ # Installer logs
36
+ pip-log.txt
37
+ pip-delete-this-directory.txt
38
+
39
+ # Unit test / coverage reports
40
+ htmlcov/
41
+ .tox/
42
+ .nox/
43
+ .coverage
44
+ .coverage.*
45
+ .cache
46
+ nosetests.xml
47
+ coverage.xml
48
+ *.cover
49
+ *.py.cover
50
+ .hypothesis/
51
+ .pytest_cache/
52
+ cover/
53
+
54
+ # Translations
55
+ *.mo
56
+ *.pot
57
+
58
+ # Django stuff:
59
+ *.log
60
+ local_settings.py
61
+ db.sqlite3
62
+ db.sqlite3-journal
63
+
64
+ # Flask stuff:
65
+ instance/
66
+ .webassets-cache
67
+
68
+ # Scrapy stuff:
69
+ .scrapy
70
+
71
+ # Sphinx documentation
72
+ docs/_build/
73
+
74
+ # PyBuilder
75
+ .pybuilder/
76
+ target/
77
+
78
+ # Jupyter Notebook
79
+ .ipynb_checkpoints
80
+
81
+ # IPython
82
+ profile_default/
83
+ ipython_config.py
84
+
85
+ # pyenv
86
+ # For a library or package, you might want to ignore these files since the code is
87
+ # intended to run in multiple environments; otherwise, check them in:
88
+ # .python-version
89
+
90
+ # pipenv
91
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
92
+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
93
+ # having no cross-platform support, pipenv may install dependencies that don't work, or not
94
+ # install all needed dependencies.
95
+ # Pipfile.lock
96
+
97
+ # UV
98
+ # Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
99
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
100
+ # commonly ignored for libraries.
101
+ # uv.lock
102
+
103
+ # poetry
104
+ # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
105
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
106
+ # commonly ignored for libraries.
107
+ # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
108
+ # poetry.lock
109
+ # poetry.toml
110
+
111
+ # pdm
112
+ # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
113
+ # pdm recommends including project-wide configuration in pdm.toml, but excluding .pdm-python.
114
+ # https://pdm-project.org/en/latest/usage/project/#working-with-version-control
115
+ # pdm.lock
116
+ # pdm.toml
117
+ .pdm-python
118
+ .pdm-build/
119
+
120
+ # pixi
121
+ # Similar to Pipfile.lock, it is generally recommended to include pixi.lock in version control.
122
+ # pixi.lock
123
+ # Pixi creates a virtual environment in the .pixi directory, just like venv module creates one
124
+ # in the .venv directory. It is recommended not to include this directory in version control.
125
+ .pixi
126
+
127
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
128
+ __pypackages__/
129
+
130
+ # Celery stuff
131
+ celerybeat-schedule
132
+ celerybeat.pid
133
+
134
+ # Redis
135
+ *.rdb
136
+ *.aof
137
+ *.pid
138
+
139
+ # RabbitMQ
140
+ mnesia/
141
+ rabbitmq/
142
+ rabbitmq-data/
143
+
144
+ # ActiveMQ
145
+ activemq-data/
146
+
147
+ # SageMath parsed files
148
+ *.sage.py
149
+
150
+ # Environments
151
+ .env
152
+ .envrc
153
+ .venv
154
+ env/
155
+ venv/
156
+ ENV/
157
+ env.bak/
158
+ venv.bak/
159
+
160
+ # Spyder project settings
161
+ .spyderproject
162
+ .spyproject
163
+
164
+ # Rope project settings
165
+ .ropeproject
166
+
167
+ # mkdocs documentation
168
+ /site
169
+
170
+ # mypy
171
+ .mypy_cache/
172
+ .dmypy.json
173
+ dmypy.json
174
+
175
+ # Pyre type checker
176
+ .pyre/
177
+
178
+ # pytype static type analyzer
179
+ .pytype/
180
+
181
+ # Cython debug symbols
182
+ cython_debug/
183
+
184
+ # PyCharm
185
+ # JetBrains specific template is maintained in a separate JetBrains.gitignore that can
186
+ # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
187
+ # and can be added to the global gitignore or merged into this file. For a more nuclear
188
+ # option (not recommended) you can uncomment the following to ignore the entire idea folder.
189
+ # .idea/
190
+
191
+ # Abstra
192
+ # Abstra is an AI-powered process automation framework.
193
+ # Ignore directories containing user credentials, local state, and settings.
194
+ # Learn more at https://abstra.io/docs
195
+ .abstra/
196
+
197
+ # Visual Studio Code
198
+ # Visual Studio Code specific template is maintained in a separate VisualStudioCode.gitignore
199
+ # that can be found at https://github.com/github/gitignore/blob/main/Global/VisualStudioCode.gitignore
200
+ # and can be added to the global gitignore or merged into this file. However, if you prefer,
201
+ # you could uncomment the following to ignore the entire vscode folder
202
+ # .vscode/
203
+ # Temporary file for partial code execution
204
+ tempCodeRunnerFile.py
205
+
206
+ # Ruff stuff:
207
+ .ruff_cache/
208
+
209
+ # PyPI configuration file
210
+ .pypirc
211
+
212
+ # Marimo
213
+ marimo/_static/
214
+ marimo/_lsp/
215
+ __marimo__/
216
+
217
+ # Streamlit
218
+ .streamlit/secrets.toml
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Renzo F
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,80 @@
1
+ Metadata-Version: 2.4
2
+ Name: guard-core-mcp
3
+ Version: 0.0.1
4
+ Summary: MCP server for the Guard ecosystem — config validation, docs search and live threat detection for fastapi-guard, guard-core and guard-agent.
5
+ Project-URL: Homepage, https://github.com/rennf93/guard-core-mcp
6
+ Author-email: Renzo Franceschini <rennf93@users.noreply.github.com>
7
+ License-Expression: MIT
8
+ License-File: LICENSE
9
+ Classifier: Development Status :: 3 - Alpha
10
+ Classifier: Intended Audience :: Developers
11
+ Classifier: Operating System :: OS Independent
12
+ Classifier: Programming Language :: Python :: 3
13
+ Classifier: Programming Language :: Python :: 3.10
14
+ Classifier: Programming Language :: Python :: 3.11
15
+ Classifier: Programming Language :: Python :: 3.12
16
+ Classifier: Programming Language :: Python :: 3.13
17
+ Classifier: Programming Language :: Python :: 3.14
18
+ Classifier: Topic :: Security
19
+ Requires-Python: <3.15,>=3.10
20
+ Requires-Dist: mcp
21
+ Provides-Extra: dev
22
+ Requires-Dist: fastapi-guard; extra == 'dev'
23
+ Requires-Dist: guard-agent; extra == 'dev'
24
+ Requires-Dist: guard-core; extra == 'dev'
25
+ Requires-Dist: mypy; extra == 'dev'
26
+ Requires-Dist: pytest; extra == 'dev'
27
+ Requires-Dist: pytest-asyncio; extra == 'dev'
28
+ Requires-Dist: pytest-cov; extra == 'dev'
29
+ Requires-Dist: ruff; extra == 'dev'
30
+ Description-Content-Type: text/markdown
31
+
32
+ # Guard Core MCP
33
+
34
+ An [MCP](https://modelcontextprotocol.io) server that lets AI coding agents answer questions
35
+ about the Guard security ecosystem from the libraries themselves, instead of from memory.
36
+
37
+ Covers [`fastapi-guard`](https://github.com/rennf93/fastapi-guard),
38
+ [`guard-core`](https://github.com/rennf93/guard-core) and
39
+ [`guard-agent`](https://github.com/rennf93/guard-agent).
40
+
41
+ > **Status: 0.0.1, early scaffold.** Only the `versions` tool is implemented. The config,
42
+ > documentation and detection tools described below are in progress.
43
+
44
+ ## Why
45
+
46
+ Your agent can already read the docs. What it cannot do is tell you that the `redis_failopen`
47
+ in your config is silently doing nothing because the real field is `redis_fail_open`, or that
48
+ the flag you are reaching for did not exist until guard-core 3.5.0, or whether a given request
49
+ would actually be blocked and by which pattern.
50
+
51
+ This server answers those from the installed package: real pydantic validation, real field
52
+ metadata, and the real detection engine.
53
+
54
+ ## Install
55
+
56
+ Install it **into your project's environment**, not as an isolated tool:
57
+
58
+ ```bash
59
+ uv add --dev guard-core-mcp
60
+ claude mcp add guard-core -- uv run guard-core-mcp
61
+ ```
62
+
63
+ `uvx guard-core-mcp` will start, but an isolated environment contains no `guard-core` or
64
+ `fastapi-guard` for it to introspect, so it can only answer from bundled documentation. Running
65
+ it inside your own environment is what makes the answers match the versions you actually ship.
66
+
67
+ ## Tools
68
+
69
+ | Tool | Answers |
70
+ |---|---|
71
+ | `versions` | Which Guard libraries are installed here, and at what version |
72
+ | `validate_config` | Is this config valid — including typo'd keys pydantic silently ignores |
73
+ | `config_fields` | What is this setting, what does it default to, does a setting for X exist |
74
+ | `search_docs` | Where do the docs cover this |
75
+ | `get_doc` | The full text of one documentation page |
76
+ | `check_payload` | Would this request be blocked, and by which pattern |
77
+
78
+ ## Licence
79
+
80
+ MIT
@@ -0,0 +1,49 @@
1
+ # Guard Core MCP
2
+
3
+ An [MCP](https://modelcontextprotocol.io) server that lets AI coding agents answer questions
4
+ about the Guard security ecosystem from the libraries themselves, instead of from memory.
5
+
6
+ Covers [`fastapi-guard`](https://github.com/rennf93/fastapi-guard),
7
+ [`guard-core`](https://github.com/rennf93/guard-core) and
8
+ [`guard-agent`](https://github.com/rennf93/guard-agent).
9
+
10
+ > **Status: 0.0.1, early scaffold.** Only the `versions` tool is implemented. The config,
11
+ > documentation and detection tools described below are in progress.
12
+
13
+ ## Why
14
+
15
+ Your agent can already read the docs. What it cannot do is tell you that the `redis_failopen`
16
+ in your config is silently doing nothing because the real field is `redis_fail_open`, or that
17
+ the flag you are reaching for did not exist until guard-core 3.5.0, or whether a given request
18
+ would actually be blocked and by which pattern.
19
+
20
+ This server answers those from the installed package: real pydantic validation, real field
21
+ metadata, and the real detection engine.
22
+
23
+ ## Install
24
+
25
+ Install it **into your project's environment**, not as an isolated tool:
26
+
27
+ ```bash
28
+ uv add --dev guard-core-mcp
29
+ claude mcp add guard-core -- uv run guard-core-mcp
30
+ ```
31
+
32
+ `uvx guard-core-mcp` will start, but an isolated environment contains no `guard-core` or
33
+ `fastapi-guard` for it to introspect, so it can only answer from bundled documentation. Running
34
+ it inside your own environment is what makes the answers match the versions you actually ship.
35
+
36
+ ## Tools
37
+
38
+ | Tool | Answers |
39
+ |---|---|
40
+ | `versions` | Which Guard libraries are installed here, and at what version |
41
+ | `validate_config` | Is this config valid — including typo'd keys pydantic silently ignores |
42
+ | `config_fields` | What is this setting, what does it default to, does a setting for X exist |
43
+ | `search_docs` | Where do the docs cover this |
44
+ | `get_doc` | The full text of one documentation page |
45
+ | `check_payload` | Would this request be blocked, and by which pattern |
46
+
47
+ ## Licence
48
+
49
+ MIT
@@ -0,0 +1,3 @@
1
+ __version__ = "0.0.1"
2
+
3
+ __all__ = ["__version__"]
@@ -0,0 +1,37 @@
1
+ import importlib.metadata
2
+ from typing import Any
3
+
4
+ from mcp.server.fastmcp import FastMCP
5
+
6
+ from guard_core_mcp import __version__
7
+
8
+ GUARD_DISTRIBUTIONS = ("guard-core", "fastapi-guard", "guard-agent")
9
+
10
+ mcp = FastMCP("guard-core")
11
+
12
+
13
+ def installed_guard_versions() -> dict[str, str | None]:
14
+ versions: dict[str, str | None] = {}
15
+ for distribution in GUARD_DISTRIBUTIONS:
16
+ try:
17
+ versions[distribution] = importlib.metadata.version(distribution)
18
+ except importlib.metadata.PackageNotFoundError:
19
+ versions[distribution] = None
20
+ return versions
21
+
22
+
23
+ @mcp.tool()
24
+ def versions() -> dict[str, Any]:
25
+ """Report which Guard libraries this server can introspect, and at what version.
26
+
27
+ A null version means that library is not installed in the interpreter running
28
+ this server, so any answer about it would be a guess rather than introspection.
29
+ """
30
+ return {
31
+ "guard_core_mcp": __version__,
32
+ "installed": installed_guard_versions(),
33
+ }
34
+
35
+
36
+ def main() -> None:
37
+ mcp.run()
@@ -0,0 +1,100 @@
1
+ [project]
2
+ name = "guard-core-mcp"
3
+ version = "0.0.1"
4
+ description = "MCP server for the Guard ecosystem — config validation, docs search and live threat detection for fastapi-guard, guard-core and guard-agent."
5
+ authors = [
6
+ {name = "Renzo Franceschini", email = "rennf93@users.noreply.github.com"}
7
+ ]
8
+ readme = "README.md"
9
+ license = "MIT"
10
+ license-files = ["LICENSE"]
11
+ requires-python = ">=3.10,<3.15"
12
+ classifiers = [
13
+ "Development Status :: 3 - Alpha",
14
+ "Intended Audience :: Developers",
15
+ "Operating System :: OS Independent",
16
+ "Programming Language :: Python :: 3",
17
+ "Programming Language :: Python :: 3.10",
18
+ "Programming Language :: Python :: 3.11",
19
+ "Programming Language :: Python :: 3.12",
20
+ "Programming Language :: Python :: 3.13",
21
+ "Programming Language :: Python :: 3.14",
22
+ "Topic :: Security",
23
+ ]
24
+ dependencies = [
25
+ "mcp",
26
+ ]
27
+
28
+ [project.scripts]
29
+ guard-core-mcp = "guard_core_mcp.server:main"
30
+
31
+ [project.urls]
32
+ Homepage = "https://github.com/rennf93/guard-core-mcp"
33
+
34
+ [project.optional-dependencies]
35
+ dev = [
36
+ "fastapi-guard",
37
+ "guard-agent",
38
+ "guard-core",
39
+ "mypy",
40
+ "pytest",
41
+ "pytest-asyncio",
42
+ "pytest-cov",
43
+ "ruff",
44
+ ]
45
+
46
+ [build-system]
47
+ requires = ["hatchling"]
48
+ build-backend = "hatchling.build"
49
+
50
+ [tool.hatch.build.targets.wheel]
51
+ packages = ["guard_core_mcp"]
52
+
53
+ [tool.hatch.build.targets.sdist]
54
+ exclude = [
55
+ ".env",
56
+ ".envrc",
57
+ ".venv/",
58
+ ".github/",
59
+ ".claude/",
60
+ "CLAUDE.md",
61
+ ".pre-commit-config.yaml",
62
+ "Makefile",
63
+ "tests/",
64
+ ]
65
+
66
+ [tool.ruff]
67
+ target-version = "py310"
68
+ exclude = [".venv"]
69
+
70
+ [tool.ruff.lint]
71
+ select = [
72
+ "E",
73
+ "F",
74
+ "UP",
75
+ "B",
76
+ "I",
77
+ ]
78
+
79
+ [tool.pytest.ini_options]
80
+ asyncio_mode = "auto"
81
+ testpaths = ["tests"]
82
+ python_files = ["test_*.py"]
83
+ asyncio_default_fixture_loop_scope = "function"
84
+ addopts = "--cov=guard_core_mcp --cov-branch --cov-report=term-missing"
85
+
86
+ [tool.mypy]
87
+ python_version = "3.10"
88
+ warn_return_any = true
89
+ warn_unused_configs = true
90
+ disallow_untyped_defs = true
91
+ disallow_incomplete_defs = true
92
+ check_untyped_defs = true
93
+ disallow_untyped_decorators = true
94
+ no_implicit_optional = true
95
+ strict_optional = true
96
+ warn_redundant_casts = true
97
+ warn_unused_ignores = true
98
+ warn_no_return = true
99
+ warn_unreachable = true
100
+ exclude = [".venv"]