# feat\(mcp\): expose current environment diagnostics · PR \#8726 · pingdotgg/t3code

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

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

Visibility: public

State: closed

Source repository: pingdotgg/t3code

Source branch: agents/mcp-environment/read

Target branch: t3code/codex-turn-mapping

Head commit: 512391db91759dc9f4a7b1e93ca3075fe1e90dea

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

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

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

## Description

---

## Problem

Agents could not inspect the identity or safe operational state of the T3 environment backing their current conversation without relying on unrelated settings payloads.

## Change

Add `t3_environment_read`, backed by the existing environment, provider registry, and settings services. It returns a paged provider-health summary, explicit safe capabilities, and a narrow server-owned preference projection.

## Behavior

The tool is current-environment only, read-only, and closed-world. It reads cached provider state without refreshing, installing, or authenticating providers. Human-readable diagnostics are Unicode-safe and bounded; credentials, provider configuration, model inventories, paths, raw diagnostics, and administrative fields never enter the result. Environment mismatch is checked before provider/settings reads, and finite public failure codes do not expose internal causes.

## Focused validation

- allowlisted service projection, capability/mismatch denial, unavailable-service, and Unicode-bound tests
- production HTTP `tools/list` root-object and annotation coverage
- Claude read-only allowlist and shared presentation coverage
- 6 focused files / 18 tests passed across the complete native stack
- server and contracts scoped typechecks, targeted formatting, and `git diff --check`

## Dependency

Bottom layer of native stack 8782, based on `t3code/codex-turn-mapping` at the pinned rollout target. [#8728](https://github.com/pingdotgg/t3code/pull/8728) adds the dependent preference mutation.

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

