Skip to content

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

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#7957
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), not hardcoded inline.

Testing / coverage

  • test/unit/mcp-cli-watch-issues.test.ts: drives the tool in-process (the loopover_plan_repo_issues has no REST route, CLI command, or local stdio MCP tool #7764 isProcessEntrypoint guard + InMemoryTransport, mirroring mcp-cli-repo-focus-manifest.test.ts) for real Codecov coverage. Exercises 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).
  • The existing test/unit/mcp-cli-watch.test.ts (8 CLI tests) still passes unchanged against the refactored CLI — 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.

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 22:53
@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

❌ Patch coverage is 76.92308% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 81.85%. Comparing base (fa3581d) to head (5fb255a).

Files with missing lines Patch % Lines
packages/loopover-mcp/bin/loopover-mcp.ts 76.92% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #7957      +/-   ##
==========================================
- Coverage   89.00%   81.85%   -7.16%     
==========================================
  Files          90       91       +1     
  Lines       21504    23703    +2199     
  Branches     3707     4551     +844     
==========================================
+ Hits        19139    19401     +262     
- Misses       2187     4106    +1919     
- Partials      178      196      +18     
Flag Coverage Δ
shard-1 0.00% <0.00%> (?)
shard-2 11.91% <76.92%> (?)
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 11.91% <76.92%> (ø)

@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

Caution

🛑 LoopOver review result - fixes required

Review updated: 2026-07-21 23:00:08 UTC

3 files · 1 AI reviewer · no blockers · CI failing · unstable

🛑 Suggested Action - Fix Blockers

Review summary
This PR extracts the existing watch-issues HTTP dispatch into a shared `watchIssuesRequest` helper and registers it as a new stdio tool `loopover_watch_issues`, closing the gap where the remote MCP tool and CLI existed but no local stdio mirror did. The refactor is mechanically sound — the CLI's three inline calls are replaced by calls to the same helper, preserving exact request bodies, and the tool-count invariant test is correctly bumped to 91. The 'leaked secret' flag on `mcp-cli-watch-issues.test.ts:33` is a false positive: it's just `process.env.LOOPOVER_API_TOKEN = "in-process-token"`, a test fixture placeholder, not a real credential.

Nits — 6 non-blocking
  • packages/loopover-mcp/bin/loopover-mcp.ts:2376,4407 — the new handler params (`{ login, action, repoFullName, labels }: any`) and `watchIssuesRequest(login: any, action: any, ...)` widen typing with `any` rather than typing against `watchIssuesShape`, consistent with the file's existing loose style but still worth tightening incrementally.
  • codecov/patch shows 76.92% patch coverage against the 99% target — the new test file covers the main paths but some branch in the CLI refactor (e.g. the `emit(await watchIssuesRequest(...))` call sites in `watchCli`) may be under-exercised by the existing 8 unchanged CLI tests; worth double-checking coverage report for which line is uncovered.
  • packages/loopover-mcp/bin/loopover-mcp.ts:471-472 — the `min(3).max(200)` / `max(50)` bounds on `watchIssuesShape` duplicate magic numbers already used elsewhere in the file (e.g. `writeToolRepoFullName`); consider reusing `WRITE_TOOL_REPO_FULL_NAME_MAX` style constants for consistency.
  • Confirm the codecov/patch FAILED check's uncovered line(s) map to something other than the three retained-but-refactored branches in `watchCli` (list/add/remove), since the new in-process test only exercises the stdio tool, not the CLI subcommand path post-refactor.
  • Consider typing `watchIssuesRequest`'s `action` param as `"watch" | "unwatch" | "list"` instead of `any` now that it's shared and no longer purely file-internal.
  • Possible secret-shaped assignment in the diff (generic_secret_assignment) — Verify the value is not a real credential.

CI checks failing

  • codecov/patch — 76.92% of diff hit (target 99.00%)

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 ⚠️ 1 scoped overlap Top overlaps are listed below; lower-confidence bulk is hidden.
Change scope ❌ 8/20 High 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 · LLM: moderate
Linked issue satisfaction

Addressed
The PR adds a registerStdioTool("loopover_watch_issues", ...) block mirroring the sibling pattern, uses stdioToolDescription for the description via a new STDIO_TOOL_DESCRIPTORS entry, and refactors the shared REST logic into watchIssuesRequest reused by both the CLI and the new stdio tool, avoiding duplicated HTTP calls, plus adds dedicated test coverage.

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).
  • Related work: Titles/paths share 7 meaningful terms. (PR #7958)
Contributor next steps
  • Start here: Review top overlaps.
  • Then work through the remaining 2 steps in the Signals table above.
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 commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

LoopOver is closing this pull request on the maintainer's behalf (CI is failing (codecov/patch)). 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.

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

1 participant