commitguard-mcp 0.3.0__tar.gz → 0.3.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.
Files changed (28) hide show
  1. {commitguard_mcp-0.3.0/src/commitguard_mcp.egg-info → commitguard_mcp-0.3.1}/PKG-INFO +5 -3
  2. {commitguard_mcp-0.3.0 → commitguard_mcp-0.3.1}/README.md +3 -2
  3. {commitguard_mcp-0.3.0 → commitguard_mcp-0.3.1}/pyproject.toml +2 -1
  4. {commitguard_mcp-0.3.0 → commitguard_mcp-0.3.1}/src/commitguard/__init__.py +1 -1
  5. {commitguard_mcp-0.3.0 → commitguard_mcp-0.3.1}/src/commitguard/cli.py +1 -1
  6. {commitguard_mcp-0.3.0 → commitguard_mcp-0.3.1/src/commitguard_mcp.egg-info}/PKG-INFO +5 -3
  7. {commitguard_mcp-0.3.0 → commitguard_mcp-0.3.1}/src/commitguard_mcp.egg-info/SOURCES.txt +1 -0
  8. commitguard_mcp-0.3.1/tests/test_clients.py +107 -0
  9. {commitguard_mcp-0.3.0 → commitguard_mcp-0.3.1}/tests/test_guarantees.py +5 -5
  10. {commitguard_mcp-0.3.0 → commitguard_mcp-0.3.1}/tests/test_http_and_metrics.py +4 -0
  11. {commitguard_mcp-0.3.0 → commitguard_mcp-0.3.1}/tests/test_redteam_regressions.py +1 -1
  12. {commitguard_mcp-0.3.0 → commitguard_mcp-0.3.1}/LICENSE +0 -0
  13. {commitguard_mcp-0.3.0 → commitguard_mcp-0.3.1}/setup.cfg +0 -0
  14. {commitguard_mcp-0.3.0 → commitguard_mcp-0.3.1}/src/commitguard/demo.py +0 -0
  15. {commitguard_mcp-0.3.0 → commitguard_mcp-0.3.1}/src/commitguard/metrics.py +0 -0
  16. {commitguard_mcp-0.3.0 → commitguard_mcp-0.3.1}/src/commitguard/review.py +0 -0
  17. {commitguard_mcp-0.3.0 → commitguard_mcp-0.3.1}/src/commitguard/runlog.py +0 -0
  18. {commitguard_mcp-0.3.0 → commitguard_mcp-0.3.1}/src/commitguard/server.py +0 -0
  19. {commitguard_mcp-0.3.0 → commitguard_mcp-0.3.1}/src/commitguard/store.py +0 -0
  20. {commitguard_mcp-0.3.0 → commitguard_mcp-0.3.1}/src/commitguard/trackers.py +0 -0
  21. {commitguard_mcp-0.3.0 → commitguard_mcp-0.3.1}/src/commitguard_mcp.egg-info/dependency_links.txt +0 -0
  22. {commitguard_mcp-0.3.0 → commitguard_mcp-0.3.1}/src/commitguard_mcp.egg-info/entry_points.txt +0 -0
  23. {commitguard_mcp-0.3.0 → commitguard_mcp-0.3.1}/src/commitguard_mcp.egg-info/requires.txt +0 -0
  24. {commitguard_mcp-0.3.0 → commitguard_mcp-0.3.1}/src/commitguard_mcp.egg-info/top_level.txt +0 -0
  25. {commitguard_mcp-0.3.0 → commitguard_mcp-0.3.1}/tests/test_cli_and_review.py +0 -0
  26. {commitguard_mcp-0.3.0 → commitguard_mcp-0.3.1}/tests/test_fuzz.py +0 -0
  27. {commitguard_mcp-0.3.0 → commitguard_mcp-0.3.1}/tests/test_github_backend.py +0 -0
  28. {commitguard_mcp-0.3.0 → commitguard_mcp-0.3.1}/tests/test_perf.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: commitguard-mcp
3
- Version: 0.3.0
3
+ Version: 0.3.1
4
4
  Summary: An issue-tracker MCP server where agents can read, comment and propose, but can never write a commitment (owner, due date, status).
5
5
  Author: Bharath Gaviriboina
6
6
  License: MIT
@@ -15,6 +15,7 @@ Classifier: Programming Language :: Python :: 3
15
15
  Classifier: Programming Language :: Python :: 3.11
16
16
  Classifier: Programming Language :: Python :: 3.12
17
17
  Classifier: Programming Language :: Python :: 3.13
18
+ Classifier: Operating System :: OS Independent
18
19
  Classifier: Topic :: Security
19
20
  Classifier: Topic :: Software Development :: Bug Tracking
20
21
  Requires-Python: >=3.11
@@ -74,7 +75,7 @@ commitguard seed # creates commitguard.db with demo issues, including
74
75
 
75
76
  The package is `commitguard-mcp` on PyPI; the commands it installs are `commitguard-server` and `commitguard`. (The unrelated `commitguard` package on PyPI is a git-hooks tool.)
76
77
 
77
- Add it to Claude Desktop or Claude Code (`claude mcp add` or your client's MCP config):
78
+ Add it to your AI tool. **Ready-made configs for Claude Code, Claude Desktop, VS Code (Copilot), Cursor, Windsurf, Zed, Cline and Continue, plus pipx, uvx and Docker installs, are in [docs/CLIENTS.md](docs/CLIENTS.md).** For example, Claude Desktop:
78
79
 
79
80
  ```json
80
81
  {
@@ -129,7 +130,8 @@ Every push and pull request runs the same gate a release does ([`ci.yml`](.githu
129
130
 
130
131
  | Area | What runs | Fails the build when |
131
132
  |---|---|---|
132
- | Correctness | Tests on Linux and macOS, Python 3.11 to 3.13; the hijacked-agent safety eval | any test fails, coverage drops under 85%, or safety is under 100% |
133
+ | Correctness | Tests on Linux (Python 3.11 to 3.13), macOS and Windows (3.12) on every push, all nine combinations nightly; the hijacked-agent safety eval | any test fails, coverage drops under 85%, or safety is under 100% |
134
+ | Client compatibility | The official MCP client SDK over stdio and HTTP; the MCP Inspector with strict tool-schema checks | a client can't connect, a schema isn't portable, or a write tool answers |
133
135
  | Fuzzing | Hypothesis generates thousands of hostile inputs per validator, and random sequences of agent calls | any input breaks a property, or any call sequence changes a commitment |
134
136
  | Performance | Benchmarks of the hot paths; an HTTP load test on the built container | a hot path is over its budget, p95 is over 250 ms, or any request errors |
135
137
  | Code security | Ruff with Bandit rules, mypy; CodeQL on Python and the workflows themselves | Ruff or mypy finds an issue (CodeQL findings land in the Security tab, and block merges once branch protection requires it) |
@@ -38,7 +38,7 @@ commitguard seed # creates commitguard.db with demo issues, including
38
38
 
39
39
  The package is `commitguard-mcp` on PyPI; the commands it installs are `commitguard-server` and `commitguard`. (The unrelated `commitguard` package on PyPI is a git-hooks tool.)
40
40
 
41
- Add it to Claude Desktop or Claude Code (`claude mcp add` or your client's MCP config):
41
+ Add it to your AI tool. **Ready-made configs for Claude Code, Claude Desktop, VS Code (Copilot), Cursor, Windsurf, Zed, Cline and Continue, plus pipx, uvx and Docker installs, are in [docs/CLIENTS.md](docs/CLIENTS.md).** For example, Claude Desktop:
42
42
 
43
43
  ```json
44
44
  {
@@ -93,7 +93,8 @@ Every push and pull request runs the same gate a release does ([`ci.yml`](.githu
93
93
 
94
94
  | Area | What runs | Fails the build when |
95
95
  |---|---|---|
96
- | Correctness | Tests on Linux and macOS, Python 3.11 to 3.13; the hijacked-agent safety eval | any test fails, coverage drops under 85%, or safety is under 100% |
96
+ | Correctness | Tests on Linux (Python 3.11 to 3.13), macOS and Windows (3.12) on every push, all nine combinations nightly; the hijacked-agent safety eval | any test fails, coverage drops under 85%, or safety is under 100% |
97
+ | Client compatibility | The official MCP client SDK over stdio and HTTP; the MCP Inspector with strict tool-schema checks | a client can't connect, a schema isn't portable, or a write tool answers |
97
98
  | Fuzzing | Hypothesis generates thousands of hostile inputs per validator, and random sequences of agent calls | any input breaks a property, or any call sequence changes a commitment |
98
99
  | Performance | Benchmarks of the hot paths; an HTTP load test on the built container | a hot path is over its budget, p95 is over 250 ms, or any request errors |
99
100
  | Code security | Ruff with Bandit rules, mypy; CodeQL on Python and the workflows themselves | Ruff or mypy finds an issue (CodeQL findings land in the Security tab, and block merges once branch protection requires it) |
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "commitguard-mcp"
3
- version = "0.3.0"
3
+ version = "0.3.1"
4
4
  description = "An issue-tracker MCP server where agents can read, comment and propose, but can never write a commitment (owner, due date, status)."
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.11"
@@ -16,6 +16,7 @@ classifiers = [
16
16
  "Programming Language :: Python :: 3.11",
17
17
  "Programming Language :: Python :: 3.12",
18
18
  "Programming Language :: Python :: 3.13",
19
+ "Operating System :: OS Independent",
19
20
  "Topic :: Security",
20
21
  "Topic :: Software Development :: Bug Tracking",
21
22
  ]
@@ -1,6 +1,6 @@
1
1
  """CommitGuard: an issue-tracker MCP server with structurally blocked commitment writes."""
2
2
 
3
- __version__ = "0.3.0"
3
+ __version__ = "0.3.1"
4
4
 
5
5
  # Fields that represent a commitment someone made. An agent may propose a change
6
6
  # to these, but no agent-facing code path can write them.
@@ -30,7 +30,7 @@ def main() -> None:
30
30
  for name in ("approve", "reject", "reconcile"):
31
31
  s = sub.add_parser(name)
32
32
  s.add_argument("proposal_id")
33
- s.add_argument("--reviewer", default=os.environ.get("USER", ""))
33
+ s.add_argument("--reviewer", default=os.environ.get("USER") or os.environ.get("USERNAME", ""))
34
34
  if name == "reject":
35
35
  s.add_argument("--reason", default="")
36
36
  args = p.parse_args()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: commitguard-mcp
3
- Version: 0.3.0
3
+ Version: 0.3.1
4
4
  Summary: An issue-tracker MCP server where agents can read, comment and propose, but can never write a commitment (owner, due date, status).
5
5
  Author: Bharath Gaviriboina
6
6
  License: MIT
@@ -15,6 +15,7 @@ Classifier: Programming Language :: Python :: 3
15
15
  Classifier: Programming Language :: Python :: 3.11
16
16
  Classifier: Programming Language :: Python :: 3.12
17
17
  Classifier: Programming Language :: Python :: 3.13
18
+ Classifier: Operating System :: OS Independent
18
19
  Classifier: Topic :: Security
19
20
  Classifier: Topic :: Software Development :: Bug Tracking
20
21
  Requires-Python: >=3.11
@@ -74,7 +75,7 @@ commitguard seed # creates commitguard.db with demo issues, including
74
75
 
75
76
  The package is `commitguard-mcp` on PyPI; the commands it installs are `commitguard-server` and `commitguard`. (The unrelated `commitguard` package on PyPI is a git-hooks tool.)
76
77
 
77
- Add it to Claude Desktop or Claude Code (`claude mcp add` or your client's MCP config):
78
+ Add it to your AI tool. **Ready-made configs for Claude Code, Claude Desktop, VS Code (Copilot), Cursor, Windsurf, Zed, Cline and Continue, plus pipx, uvx and Docker installs, are in [docs/CLIENTS.md](docs/CLIENTS.md).** For example, Claude Desktop:
78
79
 
79
80
  ```json
80
81
  {
@@ -129,7 +130,8 @@ Every push and pull request runs the same gate a release does ([`ci.yml`](.githu
129
130
 
130
131
  | Area | What runs | Fails the build when |
131
132
  |---|---|---|
132
- | Correctness | Tests on Linux and macOS, Python 3.11 to 3.13; the hijacked-agent safety eval | any test fails, coverage drops under 85%, or safety is under 100% |
133
+ | Correctness | Tests on Linux (Python 3.11 to 3.13), macOS and Windows (3.12) on every push, all nine combinations nightly; the hijacked-agent safety eval | any test fails, coverage drops under 85%, or safety is under 100% |
134
+ | Client compatibility | The official MCP client SDK over stdio and HTTP; the MCP Inspector with strict tool-schema checks | a client can't connect, a schema isn't portable, or a write tool answers |
133
135
  | Fuzzing | Hypothesis generates thousands of hostile inputs per validator, and random sequences of agent calls | any input breaks a property, or any call sequence changes a commitment |
134
136
  | Performance | Benchmarks of the hot paths; an HTTP load test on the built container | a hot path is over its budget, p95 is over 250 ms, or any request errors |
135
137
  | Code security | Ruff with Bandit rules, mypy; CodeQL on Python and the workflows themselves | Ruff or mypy finds an issue (CodeQL findings land in the Security tab, and block merges once branch protection requires it) |
@@ -17,6 +17,7 @@ src/commitguard_mcp.egg-info/entry_points.txt
17
17
  src/commitguard_mcp.egg-info/requires.txt
18
18
  src/commitguard_mcp.egg-info/top_level.txt
19
19
  tests/test_cli_and_review.py
20
+ tests/test_clients.py
20
21
  tests/test_fuzz.py
21
22
  tests/test_github_backend.py
22
23
  tests/test_guarantees.py
@@ -0,0 +1,107 @@
1
+ """Real MCP clients against the real server, over both transports.
2
+
3
+ Every MCP host (Claude Desktop, Claude Code, Cursor, VS Code, Windsurf, Zed, Cline, ...) talks
4
+ to a server one of two ways: it starts the server as a process and speaks over stdio, or it
5
+ connects to a URL over streamable HTTP. These tests use the official MCP client SDK, the same
6
+ protocol those hosts speak, against the server started exactly as a user would start it.
7
+ They run on Linux, macOS and Windows in CI.
8
+ """
9
+
10
+ import asyncio
11
+ import os
12
+ import socket
13
+ import subprocess
14
+ import sys
15
+ import time
16
+ import urllib.request
17
+
18
+ import pytest
19
+ from mcp import ClientSession
20
+ from mcp.client.stdio import StdioServerParameters, stdio_client
21
+ from mcp.client.streamable_http import streamable_http_client
22
+
23
+ TOOLS = {"search_issues", "get_issue", "add_comment", "propose_update", "list_my_proposals"}
24
+
25
+
26
+ def server_env(tmp_path, **extra):
27
+ env = dict(os.environ)
28
+ env.update({"COMMITGUARD_DB": str(tmp_path / "client.db"), "COMMITGUARD_SEED_DEMO": "1",
29
+ "COMMITGUARD_RUNLOG": str(tmp_path / "runlog.jsonl"), "COMMITGUARD_AGENT_ID": "client-test"})
30
+ env.update(extra)
31
+ return env
32
+
33
+
34
+ async def exercise(session: ClientSession) -> dict:
35
+ """What any host does: handshake, discover tools, call them, see refusals."""
36
+ init = await session.initialize()
37
+ tools = {t.name for t in (await session.list_tools()).tools}
38
+ issue = await session.call_tool("get_issue", {"issue_id": "ENG-101"})
39
+ proposal = await session.call_tool("propose_update", {
40
+ "issue_id": "ENG-101", "changes": {"status": "done"}, "rationale": "PR #412 merged", "evidence": ["PR #412"]})
41
+ refused = await session.call_tool("update_issue", {"issue_id": "ENG-101", "status": "done"})
42
+ hidden = await session.call_tool("get_issue", {"issue_id": "SEC-001"})
43
+ return {"name": init.server_info.name, "tools": tools, "issue": issue, "proposal": proposal,
44
+ "refused": refused, "hidden": hidden}
45
+
46
+
47
+ def check(result):
48
+ assert result["name"] == "commitguard"
49
+ assert result["tools"] == TOOLS
50
+ assert not result["issue"].is_error and "ENG-101" in str(result["issue"].content)
51
+ assert not result["proposal"].is_error and "pending" in str(result["proposal"].content)
52
+ assert result["refused"].is_error # unknown write tool: refused, never executed
53
+ assert result["hidden"].is_error # private issue: invisible
54
+
55
+
56
+ def test_stdio_client(tmp_path):
57
+ params = StdioServerParameters(command=sys.executable, args=["-m", "commitguard.server"],
58
+ env=server_env(tmp_path, COMMITGUARD_TRANSPORT="stdio"))
59
+
60
+ async def run():
61
+ async with stdio_client(params) as (read, write), ClientSession(read, write) as session:
62
+ return await exercise(session)
63
+
64
+ check(asyncio.run(asyncio.wait_for(run(), 60)))
65
+
66
+
67
+ def free_port() -> int:
68
+ with socket.socket() as s:
69
+ s.bind(("127.0.0.1", 0))
70
+ return s.getsockname()[1]
71
+
72
+
73
+ @pytest.fixture
74
+ def http_server(tmp_path):
75
+ port = free_port()
76
+ env = server_env(tmp_path, COMMITGUARD_TRANSPORT="streamable-http", HOST="127.0.0.1", PORT=str(port),
77
+ COMMITGUARD_RUNLOG="-")
78
+ proc = subprocess.Popen([sys.executable, "-m", "commitguard.server"], env=env,
79
+ stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
80
+ base = f"http://127.0.0.1:{port}"
81
+ try:
82
+ for _ in range(100):
83
+ try:
84
+ with urllib.request.urlopen(base + "/readyz", timeout=1) as r: # noqa: S310 - local test server
85
+ if r.status == 200:
86
+ break
87
+ except OSError:
88
+ time.sleep(0.2)
89
+ else:
90
+ raise RuntimeError("server did not become ready")
91
+ yield base
92
+ finally:
93
+ proc.terminate()
94
+ try:
95
+ proc.wait(10)
96
+ except subprocess.TimeoutExpired:
97
+ proc.kill()
98
+
99
+
100
+ def test_streamable_http_client(http_server):
101
+ async def run():
102
+ async with streamable_http_client(http_server + "/mcp") as streams:
103
+ read, write = streams[0], streams[1]
104
+ async with ClientSession(read, write) as session:
105
+ return await exercise(session)
106
+
107
+ check(asyncio.run(asyncio.wait_for(run(), 60)))
@@ -70,7 +70,7 @@ def test_agent_client_has_no_write_methods_for_commitments():
70
70
 
71
71
  def test_agent_side_sql_never_writes_commitment_columns():
72
72
  for name in ("store.py", "trackers.py"):
73
- text = (SRC / name).read_text()
73
+ text = (SRC / name).read_text(encoding="utf-8")
74
74
  for stmt in re.findall(r"UPDATE\s+issues\s+SET[^\"']*", text, flags=re.I):
75
75
  pytest.fail(f"{name} contains an UPDATE on issues: {stmt}")
76
76
 
@@ -85,11 +85,11 @@ def test_server_never_loads_review_code_even_transitively():
85
85
  cwd=str(SRC.parents[1])).stdout.strip()
86
86
  assert out == "False"
87
87
  # main() may lazily import demo data; that module must not pull in review code either.
88
- assert "review" not in (SRC / "demo.py").read_text()
88
+ assert "review" not in (SRC / "demo.py").read_text(encoding="utf-8")
89
89
 
90
90
 
91
91
  def test_server_never_imports_review_module():
92
- tree = ast.parse((SRC / "server.py").read_text())
92
+ tree = ast.parse((SRC / "server.py").read_text(encoding="utf-8"))
93
93
  imported = set()
94
94
  for node in ast.walk(tree):
95
95
  if isinstance(node, ast.ImportFrom):
@@ -98,7 +98,7 @@ def test_server_never_imports_review_module():
98
98
  imported |= {a.name for a in node.names}
99
99
  assert not any("review" in m for m in imported), imported
100
100
  for mod in ("store.py", "trackers.py", "runlog.py"):
101
- assert "from .review" not in (SRC / mod).read_text()
101
+ assert "from .review" not in (SRC / mod).read_text(encoding="utf-8")
102
102
 
103
103
 
104
104
  def test_github_agent_allowlist_has_no_patch_or_delete():
@@ -211,7 +211,7 @@ def test_every_call_is_logged_with_run_id(server, tmp_path):
211
211
  call(server, "search_issues", {"query": "login"})
212
212
  with pytest.raises(Exception):
213
213
  call(server, "get_issue", {"issue_id": "NOPE-1"})
214
- lines = [json.loads(l) for l in (tmp_path / "runlog.jsonl").read_text().splitlines()]
214
+ lines = [json.loads(l) for l in (tmp_path / "runlog.jsonl").read_text(encoding="utf-8").splitlines()]
215
215
  assert [l["tool"] for l in lines] == ["search_issues", "get_issue"]
216
216
  assert all(l["run_id"] == "run_test" for l in lines)
217
217
  assert lines[1]["outcome"] == "error"
@@ -168,6 +168,10 @@ def test_made_up_tool_names_share_one_series():
168
168
 
169
169
  @pytest.mark.parametrize("name", ["with space.db", "hash#name.db", "q?mark.db", "pct%20.db"])
170
170
  def test_ready_works_for_unusual_database_paths(tmp_path, name):
171
+ import os
172
+
173
+ if os.name == "nt" and "?" in name:
174
+ pytest.skip("'?' is not allowed in Windows file names")
171
175
  path = str(tmp_path / name)
172
176
  seed(connect(path))
173
177
  server = build_server(path, "a", runlog=RunLog(None))
@@ -199,7 +199,7 @@ def test_unknown_tools_and_bad_arguments_are_logged(tmp_path):
199
199
  ("propose_update", {"issue_id": "ENG-101"})]:
200
200
  with pytest.raises(Exception):
201
201
  asyncio.run(srv.call_tool(name, args))
202
- lines = [json.loads(l) for l in (tmp_path / "log.jsonl").read_text().splitlines()]
202
+ lines = [json.loads(l) for l in (tmp_path / "log.jsonl").read_text(encoding="utf-8").splitlines()]
203
203
  assert [l["tool"] for l in lines] == ["update_issue", "propose_update"]
204
204
  assert all(l["outcome"] == "rejected_before_tool" for l in lines)
205
205
 
File without changes