Skip to content

feat: enable mcp to communicate with IDE via JSON-RPC server #2640

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 30 commits into
base: master
Choose a base branch
from

Conversation

MaxKless
Copy link
Collaborator

  • refactor: move socket utilities to shared library and add detection
  • feat: create JSON-RPC client with content-length protocol compatibility
  • refactor: remove NxIdeProvider in favor of IIdeJsonRpcClient
  • add ide client and use it
  • refactor mcp to be more dynamic
  • support both ways for now
  • talking between them works!!
  • successful communication between vscode & stdio mcp
  • ensure no stdio output
  • formatting
  • type cleanup

Copy link

nx-cloud bot commented Jul 28, 2025

View your CI Pipeline Execution ↗ for commit 70b6e5a

Command Status Duration Result
nx affected --targets=build,test,e2e-ci --confi... ✅ Succeeded 17m 3s View ↗

☁️ Nx Cloud last updated this comment at 2025-07-31 15:06:19 UTC

@MaxKless MaxKless force-pushed the mcp-ide-comms-jsonrpc branch from 5c45553 to 21f40fc Compare July 30, 2025 12:34
Comment on lines +51 to +53
export const getNxConsoleSocketPath = (workspaceRoot: string): string => {
const path = resolve(join(getSocketDir(workspaceRoot), 'nx-console.sock'));
return platform() === 'win32' ? '\\\\.\\pipe\\nx\\' + path : path;
Copy link
Contributor

Choose a reason for hiding this comment

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

The Windows named pipe path construction may cause issues with path length limitations. Windows named pipes should use a simpler naming convention. Consider modifying the path construction for Windows:

return platform() === 'win32' 
  ? '\\\\.\\pipe\\nx-console-' + createSimpleHash(workspaceRoot) 
  : path;

This approach uses a hash of the workspace root rather than embedding the full file path in the pipe name, which avoids potential path length issues while still maintaining uniqueness per workspace.

Suggested change
export const getNxConsoleSocketPath = (workspaceRoot: string): string => {
const path = resolve(join(getSocketDir(workspaceRoot), 'nx-console.sock'));
return platform() === 'win32' ? '\\\\.\\pipe\\nx\\' + path : path;
export const getNxConsoleSocketPath = (workspaceRoot: string): string => {
const path = resolve(join(getSocketDir(workspaceRoot), 'nx-console.sock'));
return platform() === 'win32' ? '\\\\.\\pipe\\nx-console-' + createSimpleHash(workspaceRoot) : path;
};

Spotted by Diamond

Is this helpful? React 👍 or 👎 to let us know.

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