crowdsec-local-mcp 0.1.0__tar.gz → 0.2.0__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 (41) hide show
  1. crowdsec_local_mcp-0.2.0/.github/workflows/build.yml +21 -0
  2. crowdsec_local_mcp-0.2.0/.github/workflows/publish.yml +26 -0
  3. crowdsec_local_mcp-0.2.0/.gitignore +207 -0
  4. {crowdsec_local_mcp-0.1.0/src/crowdsec_local_mcp.egg-info → crowdsec_local_mcp-0.2.0}/PKG-INFO +9 -28
  5. {crowdsec_local_mcp-0.1.0 → crowdsec_local_mcp-0.2.0}/README.md +8 -27
  6. {crowdsec_local_mcp-0.1.0 → crowdsec_local_mcp-0.2.0}/pyproject.toml +8 -2
  7. {crowdsec_local_mcp-0.1.0 → crowdsec_local_mcp-0.2.0}/src/crowdsec_local_mcp/__main__.py +2 -0
  8. {crowdsec_local_mcp-0.1.0 → crowdsec_local_mcp-0.2.0}/src/crowdsec_local_mcp/mcp_core.py +2 -1
  9. crowdsec_local_mcp-0.2.0/src/crowdsec_local_mcp/setup_cli.py +306 -0
  10. {crowdsec_local_mcp-0.1.0 → crowdsec_local_mcp-0.2.0/src/crowdsec_local_mcp.egg-info}/PKG-INFO +9 -28
  11. {crowdsec_local_mcp-0.1.0 → crowdsec_local_mcp-0.2.0}/src/crowdsec_local_mcp.egg-info/SOURCES.txt +5 -0
  12. {crowdsec_local_mcp-0.1.0 → crowdsec_local_mcp-0.2.0}/src/crowdsec_local_mcp.egg-info/entry_points.txt +1 -0
  13. crowdsec_local_mcp-0.2.0/uv.lock +583 -0
  14. {crowdsec_local_mcp-0.1.0 → crowdsec_local_mcp-0.2.0}/LICENSE +0 -0
  15. {crowdsec_local_mcp-0.1.0 → crowdsec_local_mcp-0.2.0}/MANIFEST.in +0 -0
  16. {crowdsec_local_mcp-0.1.0 → crowdsec_local_mcp-0.2.0}/setup.cfg +0 -0
  17. {crowdsec_local_mcp-0.1.0 → crowdsec_local_mcp-0.2.0}/src/crowdsec_local_mcp/__init__.py +0 -0
  18. {crowdsec_local_mcp-0.1.0 → crowdsec_local_mcp-0.2.0}/src/crowdsec_local_mcp/compose/waf-test/.gitignore +0 -0
  19. {crowdsec_local_mcp-0.1.0 → crowdsec_local_mcp-0.2.0}/src/crowdsec_local_mcp/compose/waf-test/crowdsec/acquis.d/appsec.yaml +0 -0
  20. {crowdsec_local_mcp-0.1.0 → crowdsec_local_mcp-0.2.0}/src/crowdsec_local_mcp/compose/waf-test/crowdsec/appsec-configs/mcp-appsec.yaml.template +0 -0
  21. {crowdsec_local_mcp-0.1.0 → crowdsec_local_mcp-0.2.0}/src/crowdsec_local_mcp/compose/waf-test/crowdsec/init-bouncer.sh +0 -0
  22. {crowdsec_local_mcp-0.1.0 → crowdsec_local_mcp-0.2.0}/src/crowdsec_local_mcp/compose/waf-test/docker-compose.yml +0 -0
  23. {crowdsec_local_mcp-0.1.0 → crowdsec_local_mcp-0.2.0}/src/crowdsec_local_mcp/compose/waf-test/nginx/Dockerfile +0 -0
  24. {crowdsec_local_mcp-0.1.0 → crowdsec_local_mcp-0.2.0}/src/crowdsec_local_mcp/compose/waf-test/nginx/crowdsec/crowdsec-openresty-bouncer.conf +0 -0
  25. {crowdsec_local_mcp-0.1.0 → crowdsec_local_mcp-0.2.0}/src/crowdsec_local_mcp/compose/waf-test/nginx/nginx.conf +0 -0
  26. {crowdsec_local_mcp-0.1.0 → crowdsec_local_mcp-0.2.0}/src/crowdsec_local_mcp/compose/waf-test/nginx/site-enabled/default-site.conf +0 -0
  27. {crowdsec_local_mcp-0.1.0 → crowdsec_local_mcp-0.2.0}/src/crowdsec_local_mcp/compose/waf-test/rules/.gitkeep +0 -0
  28. {crowdsec_local_mcp-0.1.0 → crowdsec_local_mcp-0.2.0}/src/crowdsec_local_mcp/compose/waf-test/rules/base-config.yaml +0 -0
  29. {crowdsec_local_mcp-0.1.0 → crowdsec_local_mcp-0.2.0}/src/crowdsec_local_mcp/mcp_scenarios.py +0 -0
  30. {crowdsec_local_mcp-0.1.0 → crowdsec_local_mcp-0.2.0}/src/crowdsec_local_mcp/mcp_waf.py +0 -0
  31. {crowdsec_local_mcp-0.1.0 → crowdsec_local_mcp-0.2.0}/src/crowdsec_local_mcp/prompts/prompt-scenario-deploy.txt +0 -0
  32. {crowdsec_local_mcp-0.1.0 → crowdsec_local_mcp-0.2.0}/src/crowdsec_local_mcp/prompts/prompt-scenario-examples.txt +0 -0
  33. {crowdsec_local_mcp-0.1.0 → crowdsec_local_mcp-0.2.0}/src/crowdsec_local_mcp/prompts/prompt-scenario.txt +0 -0
  34. {crowdsec_local_mcp-0.1.0 → crowdsec_local_mcp-0.2.0}/src/crowdsec_local_mcp/prompts/prompt-waf-deploy.txt +0 -0
  35. {crowdsec_local_mcp-0.1.0 → crowdsec_local_mcp-0.2.0}/src/crowdsec_local_mcp/prompts/prompt-waf-examples.txt +0 -0
  36. {crowdsec_local_mcp-0.1.0 → crowdsec_local_mcp-0.2.0}/src/crowdsec_local_mcp/prompts/prompt-waf.txt +0 -0
  37. {crowdsec_local_mcp-0.1.0 → crowdsec_local_mcp-0.2.0}/src/crowdsec_local_mcp/yaml-schemas/appsec_rules_schema.yaml +0 -0
  38. {crowdsec_local_mcp-0.1.0 → crowdsec_local_mcp-0.2.0}/src/crowdsec_local_mcp/yaml-schemas/scenario_schema.yaml +0 -0
  39. {crowdsec_local_mcp-0.1.0 → crowdsec_local_mcp-0.2.0}/src/crowdsec_local_mcp.egg-info/dependency_links.txt +0 -0
  40. {crowdsec_local_mcp-0.1.0 → crowdsec_local_mcp-0.2.0}/src/crowdsec_local_mcp.egg-info/requires.txt +0 -0
  41. {crowdsec_local_mcp-0.1.0 → crowdsec_local_mcp-0.2.0}/src/crowdsec_local_mcp.egg-info/top_level.txt +0 -0
@@ -0,0 +1,21 @@
1
+ name: "Build"
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - main
7
+ - master
8
+ pull_request:
9
+
10
+ jobs:
11
+ build:
12
+ runs-on: ubuntu-latest
13
+ steps:
14
+ - name: Checkout
15
+ uses: actions/checkout@v5
16
+ - name: Install uv
17
+ uses: astral-sh/setup-uv@v6
18
+ - name: Install Python 3.13
19
+ run: uv python install 3.13
20
+ - name: Build package
21
+ run: uv build
@@ -0,0 +1,26 @@
1
+ name: "Publish"
2
+
3
+ on:
4
+ release:
5
+ types:
6
+ - released
7
+
8
+ jobs:
9
+ run:
10
+ runs-on: ubuntu-latest
11
+ environment:
12
+ name: pypi
13
+ permissions:
14
+ id-token: write
15
+ contents: read
16
+ steps:
17
+ - name: Checkout
18
+ uses: actions/checkout@v5
19
+ - name: Install uv
20
+ uses: astral-sh/setup-uv@v6
21
+ - name: Install Python 3.13
22
+ run: uv python install 3.13
23
+ - name: Build
24
+ run: uv build
25
+ - name: Publish
26
+ run: uv publish
@@ -0,0 +1,207 @@
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
+ # SageMath parsed files
135
+ *.sage.py
136
+
137
+ # Environments
138
+ .env
139
+ .envrc
140
+ .venv
141
+ env/
142
+ venv/
143
+ ENV/
144
+ env.bak/
145
+ venv.bak/
146
+
147
+ # Spyder project settings
148
+ .spyderproject
149
+ .spyproject
150
+
151
+ # Rope project settings
152
+ .ropeproject
153
+
154
+ # mkdocs documentation
155
+ /site
156
+
157
+ # mypy
158
+ .mypy_cache/
159
+ .dmypy.json
160
+ dmypy.json
161
+
162
+ # Pyre type checker
163
+ .pyre/
164
+
165
+ # pytype static type analyzer
166
+ .pytype/
167
+
168
+ # Cython debug symbols
169
+ cython_debug/
170
+
171
+ # PyCharm
172
+ # JetBrains specific template is maintained in a separate JetBrains.gitignore that can
173
+ # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
174
+ # and can be added to the global gitignore or merged into this file. For a more nuclear
175
+ # option (not recommended) you can uncomment the following to ignore the entire idea folder.
176
+ #.idea/
177
+
178
+ # Abstra
179
+ # Abstra is an AI-powered process automation framework.
180
+ # Ignore directories containing user credentials, local state, and settings.
181
+ # Learn more at https://abstra.io/docs
182
+ .abstra/
183
+
184
+ # Visual Studio Code
185
+ # Visual Studio Code specific template is maintained in a separate VisualStudioCode.gitignore
186
+ # that can be found at https://github.com/github/gitignore/blob/main/Global/VisualStudioCode.gitignore
187
+ # and can be added to the global gitignore or merged into this file. However, if you prefer,
188
+ # you could uncomment the following to ignore the entire vscode folder
189
+ # .vscode/
190
+
191
+ # Ruff stuff:
192
+ .ruff_cache/
193
+
194
+ # PyPI configuration file
195
+ .pypirc
196
+
197
+ # Cursor
198
+ # Cursor is an AI-powered code editor. `.cursorignore` specifies files/directories to
199
+ # exclude from AI features like autocomplete and code analysis. Recommended for sensitive data
200
+ # refer to https://docs.cursor.com/context/ignore-files
201
+ .cursorignore
202
+ .cursorindexingignore
203
+
204
+ # Marimo
205
+ marimo/_static/
206
+ marimo/_lsp/
207
+ __marimo__/
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: crowdsec-local-mcp
3
- Version: 0.1.0
3
+ Version: 0.2.0
4
4
  Summary: An MCP exposing prompts and tools to help users write WAF rules, scenarios etc.
5
5
  Requires-Python: >=3.12
6
6
  Description-Content-Type: text/markdown
@@ -54,40 +54,21 @@ Dynamic: license-file
54
54
 
55
55
  ## Installation
56
56
 
57
- ### Setup
57
+ ### Quick MCP client setup
58
+
59
+ - Configure supported clients automatically with `uvx run --from crowdsec-local-mcp init <client>`, where `<client>` is one of `claude-desktop`, `chatgpt`, `vscode`, or `stdio`:
58
60
 
59
- Install dependencies using `uv`:
60
61
  ```bash
61
- uv sync
62
+ uvx --from crowdsec-local-mcp init
62
63
  ```
63
64
 
64
- ## Configuration for Claude Desktop
65
-
66
- ### macOS/Linux
67
-
68
- 1. Find your Claude Desktop config file:
69
- - macOS: `~/Library/Application Support/Claude/claude_desktop_config.json`
70
- - Linux: `~/.config/Claude/claude_desktop_config.json`
71
-
72
- 2. Add the MCP server configuration:
73
- ```json
74
- {
75
- "mcpServers": {
76
- "crowdsec-prompt-server": {
77
- "command": "/path/to/crowdsec-mcp-rule-helper/.venv/bin/python",
78
- "args": [
79
- "/path/to/crowdsec-mcp-rule-helper/mcp-prompt.py"
80
- ],
81
- "cwd": "/path/to/crowdsec-mcp-rule-helper"
82
- }
83
- }
84
- }
85
- ```
65
+ ## Logging
86
66
 
87
- **Important**: Replace `/path/to/crowdsec-mcp-rule-helper` with the actual absolute path to your cloned repository.
67
+ - The MCP server writes its log file to your operating system's temporary directory. On Linux/macOS this is typically `/tmp/crowdsec-mcp.log`; on Windows it resolves via `%TEMP%\crowdsec-mcp.log`.
88
68
 
89
69
  ## Pre Requisites
90
70
 
91
71
  - Docker + Docker Compose
92
72
 
93
- - Python
73
+ - Python >= 3.12
74
+
@@ -41,40 +41,21 @@
41
41
 
42
42
  ## Installation
43
43
 
44
- ### Setup
44
+ ### Quick MCP client setup
45
+
46
+ - Configure supported clients automatically with `uvx run --from crowdsec-local-mcp init <client>`, where `<client>` is one of `claude-desktop`, `chatgpt`, `vscode`, or `stdio`:
45
47
 
46
- Install dependencies using `uv`:
47
48
  ```bash
48
- uv sync
49
+ uvx --from crowdsec-local-mcp init
49
50
  ```
50
51
 
51
- ## Configuration for Claude Desktop
52
-
53
- ### macOS/Linux
54
-
55
- 1. Find your Claude Desktop config file:
56
- - macOS: `~/Library/Application Support/Claude/claude_desktop_config.json`
57
- - Linux: `~/.config/Claude/claude_desktop_config.json`
58
-
59
- 2. Add the MCP server configuration:
60
- ```json
61
- {
62
- "mcpServers": {
63
- "crowdsec-prompt-server": {
64
- "command": "/path/to/crowdsec-mcp-rule-helper/.venv/bin/python",
65
- "args": [
66
- "/path/to/crowdsec-mcp-rule-helper/mcp-prompt.py"
67
- ],
68
- "cwd": "/path/to/crowdsec-mcp-rule-helper"
69
- }
70
- }
71
- }
72
- ```
52
+ ## Logging
73
53
 
74
- **Important**: Replace `/path/to/crowdsec-mcp-rule-helper` with the actual absolute path to your cloned repository.
54
+ - The MCP server writes its log file to your operating system's temporary directory. On Linux/macOS this is typically `/tmp/crowdsec-mcp.log`; on Windows it resolves via `%TEMP%\crowdsec-mcp.log`.
75
55
 
76
56
  ## Pre Requisites
77
57
 
78
58
  - Docker + Docker Compose
79
59
 
80
- - Python
60
+ - Python >= 3.12
61
+
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "crowdsec-local-mcp"
3
- version = "0.1.0"
3
+ dynamic = ["version"]
4
4
  description = "An MCP exposing prompts and tools to help users write WAF rules, scenarios etc."
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.12"
@@ -13,9 +13,10 @@ dependencies = [
13
13
 
14
14
  [project.scripts]
15
15
  crowdsec-mcp = "crowdsec_local_mcp.__main__:run"
16
+ init = "crowdsec_local_mcp.setup_cli:main"
16
17
 
17
18
  [build-system]
18
- requires = ["setuptools>=69", "wheel"]
19
+ requires = ["setuptools>=69", "wheel", "setuptools_scm>=8"]
19
20
  build-backend = "setuptools.build_meta"
20
21
 
21
22
  [tool.setuptools]
@@ -26,3 +27,8 @@ include-package-data = true
26
27
 
27
28
  [tool.setuptools.packages.find]
28
29
  where = ["src"]
30
+
31
+ [tool.setuptools_scm]
32
+ tag_regex = "^v?(?P<version>[0-9]+(\\.[0-9]+)*)$"
33
+ version_scheme = "no-guess-dev"
34
+ local_scheme = "no-local-version"
@@ -1,5 +1,7 @@
1
1
  #!/usr/bin/env python3
2
2
 
3
+ # Use `uv run --project . <command>` to run this module directly for testing.
4
+
3
5
  import asyncio
4
6
 
5
7
  from .mcp_core import LOGGER, main
@@ -1,5 +1,6 @@
1
1
  import asyncio
2
2
  import logging
3
+ import tempfile
3
4
  from collections import OrderedDict
4
5
  from pathlib import Path
5
6
  from typing import Any, Callable, Dict, List, Optional
@@ -11,7 +12,7 @@ from mcp.server.models import InitializationOptions
11
12
 
12
13
  SCRIPT_DIR = Path(__file__).parent
13
14
  PROMPTS_DIR = SCRIPT_DIR / "prompts"
14
- LOG_FILE_PATH = SCRIPT_DIR / "crowdsec-mcp.log"
15
+ LOG_FILE_PATH = Path(tempfile.gettempdir()) / "crowdsec-mcp.log"
15
16
 
16
17
 
17
18
  def _configure_logger() -> logging.Logger: