bugledger-mcp 0.1.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 (79) hide show
  1. bugledger_mcp-0.1.0/.gitignore +224 -0
  2. bugledger_mcp-0.1.0/LICENSE +21 -0
  3. bugledger_mcp-0.1.0/PKG-INFO +79 -0
  4. bugledger_mcp-0.1.0/README.md +52 -0
  5. bugledger_mcp-0.1.0/pyproject.toml +87 -0
  6. bugledger_mcp-0.1.0/src/bugledger_mcp/__init__.py +8 -0
  7. bugledger_mcp-0.1.0/src/bugledger_mcp/database/__init__.py +0 -0
  8. bugledger_mcp-0.1.0/src/bugledger_mcp/database/db.py +38 -0
  9. bugledger_mcp-0.1.0/src/bugledger_mcp/database/repository.py +244 -0
  10. bugledger_mcp-0.1.0/src/bugledger_mcp/mcp_server.py +40 -0
  11. bugledger_mcp-0.1.0/src/bugledger_mcp/prompts/__init__.py +0 -0
  12. bugledger_mcp-0.1.0/src/bugledger_mcp/prompts/logbug.py +13 -0
  13. bugledger_mcp-0.1.0/src/bugledger_mcp/schema/__init__.py +0 -0
  14. bugledger_mcp-0.1.0/src/bugledger_mcp/schema/delete_bug.py +17 -0
  15. bugledger_mcp-0.1.0/src/bugledger_mcp/schema/get_guardrails.py +17 -0
  16. bugledger_mcp-0.1.0/src/bugledger_mcp/schema/get_patterns.py +46 -0
  17. bugledger_mcp-0.1.0/src/bugledger_mcp/schema/record_bug.py +100 -0
  18. bugledger_mcp-0.1.0/src/bugledger_mcp/schema/resolve_bug.py +28 -0
  19. bugledger_mcp-0.1.0/src/bugledger_mcp/schema/search_bugs.py +21 -0
  20. bugledger_mcp-0.1.0/src/bugledger_mcp/schema/update_bug.py +103 -0
  21. bugledger_mcp-0.1.0/src/bugledger_mcp/shared/logbug.md +112 -0
  22. bugledger_mcp-0.1.0/src/bugledger_mcp/shared/rules/cors-allow-all.js +13 -0
  23. bugledger_mcp-0.1.0/src/bugledger_mcp/shared/rules/cors-allow-all.py +22 -0
  24. bugledger_mcp-0.1.0/src/bugledger_mcp/shared/rules/cors-allow-all.yaml +26 -0
  25. bugledger_mcp-0.1.0/src/bugledger_mcp/shared/rules/debug-mode.py +13 -0
  26. bugledger_mcp-0.1.0/src/bugledger_mcp/shared/rules/debug-mode.yaml +24 -0
  27. bugledger_mcp-0.1.0/src/bugledger_mcp/shared/rules/empty-catch.js +9 -0
  28. bugledger_mcp-0.1.0/src/bugledger_mcp/shared/rules/empty-catch.py +34 -0
  29. bugledger_mcp-0.1.0/src/bugledger_mcp/shared/rules/empty-catch.yaml +74 -0
  30. bugledger_mcp-0.1.0/src/bugledger_mcp/shared/rules/eval-usage.js +8 -0
  31. bugledger_mcp-0.1.0/src/bugledger_mcp/shared/rules/eval-usage.py +14 -0
  32. bugledger_mcp-0.1.0/src/bugledger_mcp/shared/rules/eval-usage.yaml +50 -0
  33. bugledger_mcp-0.1.0/src/bugledger_mcp/shared/rules/hardcoded-secret.py +40 -0
  34. bugledger_mcp-0.1.0/src/bugledger_mcp/shared/rules/hardcoded-secret.yaml +28 -0
  35. bugledger_mcp-0.1.0/src/bugledger_mcp/shared/rules/http-not-https.py +26 -0
  36. bugledger_mcp-0.1.0/src/bugledger_mcp/shared/rules/http-not-https.yaml +35 -0
  37. bugledger_mcp-0.1.0/src/bugledger_mcp/shared/rules/insecure-random.js +7 -0
  38. bugledger_mcp-0.1.0/src/bugledger_mcp/shared/rules/insecure-random.py +14 -0
  39. bugledger_mcp-0.1.0/src/bugledger_mcp/shared/rules/insecure-random.yaml +35 -0
  40. bugledger_mcp-0.1.0/src/bugledger_mcp/shared/rules/password-in-url.py +19 -0
  41. bugledger_mcp-0.1.0/src/bugledger_mcp/shared/rules/password-in-url.yaml +28 -0
  42. bugledger_mcp-0.1.0/src/bugledger_mcp/shared/rules/shell-injection.js +9 -0
  43. bugledger_mcp-0.1.0/src/bugledger_mcp/shared/rules/shell-injection.py +17 -0
  44. bugledger_mcp-0.1.0/src/bugledger_mcp/shared/rules/shell-injection.yaml +42 -0
  45. bugledger_mcp-0.1.0/src/bugledger_mcp/shared/rules/sql-injection.js +11 -0
  46. bugledger_mcp-0.1.0/src/bugledger_mcp/shared/rules/sql-injection.py +14 -0
  47. bugledger_mcp-0.1.0/src/bugledger_mcp/shared/rules/sql-injection.yaml +41 -0
  48. bugledger_mcp-0.1.0/src/bugledger_mcp/shared/rules/unsafe-deserialization.py +17 -0
  49. bugledger_mcp-0.1.0/src/bugledger_mcp/shared/rules/unsafe-deserialization.yaml +37 -0
  50. bugledger_mcp-0.1.0/src/bugledger_mcp/shared/schema/001_init.sql +13 -0
  51. bugledger_mcp-0.1.0/src/bugledger_mcp/shared/schema/002_fts.sql +24 -0
  52. bugledger_mcp-0.1.0/src/bugledger_mcp/shared/schema/003_resolutions.sql +6 -0
  53. bugledger_mcp-0.1.0/src/bugledger_mcp/shared/schema/004_fts_porter.sql +14 -0
  54. bugledger_mcp-0.1.0/src/bugledger_mcp/tool_registry.py +42 -0
  55. bugledger_mcp-0.1.0/src/bugledger_mcp/tools/__init__.py +0 -0
  56. bugledger_mcp-0.1.0/src/bugledger_mcp/tools/delete_bug.py +40 -0
  57. bugledger_mcp-0.1.0/src/bugledger_mcp/tools/get_guardrails.py +76 -0
  58. bugledger_mcp-0.1.0/src/bugledger_mcp/tools/get_patterns.py +73 -0
  59. bugledger_mcp-0.1.0/src/bugledger_mcp/tools/list_areas.py +15 -0
  60. bugledger_mcp-0.1.0/src/bugledger_mcp/tools/record_bug.py +161 -0
  61. bugledger_mcp-0.1.0/src/bugledger_mcp/tools/resolve_bug.py +52 -0
  62. bugledger_mcp-0.1.0/src/bugledger_mcp/tools/search_bugs.py +55 -0
  63. bugledger_mcp-0.1.0/src/bugledger_mcp/tools/update_bug.py +88 -0
  64. bugledger_mcp-0.1.0/src/bugledger_mcp/utils/__init__.py +0 -0
  65. bugledger_mcp-0.1.0/src/bugledger_mcp/utils/constant.py +116 -0
  66. bugledger_mcp-0.1.0/src/bugledger_mcp/utils/shared_files.py +51 -0
  67. bugledger_mcp-0.1.0/tests/conftest.py +5 -0
  68. bugledger_mcp-0.1.0/tests/helpers.py +12 -0
  69. bugledger_mcp-0.1.0/tests/test_delete_bug.py +79 -0
  70. bugledger_mcp-0.1.0/tests/test_e2e.py +228 -0
  71. bugledger_mcp-0.1.0/tests/test_get_guardrails.py +70 -0
  72. bugledger_mcp-0.1.0/tests/test_get_patterns.py +145 -0
  73. bugledger_mcp-0.1.0/tests/test_list_areas.py +44 -0
  74. bugledger_mcp-0.1.0/tests/test_logbug.py +27 -0
  75. bugledger_mcp-0.1.0/tests/test_record_bug.py +121 -0
  76. bugledger_mcp-0.1.0/tests/test_resolve_bug.py +56 -0
  77. bugledger_mcp-0.1.0/tests/test_search_bugs.py +171 -0
  78. bugledger_mcp-0.1.0/tests/test_server.py +5 -0
  79. bugledger_mcp-0.1.0/tests/test_update_bug.py +96 -0
@@ -0,0 +1,224 @@
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
+ # Synced copy of shared/ for packaging only (source is repo-root shared/)
213
+ python/src/bugledger_mcp/shared/
214
+
215
+ # Marimo
216
+ marimo/_static/
217
+ marimo/_lsp/
218
+ __marimo__/
219
+
220
+ # Streamlit
221
+ .streamlit/secrets.toml
222
+
223
+ # One-off commit helper scripts (run, then delete)
224
+ scripts/commit-*.sh
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 xajeel
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,79 @@
1
+ Metadata-Version: 2.5
2
+ Name: bugledger-mcp
3
+ Version: 0.1.0
4
+ Summary: Local-first MCP server that gives AI coding agents a memory of fixed bugs: record at fix time, retrieve before coding, search while debugging, enforce with Semgrep.
5
+ Project-URL: Homepage, https://github.com/xajeel/bugledger-mcp
6
+ Project-URL: Repository, https://github.com/xajeel/bugledger-mcp
7
+ Project-URL: Issues, https://github.com/xajeel/bugledger-mcp/issues
8
+ Author: xajeel
9
+ License-Expression: MIT
10
+ License-File: LICENSE
11
+ Keywords: ai-agents,bugs,claude-code,cursor,mcp,model-context-protocol,regression,semgrep,sqlite
12
+ Classifier: Development Status :: 3 - Alpha
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: License :: OSI Approved :: MIT License
15
+ Classifier: Operating System :: OS Independent
16
+ Classifier: Programming Language :: Python :: 3
17
+ Classifier: Programming Language :: Python :: 3.10
18
+ Classifier: Programming Language :: Python :: 3.11
19
+ Classifier: Programming Language :: Python :: 3.12
20
+ Classifier: Programming Language :: Python :: 3.13
21
+ Classifier: Programming Language :: Python :: 3.14
22
+ Classifier: Topic :: Software Development :: Debuggers
23
+ Classifier: Topic :: Software Development :: Quality Assurance
24
+ Requires-Python: >=3.10
25
+ Requires-Dist: fastmcp<4,>=3.4.7
26
+ Description-Content-Type: text/markdown
27
+
28
+ # Bug Ledger MCP
29
+
30
+ **Never fix the same bug twice.** A local-first MCP server that gives AI coding agents (Claude Code, Cursor, any MCP client) a permanent memory of fixed bugs. Record a bug at fix time; every future session checks the ledger before writing code.
31
+
32
+ Everything runs on your machine: one SQLite file in `~/.bugledger/`. No login, no cloud, no telemetry, no network calls.
33
+
34
+ ## Install
35
+
36
+ Requires [uv](https://docs.astral.sh/uv/).
37
+
38
+ ```sh
39
+ claude mcp add bugledger -- uvx bugledger-mcp
40
+ ```
41
+
42
+ Restart Claude Code. The tools and the `/mcp__bugledger__logbug` prompt appear.
43
+
44
+ Cursor, or a whole team via a committed `.mcp.json` / `.cursor/mcp.json`:
45
+
46
+ ```json
47
+ { "mcpServers": { "bugledger": { "command": "uvx", "args": ["bugledger-mcp"] } } }
48
+ ```
49
+
50
+ ## Tools
51
+
52
+ | Tool | The agent calls it… | What it does |
53
+ |---|---|---|
54
+ | `get_patterns(feature_area, project)` | **before** planning or coding in an area | Newest past bugs for that area, one line each, capped at 30 lines |
55
+ | `search_bugs(query)` | while debugging | Full-text search over symptoms and root causes; paste the error as is |
56
+ | `record_bug(...)` | after a fix, once you confirm | Stores symptom, root cause, feature area, project, stack, severity, and the fix diff |
57
+ | `list_areas()` | before naming things | Existing feature areas and projects with counts |
58
+ | `resolve_bug(id, project)` | once a project has a guardrail | Hides that bug from `get_patterns` for that project only |
59
+ | `update_bug` / `delete_bug` | to correct mistakes | Edit or remove a record |
60
+ | `get_guardrails(stack)` | at project setup | Starter pack of Semgrep rules for classic AI-coding mistakes, plus the CI workflow |
61
+
62
+ **`/logbug`** is an MCP prompt: the agent checks the session really contained a bug fix, drafts the record, shows it to you, and calls `record_bug` only after you confirm.
63
+
64
+ The server sends standing instructions to the agent on connect, so it works without extra setup. To make it a hard rule, add to `CLAUDE.md` or `.cursorrules`:
65
+
66
+ ```
67
+ Before implementing anything in a feature area, call bugledger get_patterns with that area and this project's name, and account for every returned bug. After fixing a bug, run /mcp__bugledger__logbug.
68
+ ```
69
+
70
+ ## Data and privacy
71
+
72
+ - Ledger: `~/.bugledger/ledger.db`. Override the folder with `BUGLEDGER_HOME`.
73
+ - `record_bug` runs `git show <fix_ref>` in the server's working directory to store the fix diff locally. It is never sent anywhere.
74
+
75
+ Source, issues, and the rule pack: https://github.com/xajeel/bugledger-mcp
76
+
77
+ ## License
78
+
79
+ MIT
@@ -0,0 +1,52 @@
1
+ # Bug Ledger MCP
2
+
3
+ **Never fix the same bug twice.** A local-first MCP server that gives AI coding agents (Claude Code, Cursor, any MCP client) a permanent memory of fixed bugs. Record a bug at fix time; every future session checks the ledger before writing code.
4
+
5
+ Everything runs on your machine: one SQLite file in `~/.bugledger/`. No login, no cloud, no telemetry, no network calls.
6
+
7
+ ## Install
8
+
9
+ Requires [uv](https://docs.astral.sh/uv/).
10
+
11
+ ```sh
12
+ claude mcp add bugledger -- uvx bugledger-mcp
13
+ ```
14
+
15
+ Restart Claude Code. The tools and the `/mcp__bugledger__logbug` prompt appear.
16
+
17
+ Cursor, or a whole team via a committed `.mcp.json` / `.cursor/mcp.json`:
18
+
19
+ ```json
20
+ { "mcpServers": { "bugledger": { "command": "uvx", "args": ["bugledger-mcp"] } } }
21
+ ```
22
+
23
+ ## Tools
24
+
25
+ | Tool | The agent calls it… | What it does |
26
+ |---|---|---|
27
+ | `get_patterns(feature_area, project)` | **before** planning or coding in an area | Newest past bugs for that area, one line each, capped at 30 lines |
28
+ | `search_bugs(query)` | while debugging | Full-text search over symptoms and root causes; paste the error as is |
29
+ | `record_bug(...)` | after a fix, once you confirm | Stores symptom, root cause, feature area, project, stack, severity, and the fix diff |
30
+ | `list_areas()` | before naming things | Existing feature areas and projects with counts |
31
+ | `resolve_bug(id, project)` | once a project has a guardrail | Hides that bug from `get_patterns` for that project only |
32
+ | `update_bug` / `delete_bug` | to correct mistakes | Edit or remove a record |
33
+ | `get_guardrails(stack)` | at project setup | Starter pack of Semgrep rules for classic AI-coding mistakes, plus the CI workflow |
34
+
35
+ **`/logbug`** is an MCP prompt: the agent checks the session really contained a bug fix, drafts the record, shows it to you, and calls `record_bug` only after you confirm.
36
+
37
+ The server sends standing instructions to the agent on connect, so it works without extra setup. To make it a hard rule, add to `CLAUDE.md` or `.cursorrules`:
38
+
39
+ ```
40
+ Before implementing anything in a feature area, call bugledger get_patterns with that area and this project's name, and account for every returned bug. After fixing a bug, run /mcp__bugledger__logbug.
41
+ ```
42
+
43
+ ## Data and privacy
44
+
45
+ - Ledger: `~/.bugledger/ledger.db`. Override the folder with `BUGLEDGER_HOME`.
46
+ - `record_bug` runs `git show <fix_ref>` in the server's working directory to store the fix diff locally. It is never sent anywhere.
47
+
48
+ Source, issues, and the rule pack: https://github.com/xajeel/bugledger-mcp
49
+
50
+ ## License
51
+
52
+ MIT
@@ -0,0 +1,87 @@
1
+ [build-system]
2
+ requires = ["hatchling>=1.27"]
3
+ build-backend = "hatchling.build"
4
+
5
+ [project]
6
+ name = "bugledger-mcp"
7
+ version = "0.1.0"
8
+ description = "Local-first MCP server that gives AI coding agents a memory of fixed bugs: record at fix time, retrieve before coding, search while debugging, enforce with Semgrep."
9
+ readme = "README.md"
10
+ license = "MIT"
11
+ license-files = ["LICENSE"]
12
+ requires-python = ">=3.10"
13
+ authors = [
14
+ { name = "xajeel" },
15
+ ]
16
+ keywords = [
17
+ "mcp",
18
+ "model-context-protocol",
19
+ "claude-code",
20
+ "cursor",
21
+ "ai-agents",
22
+ "bugs",
23
+ "regression",
24
+ "semgrep",
25
+ "sqlite",
26
+ ]
27
+ classifiers = [
28
+ "Development Status :: 3 - Alpha",
29
+ "Intended Audience :: Developers",
30
+ "License :: OSI Approved :: MIT License",
31
+ "Operating System :: OS Independent",
32
+ "Programming Language :: Python :: 3",
33
+ "Programming Language :: Python :: 3.10",
34
+ "Programming Language :: Python :: 3.11",
35
+ "Programming Language :: Python :: 3.12",
36
+ "Programming Language :: Python :: 3.13",
37
+ "Programming Language :: Python :: 3.14",
38
+ "Topic :: Software Development :: Quality Assurance",
39
+ "Topic :: Software Development :: Debuggers",
40
+ ]
41
+ dependencies = [
42
+ "fastmcp>=3.4.7,<4",
43
+ ]
44
+
45
+ [project.urls]
46
+ Homepage = "https://github.com/xajeel/bugledger-mcp"
47
+ Repository = "https://github.com/xajeel/bugledger-mcp"
48
+ Issues = "https://github.com/xajeel/bugledger-mcp/issues"
49
+
50
+ [project.scripts]
51
+ bugledger-mcp = "bugledger_mcp.mcp_server:main"
52
+
53
+ [dependency-groups]
54
+ test = [
55
+ "pytest>=8",
56
+ ]
57
+ dev = [
58
+ { include-group = "test" },
59
+ "ruff>=0.16",
60
+ ]
61
+ rules = [
62
+ "semgrep>=1.174.0",
63
+ ]
64
+
65
+ [tool.hatch.build]
66
+ ignore-vcs = true
67
+ exclude = [
68
+ "**/__pycache__",
69
+ "**/*.pyc",
70
+ "**/.gitkeep",
71
+ ]
72
+
73
+ [tool.hatch.build.targets.wheel]
74
+ packages = ["src/bugledger_mcp"]
75
+
76
+ [tool.hatch.build.targets.sdist]
77
+ only-include = [
78
+ "src/bugledger_mcp",
79
+ "tests",
80
+ "README.md",
81
+ "LICENSE",
82
+ "pyproject.toml",
83
+ ]
84
+
85
+ [tool.pytest.ini_options]
86
+ testpaths = ["tests"]
87
+ pythonpath = ["src"]
@@ -0,0 +1,8 @@
1
+ """Bug Ledger MCP: a local-first memory of fixed bugs for AI coding agents."""
2
+
3
+ from importlib.metadata import PackageNotFoundError, version
4
+
5
+ try:
6
+ __version__ = version("bugledger-mcp")
7
+ except PackageNotFoundError: # source checkout that was never installed
8
+ __version__ = "0.0.0"
@@ -0,0 +1,38 @@
1
+ import os
2
+ import sqlite3
3
+ import sys
4
+ from pathlib import Path
5
+
6
+ from bugledger_mcp.utils.shared_files import list_shared_files
7
+
8
+
9
+ def get_db_path() -> Path:
10
+ """Path of the ledger database. Honors BUGLEDGER_HOME, defaults to ~/.bugledger/."""
11
+
12
+ custom_home = os.getenv("BUGLEDGER_HOME")
13
+ base_dir = Path(custom_home) if custom_home else Path.home() / ".bugledger"
14
+ base_dir.mkdir(parents=True, exist_ok=True)
15
+ return base_dir / "ledger.db"
16
+
17
+
18
+ def run_migrations(conn: sqlite3.Connection) -> None:
19
+ """Apply every shared/schema/*.sql file newer than PRAGMA user_version, in name order."""
20
+
21
+ cursor = conn.cursor()
22
+ user_version = cursor.execute("PRAGMA user_version;").fetchone()[0]
23
+ sql_files = sorted(list_shared_files("schema", suffix=".sql"), key=lambda f: f.name)
24
+
25
+ for index, sql_file in enumerate(sql_files, start=1):
26
+ if index > user_version:
27
+ print(f"bugledger-mcp: applying migration {sql_file.name}", file=sys.stderr)
28
+ cursor.executescript(sql_file.read_text(encoding="utf-8"))
29
+ cursor.execute(f"PRAGMA user_version={index}")
30
+ conn.commit()
31
+
32
+
33
+ def init_db() -> sqlite3.Connection:
34
+ """Open the ledger, creating the file and applying migrations if needed."""
35
+
36
+ conn = sqlite3.connect(get_db_path(), timeout=10)
37
+ run_migrations(conn)
38
+ return conn