### Install and Run MCP Proxy Source: https://context7.com/jetbrains/mcp-jetbrains/llms.txt Install and run the proxy directly using npx, or install it globally and run the command. Recommended to use npx for direct execution. ```bash npx -y @jetbrains/mcp-proxy ``` ```bash npm install -g @jetbrains/mcp-proxy mcp-jetbrains-proxy ``` -------------------------------- ### Build from Source Source: https://context7.com/jetbrains/mcp-jetbrains/llms.txt Instructions for building the project from source using Node.js and pnpm. Includes cloning the repository, installing dependencies, and building the project. ```bash # Prerequisites: Node.js >=18, pnpm brew install node pnpm # macOS git clone https://github.com/JetBrains/mcp-jetbrains.git cd mcp-jetbrains pnpm install pnpm build # runs tsc + chmod +x on dist/src/*.js # Run the built binary directly node dist/src/index.js ``` -------------------------------- ### Expected Log Output on Successful Startup Source: https://context7.com/jetbrains/mcp-jetbrains/llms.txt This is the expected output to stderr when the JetBrains MCP Proxy starts successfully and connects to the IDE. It indicates the process of finding the IDE endpoint and initializing the server. ```text Attempting to find a working IDE endpoint... Testing port 63342... Received response from http://127.0.0.1:63342/api/mcp/list_tools: [{"name":"get_open_files",...}]... Found working IDE endpoint at http://127.0.0.1:63342/api Updated cachedEndpoint to: http://127.0.0.1:63342/api Initializing server... Server connected to transport. Scheduled endpoint check every 10 seconds. JetBrains Proxy MCP Server running on stdio ``` -------------------------------- ### Create npx Symbolic Link on MacOS Source: https://github.com/jetbrains/mcp-jetbrains/blob/main/README.md On MacOS, if Node.js is installed via nvm, create a symbolic link in `/usr/local/bin` to your nvm npx executable to resolve detection issues. ```bash which npx &>/dev/null && sudo ln -sf "$(which npx)" /usr/local/bin/npx ``` -------------------------------- ### Claude Desktop Configuration Source: https://github.com/jetbrains/mcp-jetbrains/blob/main/README.md Add this JSON to your `claude_desktop_config.json` to integrate with Claude Desktop. Ensure the Jetbrains product is open before restarting Claude Desktop. ```json { "mcpServers": { "jetbrains": { "command": "npx", "args": ["-y", "@jetbrains/mcp-proxy"] } } } ``` -------------------------------- ### Enable MCP Server Logging Source: https://github.com/jetbrains/mcp-jetbrains/blob/main/README.md Add this configuration to enable logging for the MCP server. ```json "env": { "LOG_ENABLED": "true" } ``` -------------------------------- ### Configure VS Code MCP Server (Workspace Settings) Source: https://context7.com/jetbrains/mcp-jetbrains/llms.txt Add the MCP server configuration to a workspace-level .vscode/mcp.json file. This allows for project-specific MCP server configurations. ```json // .vscode/mcp.json (workspace-level) { "servers": { "jetbrains": { "command": "npx", "args": ["-y", "@jetbrains/mcp-proxy"] } } } ``` -------------------------------- ### Configure External MCP Server Source: https://github.com/jetbrains/mcp-jetbrains/blob/main/README.md Use this configuration for external clients like LibreChat. Replace placeholders with your IDE's debug port and local network IP address. ```yaml mcpServers: intellij: type: stdio command: sh args: - "-c" - "IDE_PORT=YOUR_IDEA_PORT HOST=YOUR_IDEA_LAN_IP npx -y @jetbrains/mcp-proxy" ``` -------------------------------- ### Configure IDE Host Address Source: https://github.com/jetbrains/mcp-jetbrains/blob/main/README.md Specify a different address or host for connecting to the IDE's built-in webserver. ```json "env": { "HOST": "" } ``` -------------------------------- ### List Tools Request Handler Source: https://context7.com/jetbrains/mcp-jetbrains/llms.txt Forwards MCP 'tools/list' requests to the IDE's API and returns tool definitions. Requires a working IDE endpoint to be available. ```typescript server.setRequestHandler(ListToolsRequestSchema, async () => { if (!cachedEndpoint) throw new Error("No working IDE endpoint available."); const toolsResponse = await fetch(`${cachedEndpoint}/mcp/list_tools`); if (!toolsResponse.ok) throw new Error("Unable to list tools"); const tools = await toolsResponse.json(); // tools is an array of MCP ToolDefinition objects, e.g.: // [{ name: "get_open_files", description: "...", inputSchema: { ... } }, ...] return { tools }; }); ``` -------------------------------- ### VS Code Workspace Configuration Source: https://github.com/jetbrains/mcp-jetbrains/blob/main/README.md Alternatively, add this JSON block to a `.vscode/mcp.json` file in your workspace for project-specific configuration. ```json { "servers": { "jetbrains": { "command": "npx", "args": ["-y", "@jetbrains/mcp-proxy"] } } } ``` -------------------------------- ### Configure VS Code MCP Server (User Settings) Source: https://context7.com/jetbrains/mcp-jetbrains/llms.txt Add the MCP server configuration to VS Code's User Settings JSON file. This enables VS Code to use the proxy for IDE interactions. ```json // settings.json (User Settings) { "mcp": { "servers": { "jetbrains": { "command": "npx", "args": ["-y", "@jetbrains/mcp-proxy"] } } } } ``` -------------------------------- ### Configure Specific IDE Port Source: https://github.com/jetbrains/mcp-jetbrains/blob/main/README.md Specify the port of the IDE's built-in webserver if running multiple IDEs with MCP server. ```json "env": { "IDE_PORT": "" } ``` -------------------------------- ### Handle Tool Call Request Source: https://context7.com/jetbrains/mcp-jetbrains/llms.txt Proxies MCP 'tools/call' requests to the IDE, passing arguments and mapping the IDE's response to an MCP CallToolResult. Handles both successful calls and errors. ```typescript // MCP client sends: // { method: "tools/call", params: { name: "get_file_text_by_path", arguments: { path: "src/index.ts" } } } async function handleToolCall(name: string, args: any): Promise { if (!cachedEndpoint) throw new Error("No working IDE endpoint available."); const response = await fetch(`${cachedEndpoint}/mcp/${name}`, { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify(args), }); if (!response.ok) throw new Error(`Response failed: ${response.status}`); const { status, error }: IDEResponse = await response.json(); // IDEResponse: { status: string; error: null } | { status: null; error: string } return { content: [{ type: "text", text: status ?? error }], isError: !!error, }; } // Example successful result: // { content: [{ type: "text", text: "export function log(...) {...}" }], isError: false } // Example error result: // { content: [{ type: "text", text: "File not found: src/missing.ts" }], isError: true } ``` -------------------------------- ### Find Working IDE Endpoint Source: https://context7.com/jetbrains/mcp-jetbrains/llms.txt Locates the active JetBrains IDE by testing API endpoints. It prioritizes environment variables, cached endpoints, and then performs a port scan. ```typescript async function findWorkingIDEEndpoint(): Promise { if (process.env.IDE_PORT) { const testEndpoint = `http://${HOST}:${process.env.IDE_PORT}/api`; if (await testListTools(testEndpoint)) return testEndpoint; throw new Error(`Specified IDE_PORT=${process.env.IDE_PORT} but it is not responding correctly.`); } if (cachedEndpoint != null && await testListTools(cachedEndpoint)) return cachedEndpoint; for (let port = 63342; port <= 63352; port++) { const candidate = `http://${HOST}:${port}/api`; if (await testListTools(candidate)) return candidate; } throw new Error("No working IDE endpoint found in range 63342-63352"); } ``` -------------------------------- ### VS Code User Settings Configuration Source: https://github.com/jetbrains/mcp-jetbrains/blob/main/README.md Add this JSON block to your VS Code User Settings (JSON) file for MCP server integration. ```json { "mcp": { "servers": { "jetbrains": { "command": "npx", "args": ["-y", "@jetbrains/mcp-proxy"] } } } } ``` -------------------------------- ### Run Server and Health Check Source: https://context7.com/jetbrains/mcp-jetbrains/llms.txt Connects the MCP server to the stdio transport and initiates a recurring health check for the IDE endpoint. Handles IDE restarts or port changes. ```typescript async function runServer() { const transport = new StdioServerTransport(); await server.connect(transport); // Re-discover the IDE endpoint every 10 s setInterval(updateIDEEndpoint, 10_000); } runServer().catch(error => { log("Server failed to start:", error); process.exit(1); }); ``` -------------------------------- ### Enable LOG_ENABLED Environment Variable Source: https://context7.com/jetbrains/mcp-jetbrains/llms.txt Enable verbose logging to stderr by setting the LOG_ENABLED environment variable to 'true'. This is useful for debugging connection and tool-call issues. ```json { "mcpServers": { "jetbrains": { "command": "npx", "args": ["-y", "@jetbrains/mcp-proxy"], "env": { "LOG_ENABLED": "true" } } } } ``` -------------------------------- ### Configure IDE_PORT Environment Variable Source: https://context7.com/jetbrains/mcp-jetbrains/llms.txt Set the IDE_PORT environment variable to specify a particular IDE instance when multiple JetBrains IDEs are running. This overrides the default port scanning behavior. ```json { "mcpServers": { "jetbrains": { "command": "npx", "args": ["-y", "@jetbrains/mcp-proxy"], "env": { "IDE_PORT": "63343" } } } } ``` -------------------------------- ### Configure HOST Environment Variable for Remote IDEs Source: https://context7.com/jetbrains/mcp-jetbrains/llms.txt Override the default host address using the HOST environment variable. This is necessary when connecting to an IDE on a different machine or within Docker containers. ```yaml # Example: LibreChat docker-compose MCP config mcpServers: intellij: type: stdio command: sh args: - "-c" - "IDE_PORT=63342 HOST=192.168.0.12 npx -y @jetbrains/mcp-proxy" ``` ```json // Claude Desktop — remote/LAN IDE { "mcpServers": { "jetbrains": { "command": "npx", "args": ["-y", "@jetbrains/mcp-proxy"], "env": { "HOST": "192.168.0.12", "IDE_PORT": "63342" } } } } ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.