Skip to content

feat(mcp): register loopover_watch_issues as a local stdio tool - #7959

Closed
real-venus wants to merge 1 commit into
JSONbored:mainfrom
real-venus:feat/watch-issues-stdio-tool-7763
Closed

feat(mcp): register loopover_watch_issues as a local stdio tool#7959
real-venus wants to merge 1 commit into
JSONbored:mainfrom
real-venus:feat/watch-issues-stdio-tool-7763

Conversation

@real-venus

Copy link
Copy Markdown
Contributor

Summary

Closes #7763loopover_watch_issues has a remote MCP tool (src/mcp/server.ts) and a watch CLI command, but no local stdio MCP tool registration. #6746 added the REST route + CLI but never the matching stdio tool, so a self-host operator using the local MCP server (not the CLI or remote MCP) couldn't call it.

What changed (packages/loopover-mcp/bin/loopover-mcp.ts)

  • Extracts the /v1/contributors/:login/watches dispatch into a shared watchIssuesRequest helper (list=GET, watch=POST, unwatch=DELETE) and reuses it in both the watch CLI and the new stdio tool — so there's no duplicated HTTP logic (the CLI previously inlined the three calls).
  • A registerStdioTool("loopover_watch_issues", …) block next to the other contributor-scoped tools, mirroring the sibling pattern. login resolves from arg / active session / LOOPOVER_LOGIN (same as the CLI); action defaults to list; watch/unwatch require repoFullName.
  • Description centralized via stdioToolDescription(...) + a STDIO_TOOL_DESCRIPTORS entry (category: "utility", matching the remote tool).
  • watchCli is now exported (exactly like maintainCli, loopover_plan_repo_issues has no REST route, CLI command, or local stdio MCP tool #7764) purely so a test can drive it in-process.

Testing / coverage

  • test/unit/mcp-cli-watch-issues.test.ts runs everything in-process (the loopover_plan_repo_issues has no REST route, CLI command, or local stdio MCP tool #7764 isProcessEntrypoint guard + InMemoryTransport) so the registration, the shared helper, and the refactored CLI call sites all get real Codecov-measured coverage — a subprocess spawn can't be v8-instrumented:
    • stdio tool: all three actions (list/watch/unwatch → GET/POST/DELETE), the with/without-labels POST bodies (the helper omits an empty labels key), and both throw branches (no login; watch/unwatch missing repoFullName).
    • watch CLI driven in-process (list/add/remove) so the shared-helper call sites are covered — not just via the subprocess mcp-cli-watch.test.ts, which v8 can't instrument.
  • The existing test/unit/mcp-cli-watch.test.ts (8 subprocess CLI tests) still passes unchanged — the helper preserves the exact request bodies it asserts.
  • Tool-count invariant in test/unit/mcp-tool-rename-aliases.test.ts bumped to 91.

No REST/OpenAPI/CLI-surface change (the route and watch CLI already exist) — ui:openapi:check, command-reference:check, docs/manifest drift all clean; build:mcp clean.

(Supersedes #7957, which was closed on a codecov/patch gap: the CLI's refactored call sites were only exercised by the un-instrumentable subprocess test. This adds the in-process CLI coverage that closes it.)

loopover_watch_issues has a remote MCP tool (src/mcp/server.ts) and a `watch`
CLI command, but no local stdio MCP tool registration. JSONbored#6746 added the REST route
+ CLI but never the matching stdio tool, so a self-host operator using the local
MCP server couldn't call it.

Extracts the /v1/contributors/:login/watches dispatch (list=GET, watch=POST,
unwatch=DELETE) into a shared watchIssuesRequest helper reused by BOTH the `watch`
CLI and the new stdio tool -- no duplicated HTTP logic. login resolves from arg /
active session / LOOPOVER_LOGIN like the CLI; action defaults to list.

test/unit/mcp-cli-watch-issues.test.ts drives it in-process (JSONbored#7764 entrypoint
guard) so the registration + helper get real Codecov coverage, including all three
actions, the with/without-labels POST bodies, and both throw branches. Existing
mcp-cli-watch.test.ts still passes against the refactored CLI. Count 89 -> 90.

Closes JSONbored#7763
@real-venus
real-venus requested a review from JSONbored as a code owner July 21, 2026 23:09
@superagent-security

Copy link
Copy Markdown
Contributor

Superagent didn't find any vulnerabilities or security issues in this PR.

@codecov

codecov Bot commented Jul 21, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 81.97%. Comparing base (fa3581d) to head (6cb0bed).

Additional details and impacted files
@@             Coverage Diff             @@
##             main    #7959       +/-   ##
===========================================
+ Coverage   67.32%   81.97%   +14.64%     
===========================================
  Files         735       91      -644     
  Lines       75458    23703    -51755     
  Branches    22954     4551    -18403     
===========================================
- Hits        50803    19430    -31373     
+ Misses      20857     4062    -16795     
+ Partials     3798      211     -3587     
Flag Coverage Δ
shard-1 0.00% <0.00%> (-58.69%) ⬇️
shard-2 13.23% <100.00%> (?)
shard-3 0.00% <0.00%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
packages/loopover-mcp/bin/loopover-mcp.ts 13.23% <100.00%> (+1.63%) ⬆️

... and 644 files with indirect coverage changes

@loopover-orb loopover-orb Bot added the gittensor:feature Gittensor-scored feature linked to a feature issue — scores a 0.25x multiplier. label Jul 21, 2026
@loopover-orb

loopover-orb Bot commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

Warning

⏸️ LoopOver review result - manual review recommended

Review updated: 2026-07-21 23:40:50 UTC

3 files · 1 AI reviewer · no blockers · CI green · dirty

⏸️ Suggested Action - Manual Review

Review summary
This PR adds the missing local stdio mirror of loopover_watch_issues (list/watch/unwatch), extracting the shared HTTP dispatch into watchIssuesRequest and reusing it in both the new stdio tool and the existing watch CLI, closing #7763 as described. The refactor is correct: the CLI's three call sites now route through the same helper with identical GET/POST/DELETE semantics and the labels-omission behavior is preserved. Test coverage is solid — in-process InMemoryTransport tests exercise all three actions, both label branches, and both throw guards (missing login, missing repoFullName), plus the CLI call sites via watchCli.

Nits — 6 non-blocking
  • packages/loopover-mcp/bin/loopover-mcp.ts:2376 uses `async ({ login, action, repoFullName, labels }: any) =>` for the stdio tool handler instead of a typed shape inferred from watchIssuesShape, matching the existing any-typed pattern in the file but still worth tightening if this file's types are ever cleaned up.
  • The external brief's 'leaked secret' flag at test/unit/mcp-cli-watch-issues.test.ts:48 is just the literal string `in-process-token` used as a fixture token for the test API client, not a real credential.
  • watchIssuesRequest (loopover-mcp.ts:4407) is untyped (`login: any, action: any, ...`) — a small typed union for `action` (`"watch" | "unwatch" | "list"`) would let TypeScript catch a typo in a call site instead of silently falling through to the `list`/GET branch.
  • Consider typing watchIssuesRequest's `action` parameter as the same z.enum values used in watchIssuesShape so a future call-site typo can't silently degrade to the GET/list branch.
  • If this file's `any`-typed stdio handler pattern is intentional per existing convention (as it appears to be, matching sibling registerStdioTool blocks), no change needed — otherwise consider a shared inferred type from the schema shapes.
  • Possible secret-shaped assignment in the diff (generic_secret_assignment) — Verify the value is not a real credential.

Decision drivers

  • ✅ Code review — No blockers (1 reviewer)
  • ✅ Gate result — Passing (No configured blocker found.)
Context & advisory signals — never blocks the verdict
Signal Result Evidence
Linked issue ✅ Linked #7763
Related work ✅ No active overlap found No same-issue or scoped active PR overlap found.
Change scope ✅ 20/20 Low review scope from cached public metadata (1 linked issue).
Validation posture ✅ 25/25 PR body includes validation/test evidence.
Contributor workload ✅ 10/10 Author activity: 112 registered-repo PR(s), 51 merged, 19 issue(s).
Contributor context ✅ Confirmed Gittensor contributor real-venus; Gittensor profile; 112 PR(s), 19 issue(s).
Improvement ✅ Minor risk: clean · value: minor
Linked issue satisfaction

Addressed
The PR adds a registerStdioTool("loopover_watch_issues", ...) block mirroring the sibling pattern, uses stdioToolDescription for the description, and refactors the HTTP calls into a shared watchIssuesRequest helper reused by both the CLI and the new stdio tool, satisfying the issue's core requirements.

Review context
  • Author: real-venus
  • Role context: outside_contributor
  • Public audience mode: oss maintainer
  • Lane context: Repository is configured for direct PR review.
  • Public profile languages: TypeScript, JavaScript, Python, Rust, CSS, MDX, Svelte, Swift
  • Official Gittensor activity: 112 PR(s), 19 issue(s).
  • PR-specific overlap: none found.
Contributor next steps
  • Keep the PR focused and include validation evidence before maintainer review.
Signal definitions
  • Related work = same linked issue, overlapping active PRs, or title/path similarity.
  • Change scope = cached public metadata such as size labels, draft state, and review-burden hints.
  • Validation posture = whether the PR provides enough public validation/test evidence for maintainer review.
  • Contributor workload = public contributor activity and cleanup pressure, not a repo-wide quality failure.
  • Contributor context = public GitHub/Gittensor identity context; non-Gittensor status is not a blocker.
🧪 Chat with LoopOver

Ask LoopOver a question about this PR directly in a comment — grounded only in the same cached, public-safe facts shown above, never a new claim.

  • @loopover ask &lt;question&gt; answers contribution-quality Q&A with source citations and freshness.
  • @loopover chat &lt;question&gt; answers in natural prose from cached decision-pack facts via local inference (maintainer/collaborator; read-only).
  • A plain-language @loopover mention with a real question is routed to the closest matching read-only command automatically — no exact syntax required.

Full command reference: https://loopover.ai/docs/loopover-commands

🧪 Experimental — new and may change.

🟩 Safe / merged · 🟦 Advisory · 🟨 Held for review · 🟥 Blocked / closed


💰 Earn for open-source contributions like this. Gittensor lets GitHub contributors earn for the work they already do — register to start earning →.

Checked by LoopOver, a quiet PR intelligence layer for OSS maintainers.

  • Re-run LoopOver review

@loopover-orb loopover-orb Bot 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.

LoopOver approves — the gate is satisfied and CI is green.

@loopover-orb

loopover-orb Bot commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

LoopOver is closing this pull request on the maintainer's behalf (conflicts with the base branch — resolve and open a fresh PR). This is an automated maintenance action — to pursue this change, please open a new pull request with the issues resolved. Closed PRs may be analyzed later to improve review accuracy, but they are not automatically reopened or re-reviewed.

@loopover-orb loopover-orb Bot closed this Jul 21, 2026

@JSONbored JSONbored left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Merge conflicts, a PR before yours touched the same file:

This branch has conflicts that must be resolved
Use the [web editor](https://github.com/JSONbored/loopover/pull/7959/conflicts) or the command line to resolve conflicts before continuing.

test/unit/mcp-tool-rename-aliases.test.ts

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

Labels

gittensor:feature Gittensor-scored feature linked to a feature issue — scores a 0.25x multiplier.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Register loopover_watch_issues as a local stdio MCP tool

2 participants