Tags: commit-check/commit-check-mcp
Tags
fix: serialise chdir for parallel calls, add ruff/mypy CI, tidy clien… …t setup (#36) * docs(readme): consolidate MCP client setup into one block and a per-client table Replace the nine near-identical JSON snippets with a single canonical `mcpServers` block plus a table of where each client stores it. Fix the entries that were wrong or stale: Claude Code registers servers with `claude mcp add` / `.mcp.json` (not `~/.claude/settings.json`), Zed uses `context_servers`, Continue uses the `config.yaml` list form, Claude Desktop gets its config paths, and VS Code (`.vscode/mcp.json`, `servers` key) is added. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018xYa7m3qup5wyN5MaXFgf6 * ci: add ruff and mypy lint job, test on Python 3.14 Add a `lint` job to main.yml that runs `ruff check src tests` and `mypy src`, and extend the test matrix to 3.14, which the classifiers already advertise. Pin ruff/mypy in the dev extras and configure both in pyproject.toml (line length 100, target py310, rules E/F/W/I/UP/B; mypy on the `commit_check_mcp` package with `mypy_path = src`). Make the tree clean for the new job first: sort imports (I001) in server.py and the tests, wrap seven over-long test lines (E501), and pass the `ToolAnnotations` hints with their snake_case field names (`read_only_hint=` etc.) instead of the camelCase aliases, which mypy rejects as unknown keyword arguments. The serialized annotations are unchanged because the model still emits the camelCase aliases on the wire. * fix(concurrency): serialise the chdir window so parallel tool calls read their own repo `_working_directory` switches the process-wide cwd, and the MCP SDK runs sync tools on worker threads with each request in its own task. Two in-flight calls with different `repo_path` values therefore raced: about half of them returned the other repository's result as `pass`, and the `finally` restore frequently left the server inside one of the repos, changing every later `repo_path=None` call for the life of the process. Guard the chdir window with a module-level `threading.Lock`. Calls that omit `repo_path` do not take the lock. Add a regression test that runs `validate_branch_name` for two repositories concurrently through `mcp.call_tool` and asserts each result names its own branch and the cwd is restored. * fix: hold the cwd lock for cwd-relative calls, harden lint checkout, clarify README - _working_directory takes _CWD_LOCK even when no repo_path is given, so a tool reading the process cwd never observes another thread's chdir. - The lint job checkout sets persist-credentials: false. - README: the Continue example is a complete config.yaml (name/version/ schema) with a note on the mcpServers fragment and .continue/mcpServers/, and the fallback row lists where/Get-Command for Windows shells. * fix(concurrency): resolve relative paths and the no-repo_path git check against the at-rest cwd _normalize_repo_path, _normalize_config_path and _require_git_repo(None) read the process cwd before the tool enters _working_directory, so while another worker thread held its chdir window they resolved against that thread's repository. A relative config_path with no repo_path loaded the other repository's cchk.toml. They now resolve against the cwd observed under _CWD_LOCK, which is the directory the server was started in. Four tests park a thread inside _working_directory(other) and assert the helpers and validate_commit_message still see the server's own directory; all four fail on the previous code.
fix: surface errors as tool errors and stop vacuous passes (#33) * fix: surface errors as tool errors and stop vacuous passes Input, path, and config problems were raised as plain ValueError (or escaped from commit-check as TOMLDecodeError/ValueError), which the mcp 2.x tool manager reports to the client only as the generic "Error executing tool <name>". Every such failure now raises ToolError with the same message, and config merging / RuleBuilder construction report a malformed or rejected config as "invalid commit-check config: <detail>", so an agent can read what to correct. validate_repository_state validated an empty string instead of HEAD's message, so the message rules always passed. The message helper now accepts None and repository-state passes None, which makes commit-check read the latest commit (git log -1) as the CLI does; the author path already worked that way. A repo_path that is a plain directory silently produced a pass because commit-check's git reads come back empty. Tools that consult git (branch, author, or push_refs omitted; validate_repository_state) now require `git rev-parse --show-toplevel` to succeed in that directory and raise "repo_path is not a git repository: <path>" otherwise. Tools that validate a supplied value still work with a non-git directory that only holds a config file. A blank push_refs (e.g. " ") stripped to "" and passed with no ref and no upstream fallback. It is now rejected with "push_refs cannot be empty when provided", consistent with how the other tools treat blank strings. * docs: say when a non-git repo_path is an error The error applies only when the tool has to read git state; a plain directory holding a config file is still fine when every value is supplied, as the Tool Usage note already says.
fix: add mcp-name ownership proof to README for MCP Registry publicat… …ion (#22) The MCP Registry requires the server name to appear as 'mcp-name: io.github.commit-check/commit-check-mcp' in the PyPI package README as proof of ownership. Without this line, the registry validation fails. Placed at the bottom of README with HTML comments explaining its purpose, to prevent accidental deletion.
fix: resolve MCP registry publish race condition by merging into publ… …ish workflow (#21) The MCP registry publish workflow (publish-mcp-registry.yml) ran concurrently with the PyPI publish workflow on release events. The MCP Registry validates that the PyPI package exists before accepting the server.json, but due to the race condition it got a 404. Fix by merging the MCP registry publishing as a dependent job (needs: publish) into publish.yml, ensuring PyPI upload completes before the MCP Registry validation runs. Removed the standalone publish-mcp-registry.yml to avoid duplicate triggers.
feat: improve MCP tool descriptions to address Glama score issues (#15) Address the following scoring dimensions flagged by Glama.ai: - Behavior: All tools now explicitly state 'Read-only' nature - Parameters: Every tool documents config, repo_path, config_path params - Completeness: Return value format (status + per-check results) described - Usage Guidelines: Each tool explains when to use vs sibling tools - Purpose: Retained clear verb+resource structure Tools updated: server_health, validate_commit_message, validate_branch_name, validate_author_info, validate_push_safety, validate_commit_context, validate_repository_state, describe_validation_rules
PreviousNext