# feat\(mcp\): expose thread search · PR \#8722 · pingdotgg/t3code

[View on GitCafe](https://git.cafe/pingdotgg/t3code/pull/8722)

Repository: [pingdotgg/t3code](https://git.cafe/pingdotgg/t3code)

Visibility: public

State: closed

Source repository: pingdotgg/t3code

Source branch: agents/mcp-thread-search/tool

Target branch: agents/mcp-thread-search/search

Head commit: 70a74a55ba4420d213fc2a56e2f627c8bd4d6b96

[Discussion and reviews](https://git.cafe/pingdotgg/t3code/pull/8722)

[Commits](https://git.cafe/pingdotgg/t3code/pull/8722/commits?format=markdown)

[Files changed](https://git.cafe/pingdotgg/t3code/pull/8722/diffs?format=markdown)

## Description

---

## 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](https://github.com/pingdotgg/t3code/pull/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](https://github.com/pingdotgg/t3code/pull/8721).

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

