Skip to content

feat(mcp): add first-class version tool - #4864

Open
mnriem wants to merge 2 commits into
github:mainfrom
mnriem:mnriem-version-mcp-adapter
Open

mnriem wants to merge 2 commits into
github:mainfrom
mnriem:mnriem-version-mcp-adapter

Conversation

@mnriem

@mnriem mnriem commented Oct 6, 2026

Copy link
Copy Markdown
Collaborator

Description

Adds the first first-class typed MCP tool, specify_version, for the shared version operation introduced in #4863.

The MCP adapter lives beside the CLI command hierarchy in src/specify_cli/mcp_version.py and dispatches directly to _operation_version.collect_version_result(). It returns the established version fields as typed structured content, maps invalid operation results and unexpected failures to sanitized MCP error results, rejects unexpected arguments, and registers through one focused root-server seam. The transitional generic list, describe, and run tools remain unchanged and available.

Tests cover direct operation dispatch without the CLI adapter or subprocess worker, semantic result parity, unavailable OpenSSL, sanitized failures, strict no-argument schema behavior, discovery and registration, in-memory client wire shapes, and a real stdio initialize/list/call flow with protocol-pure stderr.

Testing

  • uv sync --extra test — passed

  • LC_ALL=en_US.UTF-8 .venv/bin/python -m pytest tests/specify_cli/test_mcp_version.py tests/specify_cli/mcp_server tests/specify_cli/test_operation_version.py tests/specify_cli/test_command_version.py tests/specify_cli/test_command_mcp.py -q — 54 passed

  • .venv/bin/python -m pytest tests/specify_cli/test_mcp_version.py tests/specify_cli/mcp_server -q --cov=specify_cli.mcp_version --cov-report=term-missing — 35 passed; mcp_version.py 100% statement coverage

  • LC_ALL=en_US.UTF-8 .venv/bin/python -m pytest -q — 9,756 passed, 19 skipped, 62 warnings

  • uvx ruff check and uvx ruff format --check for all touched Python files — passed

  • git diff --check — passed

  • Full pytest collection against upstream main: 9,764 before, 9,775 after (+11)

  • Tested locally with uv run specify --help

  • Ran existing tests with uv sync && uv run pytest

  • Tested with a sample project (if applicable)

AI Disclosure

  • I did not use AI assistance for this contribution
  • I did use AI assistance (fill in the disclosure below)

AI disclosure: Implemented with GitHub Copilot using GPT-5.6 Sol in autonomous mode; code generation, test generation, validation, and PR drafting.

Assisted-by: GitHub Copilot (model: GPT-5.6 Sol, autonomous)

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings October 6, 2026 22:52

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟡 Changes recommended

The first-class tool lacks required inventory metadata, diagnostic logging, and complete contract coverage.

Review effort: Balanced
Findings: 2 Medium severity · 2 Low severity

Open (4)
What changed in this PR

Adds the first typed MCP tool for the shared version operation.

Changes:

  • Implements typed version results and sanitized MCP errors.
  • Registers the tool alongside transitional tools.
  • Adds unit, in-memory, and stdio coverage.
File Description
src/​specify_cli/​mcp_version.py Implements the typed MCP adapter.
src/​specify_cli/​mcp_server/​server.py Registers the version tool.
tests/​specify_cli/​test_mcp_version.py Tests schemas, dispatch, and failures.
tests/​specify_cli/​mcp_server/​test_server.py Updates discovery expectations.
tests/​specify_cli/​mcp_server/​test_stdio.py Exercises the tool over stdio.

💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread src/specify_cli/mcp_version.py Outdated
Comment thread src/specify_cli/mcp_version.py Outdated
Comment thread src/specify_cli/mcp_version.py
Comment thread tests/specify_cli/test_mcp_version.py
Assisted-by: GitHub Copilot (model: GPT-5.6 Sol, autonomous)

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings October 7, 2026 00:51
@mnriem

mnriem commented Oct 7, 2026

Copy link
Copy Markdown
Collaborator Author

Addressed the review findings in 93084042:

  • log unexpected adapter exceptions through the diagnostic logger while preserving sanitized client errors
  • add the hierarchy-owned version operation descriptor and MCP inventory record with CLI/registration parity coverage
  • omit destructiveHint for the read-only tool
  • lock the exact discovery description and complete nested output schema

Validation:

  • relevant MCP/version matrix: 56 passed
  • focused operation/adapter coverage: 19 passed, 100% statement coverage
  • full suite: 9,758 passed, 19 skipped, 62 warnings
  • collection: 9,777 tests
  • Ruff lint/format and git diff --check: passed

AI disclosure: This review round was implemented and summarized with GitHub Copilot using GPT-5.6 Sol in autonomous mode; code generation, test generation, validation, and comment drafting.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟢 Approval recommended

The implementation follows the shared MCP architecture and provides thorough positive, negative, schema, parity, and protocol coverage.

Review effort: Balanced
Findings: None

Resolved since last review (4)

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants