Skip to content

fix(mcp): Resolve server activation issues in packaged extension#2363

Merged
shatakshiiii merged 15 commits intoansible:mainfrom
shatakshiiii:fix_mcp_activation
Dec 11, 2025
Merged

fix(mcp): Resolve server activation issues in packaged extension#2363
shatakshiiii merged 15 commits intoansible:mainfrom
shatakshiiii:fix_mcp_activation

Conversation

@shatakshiiii
Copy link
Contributor

@shatakshiiii shatakshiiii commented Dec 8, 2025

Summary -

  • The changes in mcpProvider.ts and extension.ts deals with activation issue.
  • Helper and webpack.config.ts changes were required due to ERR_MODULE_NOT_FOUND error that occurred because the MCP server was compiled with tsc but dependencies weren't bundled, so the runtime couldn't find modules.
  • Now we bundle the MCP server and its dependencies with Webpack (same approach as the Language Server).
  • This approach keeps the vsix size around our limit as we do not rely on node_modules at runtime

JIRA: AAP-59320

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR resolves MCP (Model Context Protocol) server activation issues in packaged VS Code extensions by implementing dual path resolution and ensuring production dependencies are bundled correctly.

  • Updates the build process to copy package.json and install production dependencies in the packaged extension directory
  • Implements fallback logic to detect the CLI path in both packaged extensions and development environments
  • Passes the extension path to the MCP provider to enable proper path resolution

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
tools/helper Enhances packaging process to copy package.json and install production dependencies into out/mcp/ for proper ESM module resolution in packaged extensions
src/utils/mcpProvider.ts Adds constructor to receive extension path, implements findCliPath() method with fallback logic for packaged vs development paths, and updates working directory to use CLI directory
src/extension.ts Updates MCP provider instantiation to pass context.extensionPath to constructor
.config/dictionary.txt Adds "loglevel" to the dictionary for spell-checking

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@shatakshiiii shatakshiiii merged commit bba8fa9 into ansible:main Dec 11, 2025
20 of 27 checks passed
@shatakshiiii shatakshiiii deleted the fix_mcp_activation branch December 11, 2025 05:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

4 participants