Skip to content

Update DiskHound's MCP server to SDK 1.32.1 - #74

Merged
tzarebczan merged 5 commits into
mainfrom
fix/mcp-followups
Oct 15, 2026
Merged

tzarebczan merged 5 commits into
mainfrom
fix/mcp-followups

Conversation

@tzarebczan

@tzarebczan tzarebczan commented Oct 14, 2026 •

Copy link
Copy Markdown
Owner

Summary

Follow-up to #71. DiskHound was on @modelcontextprotocol/sdk 1.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/server 2.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:

  • A tools/call or prompts/get that omits arguments is valid. Codex does that for tools with no fields. The HTTP layer still fills {} so refusal logging sees one shape.
  • Each tool call is capped at 2048 argument elements. diskhound_measure_removal allows 1000 paths, which is about 1002 elements. A larger payload is refused before the handler runs.

OAuth, the two gaps #71 called out:

  • redirect_uris must be http://127.0.0.1, http://localhost, or http://[::1] with an explicit port. authorize checks the same thing.
  • An unapproved registration stays in memory. Stopping the listener drops it. The client file (mode 0600) is written when the user approves, and a relaunch loads only those clients.
  • Forgetting revoked sessions frees their client slots while DiskHound keeps listening. A revoked session still holds its slot until then, and a client that still has a session stays.

The stdio helper, from review of this branch:

  • A saved token is sent only after the listener proves the mode-0600 key in the user's data folder (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.
  • The proof and the POST that carries the bearer are the same connection, and the helper does this again for every request. A proof from an earlier call does not cover the next one.
  • If the port is closed before that POST, initialize still connects and the saved token stays. If the POST was written and the reply never comes back, the helper says the outcome is unknown.
  • Paths from the agent keep a trailing space, because that is a different filename. A leading space on an absolute path is rejected instead of being turned into a relative path, so Trash and permanent-delete confirmation use the real name.

Tests

bun run typecheck and 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 --locked for native/diskhound-mcp covers 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.

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.
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 14, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-15T01:02:09.252477Z ffc1ca2 New commits
🔒 Security Review ✅ Completed 2026-10-14T23:26:27.249880Z 0f30202 PR opened
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment thread src/mcp/agentOAuth.ts Outdated
Comment on lines 159 to 160
const evict = [...this.clients.keys()].find((id) => !this.durable.has(id));
if (evict === undefined) throw new InvalidRequestError("OAuth client limit reached");

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment thread src/mcp/agentOAuth.ts
this.clients.delete(id);
released = true;
}
if (released) this.write(this.serialize());

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge 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.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment thread src/mcp/listenerProof.ts

const key = randomBytes(LISTENER_KEY_BYTES);
const temporary = `${file}.${process.pid}.tmp`;
writeFileSync(temporary, key, { mode: 0o600 });

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge 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.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment thread src/mcp/agentOAuth.ts
}
const body = this.serialize();
// Drop unapproved rows and public redirects left by older builds.
if (dropped) this.write(body);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge 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.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment thread e2e/stdio-agent.spec.ts
* 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;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

@tzarebczan
tzarebczan merged commit c6e5569 into main Oct 15, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant