Skip to content

fix: filter disabled MCP tools in registerMcpServer + fix agent timeout description - #2423

Open
Correctover wants to merge 1 commit into
MoonshotAI:mainfrom
Correctover:fix/mcp-disabled-filter-and-timeout-description
Open

fix: filter disabled MCP tools in registerMcpServer + fix agent timeout description#2423
Correctover wants to merge 1 commit into
MoonshotAI:mainfrom
Correctover:fix/mcp-disabled-filter-and-timeout-description

Conversation

@Correctover

Copy link
Copy Markdown

Changes

Fix #2421: MCP tools bypass disabled filter during registration

Root cause: registerMcpServer adds MCP tools to the mcpTools map unconditionally. While isMcpToolEnabled() checks mcpDenyPatterns when building the loadable tools list, disabled tools are still registered and accessible through the map.

Fix: Added a mcpDenyPatterns check in the registerMcpServer loop, skipping tools that match any deny pattern before they are registered.

// In registerMcpServer loop:
if (this.mcpDenyPatterns.some((pattern) => picomatch.isMatch(qualified, pattern))) {
  continue;
}

Fix #2420: Agent tool description says "30-minute" but timeout is 2 hours

Root cause: agent.md:12 hardcodes "fixed 30-minute timeout" while DEFAULT_SUBAGENT_TIMEOUT_MS is 2 * 60 * 60 * 1000 (2 hours).

Fix:

  • Updated agent.md:12 to "fixed 2-hour timeout"
  • Updated test assertion in agent.test.ts:131 to match

Files changed

  • packages/agent-core/src/agent/tool/index.ts (+4 lines)
  • packages/agent-core/src/tools/builtin/collaboration/agent.md (1 line)
  • packages/agent-core/test/tools/agent.test.ts (1 line)

…ut description

- Fix MoonshotAI#2421: registerMcpServer now checks mcpDenyPatterns before
  registering MCP tools, preventing disabled tools from being added
  to the tools map unconditionally
- Fix MoonshotAI#2420: Update agent.md from '30-minute timeout' to '2-hour
  timeout' to match DEFAULT_SUBAGENT_TIMEOUT_MS constant
- Update corresponding test assertion
@changeset-bot

changeset-bot Bot commented Jul 30, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 6066b21

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@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: 6066b21a6a

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment on lines +301 to +303
if (this.mcpDenyPatterns.some((pattern) => picomatch.isMatch(qualified, pattern))) {
continue;
}

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 Preserve denied MCP tools for later profile changes

When a server connects while the current profile has an MCP deny pattern, this continue drops the tool from mcpTools entirely. Later useProfile()/setActiveTools() only updates the allow/deny pattern fields and re-filters the existing registry; it does not rediscover or re-register the server, so switching to a profile that allows mcp__server__tool cannot make that tool available again until the MCP server reconnects or the session restarts. Keeping registration complete and enforcing deny at exposure/dispatch time would preserve the existing runtime profile-toggle behavior.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant