Repository navigation
Update DiskHound's MCP server to SDK 1.32.1 - #74
Conversation
SDK 1.32 accepts a tools/call or prompts/get that omits arguments, and caps how many elements one call may carry. A registration's redirect has to be an http loopback URL. Unapproved clients stay in memory and are written only after the user approves.
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 0f3020241f
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| const evict = [...this.clients.keys()].find((id) => !this.durable.has(id)); | ||
| if (evict === undefined) throw new InvalidRequestError("OAuth client limit reached"); |
There was a problem hiding this comment.
Evict clients whose sessions have been revoked
Once 256 clients have completed approval during one server lifetime, every ID is in durable, so this lookup can never find an eviction candidate. Revoking sessions—or even using Forget revoked—only updates the policy store and never removes IDs from this set, causing every new client registration to fail with OAuth client limit reached until the user both forgets the sessions and restarts/toggles the listener. Reconcile durable with the current non-revoked policy sessions before enforcing the cap, as the previous implementation did.
Useful? React with 👍 / 👎.
Approving 256 clients and then choosing Forget revoked left those records in the listener until the next launch, so a new registration was refused. Drop forgotten records when the cap is full. A revoked session still holds its slot, and a client that still has a session stays.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 6b30b5ae10
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| this.clients.delete(id); | ||
| released = true; | ||
| } | ||
| if (released) this.write(this.serialize()); |
There was a problem hiding this comment.
Budget the forgotten-client rewrite path
When registration occurs at the client cap after revoked sessions have been forgotten, releaseForgotten() reaches this newly added client-store rewrite, but mcp-client-registration-at-cap only fills the map with unapproved, non-durable clients and therefore records zero I/O. Add an I/O-budget scenario that seeds durable clients, forgets their revoked sessions, and measures the subsequent registration so this event-driven read/write path and its projections are checked in.
AGENTS.md reference: AGENTS.md:L11-L17
Useful? React with 👍 / 👎.
The stdio helper treated DiskHound's public OAuth name as proof it owned port 51735, so another account could bind that port and collect a saved token. It now requires an HMAC of a fresh nonce against the mode-0600 listener key, and the key itself is never sent. agentPath no longer trims. A trailing space is part of the filename, and the confirm dialog was being shown a different path.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 53737e3263
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
|
||
| const key = randomBytes(LISTENER_KEY_BYTES); | ||
| const temporary = `${file}.${process.pid}.tmp`; | ||
| writeFileSync(temporary, key, { mode: 0o600 }); |
There was a problem hiding this comment.
Add a budget for listener-key creation
On the first enable of AI Agents, or after the key is removed, AgentAccessServer.start() reaches this new write-and-rename path, but no measureFsIo scenario or src/test/io-budgets.json entry covers it; the renderer agent test starts the listener in beforeAll, outside its measurement windows. Add a checked-in first-enable budget with the required daily write/byte projections so regressions in this event-driven persistence path are detected.
AGENTS.md reference: AGENTS.md:L11-L17
Useful? React with 👍 / 👎.
A proof from an earlier call stayed valid, so the next request could hand the bearer to whoever had since bound port 51735. The helper now checks a fresh HMAC on the same connection that carries the token, and it does that again for every request. A connect failure before that POST still answers initialize locally and keeps the saved token. A failure after the POST is reported as unknown.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 3e2de8438a
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| } | ||
| const body = this.serialize(); | ||
| // Drop unapproved rows and public redirects left by older builds. | ||
| if (dropped) this.write(body); |
There was a problem hiding this comment.
Budget the startup client-store migration
When an existing profile contains an unapproved client or a redirect accepted by an older build, constructing AgentOAuth now rewrites mcp-oauth-clients.json here, but the checked-in I/O tests only measure registration, cap handling, and session lifecycle after construction. Add a migration scenario that seeds a realistic legacy client file, wraps construction in measureFsIo, and records the required write and daily-volume projections so this startup write path remains budgeted.
AGENTS.md reference: AGENTS.md:L11-L17
Useful? React with 👍 / 👎.
The suite redirects HOME so the app does not write the runner's data directory. The listener key is in that home, and the helper was still looking in the runner's, so the approval window never opened.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ffc1ca2dd3
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| * helper has to see that same HOME, or it never asks for approval. | ||
| */ | ||
| function helperEnv(handle: AppHandle): Record<string, string> | undefined { | ||
| if (process.platform !== "linux") return undefined; |
There was a problem hiding this comment.
Isolate the listener key on macOS and Windows
When the stdio E2E suite runs on macOS or Windows, this returns undefined, while enabling the agent server creates or reuses mcp-listener-key under the developer's real ~/Library/Application Support/DiskHound or %LOCALAPPDATA%\DiskHound; --user-data-dir does not relocate that file. Consequently these tests leave state outside handle.dataDir, can interact with an installed DiskHound's listener key, and do not remove it during fixture cleanup. The app and helper both need a platform-appropriate temporary data-directory/key-path override.
AGENTS.md reference: e2e/AGENTS.md:L37-L44
Useful? React with 👍 / 👎.
Summary
Follow-up to #71. DiskHound was on
@modelcontextprotocol/sdk1.30.0. The latest v1 release is 1.32.1 (5 Oct 2026), which is the line that still speaks the initialize handshake Claude Code, Claude Desktop, and Codex use (2025-06-18).SDK v2 (
@modelcontextprotocol/server2.3.1) implements spec 2026-07-28. That revision drops the session and the initialize handshake. The stdio helper and these clients still start with initialize, so this PR stays on v1.What 1.32.1 changes here:
tools/callorprompts/getthat omitsargumentsis valid. Codex does that for tools with no fields. The HTTP layer still fills{}so refusal logging sees one shape.diskhound_measure_removalallows 1000 paths, which is about 1002 elements. A larger payload is refused before the handler runs.OAuth, the two gaps #71 called out:
redirect_urismust behttp://127.0.0.1,http://localhost, orhttp://[::1]with an explicit port.authorizechecks the same thing.The stdio helper, from review of this branch:
mcp-listener-key) with HMAC-SHA256 of a nonce the helper just minted. Copying DiskHound's public resource name is not enough: another account can bind port 51735 and copy that name.initializestill connects and the saved token stays. If the POST was written and the reply never comes back, the helper says the outcome is unknown.Tests
bun run typecheckand the MCP vitest files, including the OAuth and I/O budget tests. Unapproved registration is now 0 writes. Approval writes the client record plus the policy. A regression fills the 256-client cap, revokes and forgets, and registers again without restarting.cargo test --lockedfornative/diskhound-mcpcovers the shared connection, a second listener that only copies the public name, and a socket that drops after the bearer is written.The review list before Trash and permanent delete is still the open product gap from #71. These calls still wait on the native confirm dialog.