Skip to content

feat(mcp): add gittensory_find_opportunities tool to the hosted /mcp Worker #2308

Description

@JSONbored

Add the new MCP tool gittensory_find_opportunities to the hosted Worker's /mcp surface (GittensoryMcp in src/mcp/server.ts), composing the ranker + goal-model + AI-policy-map pieces from the companion issues into a single advisory, metadata-only, no-writes tool call. This is the hosted half of the two-surface requirement in #1060; the stdio CLI half is a separate issue below.

Deliverables

  • Register gittensory_find_opportunities via server.registerTool(...) in src/mcp/server.ts, following the exact registration shape of the neighboring tools (e.g. gittensory_get_bounty_advisory at line ~1284 or gittensory_check_before_start at line ~1335): a zod inputSchema (repo-list or search-query + optional MinerGoalSpec fields + a result-count cap), a zod outputSchema, and a description string stating explicitly "metadata-only, no GitHub writes" like every sibling tool.
  • Input shape: { targets: Array<{owner: string; repo: string}> | undefined; searchQuery: string | undefined; goalSpec: <MinerGoalSpecShape> | undefined; limit: number } — at least one of targets/searchQuery required (validated, mirrors existing tools' input-shape validation conventions).
  • Output shape: a ranked array of { owner, repo, issueNumber, title, rankScore, laneFit, freshness, dupRisk, aiPolicyAllowed: true } (only ever returns aiPolicyAllowed: true entries — banned repos never appear in the output, they're filtered upstream) — never expose raw reward/score internals, matching this tool family's public-safe convention (publicSafeFinding in src/rules/predicted-gate.ts:86 as the sanitization precedent).
  • A unit test in test/unit/mcp-discovery.test.ts (or a new sibling test/unit/mcp-find-opportunities.test.ts) connecting a real stdio/Worker MCP client and asserting the tool call returns a well-formed ranked list for a fixture target set, and that a banned-repo target never appears in the result.

References

  • src/mcp/server.ts lines 1284-1345 (gittensory_get_bounty_advisory, gittensory_check_before_start) — the exact server.registerTool(...) registration shape to mirror
  • src/rules/predicted-gate.ts:86 (publicSafeFinding) — the public-safe-output sanitization precedent
  • packages/gittensory-miner/lib/opportunity-fanout.ts, packages/gittensory-engine/lib/opportunity-ranker.ts, packages/gittensory-engine/lib/goal-model.ts (from companion issues) — the pieces this tool composes
  • test/unit/mcp-discovery.test.ts — existing sibling MCP stdio-client test pattern to mirror

Metadata

Metadata

Assignees

No one assigned

    Labels

    gittensor:featureGittensor-scored feature linked to a feature issue — scores a 0.25x multiplier.help wantedExtra attention is needed

    Projects

    Status
    Done

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions