# feat\(mcp\): expose branch-backed workspace discovery · PR \#10566 · pingdotgg/t3code

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

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

Visibility: public

State: merged

Source repository: pingdotgg/t3code

Source branch: agents/mcp-thin/workspace-refs

Target branch: agents/mcp-thin/project-launches

Head commit: 1dce00c6a6af3bfabaab3fc77f8d22d704e66fa6

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

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

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

## Description

---

Part 16/16 of the [shared-core and MCP stack](https://github.com/pingdotgg/t3code/stacks/10582). Based on [#10565](https://github.com/pingdotgg/t3code/pull/10565).

Expose GitWorkflowService.listRefs for the calling thread workspace. Existing worktree handoff and status tools stay unchanged.

This discovers branch-backed refs/worktrees only. Detached unbound inventory and switching an existing checkout require a shared service operation and are intentionally not rebuilt inside MCP. The old workspace work is retained for that extraction.

MCP-only rebuild of [#8685](https://github.com/pingdotgg/t3code/pull/8685), [#8680](https://github.com/pingdotgg/t3code/pull/8680), preserving attribution to Julius Marminge's original work. Original branches remain available for separate service follow-ups.

Validation: The composed stack passes 94 tests across 12 focused files, including shared core MCP and real MCP/V2 integration, attachment intake, project RPC/service contracts, and client model command selection. Server/contracts/shared/client-runtime typechecks and targeted format/lint/diff checks pass. New behavior coverage lives with the shared operation; no per-tool mock suite was added. Current-head CI is shown below.

Layer size: 5 files, +65/-1. No domain-service production implementation or documentation files change in this MCP layer.

Prepared with Codex in the OpenAI agent runtime.

<!-- Macroscope's pull request summary starts here -->
<!-- Macroscope will only edit the content between these invisible markers, and the markers themselves will not be visible in the GitHub rendered markdown. -->
<!-- If you delete either of the start / end markers from your PR's description, Macroscope will append its summary at the bottom of the description. -->
> [!NOTE]
> ### Add `t3_worktree_list` MCP tool for branch-backed workspace discovery
> - Adds a readonly `t3_worktree_list` tool to the worktree toolkit that lists git refs using the caller's worktree path or the project workspace root.
> - The handler checks the worktree capability and project existence, returning structured failures when either is missing; git errors map to an unavailable failure.
> - Registers the tool in `CLAUDE_READ_ONLY_T3_MCP_ALLOWED_TOOLS` and the `T3_MCP_TOOLS` presentation registry (label "List workspace branches"), and updates the Claude readonly allowlist test to cover the new tool.
>
> <!-- Macroscope's review summary starts here -->
>
> <sup><a href="https://app.macroscope.com">Macroscope</a> summarized 1dce00c.</sup>
> <!-- Macroscope's review summary ends here -->
>
<!-- Macroscope's pull request summary ends here -->
