Skip to content

fix(mcp): scope customExtensions to index request#357

Merged
zc277584121 merged 1 commit intozilliztech:masterfrom
Showiix:fix/request-scoped-custom-extensions
Apr 29, 2026
Merged

fix(mcp): scope customExtensions to index request#357
zc277584121 merged 1 commit intozilliztech:masterfrom
Showiix:fix/request-scoped-custom-extensions

Conversation

@Showiix
Copy link
Copy Markdown
Contributor

@Showiix Showiix commented Apr 28, 2026

Summary

Fixes #356.

This makes MCP request-level customExtensions local to the current index_codebase request instead of mutating the shared long-lived Context.supportedExtensions state.

Previously, handleIndexCodebase() called Context.addCustomExtensions(...) for MCP request parameters. Since the MCP server reuses the same Context instance across indexing tasks, a custom extension requested for project A could remain enabled when indexing project B.

Changes

  • Add Context.getEffectiveSupportedExtensions(...) to compute per-operation supported extensions without mutating persistent Context state.
  • Allow Context.indexCodebase(...) to receive request-scoped supported extensions as an optional final argument.
  • Pass the same effective extension list into FileSynchronizer and indexCodebase() so initial indexing and change tracking use consistent file inclusion rules.
  • Keep Context.addCustomExtensions(...) intact for explicit persistent core API usage.
  • Add regression coverage for request-scoped custom extension isolation across sequential indexes on the same Context.

Compatibility

Persistent extension configuration is unchanged:

  • CUSTOM_EXTENSIONS still applies globally.
  • ContextConfig.customExtensions still applies globally.
  • Explicit Context.addCustomExtensions(...) calls still mutate the Context as before.

Only MCP request-level customExtensions are scoped to the current indexing task.

Tests

  • pnpm --filter @zilliz/claude-context-core test
  • pnpm --filter @zilliz/claude-context-core typecheck
  • pnpm --filter @zilliz/claude-context-mcp typecheck
  • pnpm --filter @zilliz/claude-context-core build
  • pnpm --filter @zilliz/claude-context-mcp build
  • git diff --check

@zc277584121 zc277584121 merged commit b56ca04 into zilliztech:master Apr 29, 2026
6 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.

Request-level customExtensions leak between codebases when MCP reuses Context

2 participants