Skip to content

feat(mcp): expose thread search - #8722

Closed
juliusmarminge wants to merge 2 commits into
agents/mcp-thread-search/searchfrom
agents/mcp-thread-search/tool
Closed

feat(mcp): expose thread search#8722
juliusmarminge wants to merge 2 commits into
agents/mcp-thread-search/searchfrom
agents/mcp-thread-search/tool

Conversation

@juliusmarminge

@juliusmarminge juliusmarminge commented Aug 30, 2026

Copy link
Copy Markdown
Member

Problem

Agents can read known threads but cannot search durable thread content and then navigate directly to a matching visible message.

Change

Expose t3_thread_search as a read-only MCP tool over the bounded projection query from #8721. The tool:

  • defaults to the calling thread and current project scope
  • supports an optional same-project thread filter and archived opt-in
  • returns bounded snippets, source and storage origin, live pagination state, and nullable V2 read anchors
  • lets t3_thread_read.anchor start inclusively at the matching visible source/message identity
  • maps typed input errors to invalid_request and persistence failures to fixed structural errors without exposing SQL details
  • remains available to every provider, including Claude's read-only allowlist
  • keeps the merged t3_thread_update registration and metadata behavior intact

Behavior

Search is read-only and never imports transcripts, acknowledges child delivery, or returns full messages. An anchor that is foreign, stale, rolled back, or no longer visible fails instead of falling back to a raw ordinal.

Validation

  • vp test run apps/server/src/mcp/OrchestratorMcpToolkit.integration.test.ts apps/server/src/mcp/toolkits/worktree/registration.test.ts packages/contracts/src/orchestratorMcp.test.ts packages/shared/src/t3McpToolPresentation.test.ts (15/15)
  • production MCP registration with a real SQLite/V2 search hit to anchored-read round trip
  • root-object tool schemas, current-project rejection, bounded astral-Unicode result encoding, and provider presentation/allowlist coverage
  • scoped t3, @t3tools/contracts, and @t3tools/shared typechecks
  • targeted lint, format, and git diff --check

Dependency

Upper member of native stack #8785. Depends on #8721.

Implemented by GPT-5.6-Sol via Codex in T3 Code.

@juliusmarminge
juliusmarminge marked this pull request as ready for review August 30, 2026 01:45
@coderabbitai

coderabbitai Bot commented Aug 30, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: d5761cd6-780d-4df6-8211-48816877e81d

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Warning

Your free Security trial is over. An organization admin can activate Security or dismiss this notice.


Comment @coderabbitai help to get the list of available commands.

@github-actions github-actions Bot added vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. size:L 100-499 changed lines (additions + deletions). labels Aug 30, 2026

@macroscopeapp macroscopeapp 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.

Reviewed the new ThreadSearchMcpService and its call sites against the Effect service conventions. One violation found: a standalone ThreadSearchMcpServiceShape interface instead of an inline Context.Service interface. Imports, make/layer naming, dependency acquisition (yield* ThreadManagementService / yield* ProjectionSnapshotQuery), and the test-only Layer.mock seams all look consistent with the conventions.

Posted via Macroscope — Effect Service Conventions

Comment thread apps/server/src/mcp/ThreadSearchMcpService.ts Outdated
@github-actions

github-actions Bot commented Aug 30, 2026

Copy link
Copy Markdown
Contributor

Thread transfer impact

⚠️ The latest CI run did not produce a thread transfer result for 70a74a5.

This comment will update automatically after the next completed run.

@juliusmarminge
juliusmarminge force-pushed the agents/mcp-thread-search/tool branch from 7ae406d to fe198b0 Compare August 30, 2026 01:48
Comment thread packages/contracts/src/orchestratorMcp.ts Outdated
Comment thread apps/server/src/mcp/ThreadSearchMcpService.ts
@macroscopeapp

macroscopeapp Bot commented Aug 30, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Approved at 3430825

Macroscope's review found this PR approvable — This adds a bounded, read-only MCP search tool around the existing projection query, with capability/project scoping, strict result limits, and coverage for contracts, integration, and registration behavior. Existing thread-read behavior and stored data remain unchanged unless the new search/anchor path is explicitly used.

No code changes detected at 70a74a5. Prior analysis still applies.

You can add or adjust custom eligibility rules. Learn more.

@juliusmarminge
juliusmarminge force-pushed the agents/mcp-thread-search/tool branch from fe198b0 to e5585e8 Compare August 30, 2026 01:56
@juliusmarminge
juliusmarminge force-pushed the agents/mcp-thread-search/tool branch 2 times, most recently from eaff951 to 0b3444c Compare August 30, 2026 02:09
@juliusmarminge
juliusmarminge force-pushed the agents/mcp-thread-search/tool branch from 0b3444c to 41673f5 Compare August 30, 2026 17:31
@juliusmarminge
juliusmarminge force-pushed the agents/mcp-thread-search/tool branch 2 times, most recently from 71d9d5c to 37bc376 Compare August 30, 2026 20:38
@juliusmarminge
juliusmarminge force-pushed the agents/mcp-thread-search/tool branch from 37bc376 to 3430825 Compare September 5, 2026 05:57
stack merge was automatically disabled September 7, 2026 18:10

Pull Request is not mergeable

@juliusmarminge

Copy link
Copy Markdown
Member Author

Superseded as the active MCP proposal by #10561 in the rebuilt MCP stack, following the maintainer request to review thin service wrappers separately from service hardening.

This is not a full feature-parity replacement. This filters the global top results, so a project can underfill the requested limit. It is not exhaustive or paginated. Project-first SQL pagination and search-service correctness changes belong in a separate service PR.

Closing this mixed proposal without merging. The remote branch agents/mcp-thread-search/tool and exact head 70a74a55ba4420d213fc2a56e2f627c8bd4d6b96 are retained so the service changes can be extracted for separate review later.

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

Labels

size:L 100-499 changed lines (additions + deletions). vouch:trusted PR author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant