Skip to content

Commit ba456e0

Browse files
nzakasmdjermanovic
andauthored
feat: Externalize MCP server (#19699)
* feat: Move MCP server to @eslint/mcp fixes #19682 * Remove unused dependencies * Update docs * Update docs/src/use/mcp.md Co-authored-by: Milos Djermanovic <milos.djermanovic@gmail.com> * Install @eslint/mcp --------- Co-authored-by: Milos Djermanovic <milos.djermanovic@gmail.com>
1 parent dc5ed33 commit ba456e0

File tree

6 files changed

+13
-274
lines changed

6 files changed

+13
-274
lines changed

bin/eslint.js

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -157,19 +157,15 @@ ${getErrorMessage(error)}`;
157157

158158
// start the MCP server if `--mcp` is present
159159
if (process.argv.includes("--mcp")) {
160-
const { mcpServer } = require("../lib/mcp/mcp-server");
161-
const {
162-
StdioServerTransport,
163-
} = require("@modelcontextprotocol/sdk/server/stdio.js");
164-
165-
await mcpServer.connect(new StdioServerTransport());
160+
console.warn(
161+
"You can also run this command directly using 'npx @eslint/mcp@latest'.",
162+
);
166163

167-
// Note: do not use console.log() because stdout is part of the server transport
168-
console.error(`ESLint MCP server is running. cwd: ${process.cwd()}`);
164+
const spawn = require("cross-spawn");
169165

170-
process.on("SIGINT", () => {
171-
mcpServer.close();
172-
process.exitCode = 0;
166+
spawn.sync("npx", ["@eslint/mcp@latest"], {
167+
encoding: "utf8",
168+
stdio: "inherit",
173169
});
174170
return;
175171
}

docs/src/use/mcp.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ Create a `.vscode/mcp.json` file in your project with the following configuratio
2323
"ESLint": {
2424
"type": "stdio",
2525
"command": "npx",
26-
"args": ["eslint", "--mcp"]
26+
"args": ["@eslint/mcp@latest"]
2727
}
2828
}
2929
}
@@ -34,7 +34,7 @@ Alternatively, you can use the Command Palette:
3434
1. Press `Ctrl+Shift+P` (Windows/Linux) or `Cmd+Shift+P` (macOS)
3535
2. Type and select `MCP: Add Server`
3636
3. Select `Command (stdio)` from the dropdown
37-
4. Enter `npx eslint --mcp` as the command
37+
4. Enter `npx @eslint/mcp@latest` as the command
3838
5. Type `ESLint` as the server ID
3939
6. Choose `Workspace Settings` to create the configuration in `.vscode/mcp.json`
4040

@@ -76,7 +76,7 @@ Create a `.cursor/mcp.json` file in your project directory with the following co
7676
"mcpServers": {
7777
"eslint": {
7878
"command": "npx",
79-
"args": ["eslint", "--mcp"],
79+
"args": ["@eslint/mcp@latest"],
8080
"env": {}
8181
}
8282
}
@@ -112,7 +112,7 @@ Add the following configuration to your `~/.codeium/windsurf/mcp_config.json` fi
112112
"mcpServers": {
113113
"eslint": {
114114
"command": "npx",
115-
"args": ["eslint", "--mcp"],
115+
"args": ["@eslint/mcp@latest"],
116116
"env": {}
117117
}
118118
}

lib/mcp/mcp-server.js

Lines changed: 0 additions & 66 deletions
This file was deleted.

package.json

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,6 @@
115115
"@humanfs/node": "^0.16.6",
116116
"@humanwhocodes/module-importer": "^1.0.1",
117117
"@humanwhocodes/retry": "^0.4.2",
118-
"@modelcontextprotocol/sdk": "^1.8.0",
119118
"@types/estree": "^1.0.6",
120119
"@types/json-schema": "^7.0.15",
121120
"ajv": "^6.12.4",
@@ -139,8 +138,7 @@
139138
"lodash.merge": "^4.6.2",
140139
"minimatch": "^3.1.2",
141140
"natural-compare": "^1.4.0",
142-
"optionator": "^0.9.3",
143-
"zod": "^3.24.2"
141+
"optionator": "^0.9.3"
144142
},
145143
"devDependencies": {
146144
"@arethetypeswrong/cli": "^0.17.0",

tests/bin/eslint.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1241,7 +1241,7 @@ describe("bin/eslint.js", () => {
12411241
});
12421242

12431243
child.stderr.on("data", data => {
1244-
assert.match(data.toString(), /ESLint MCP server is running/u);
1244+
assert.match(data.toString(), /@eslint\/mcp/u);
12451245
done();
12461246
});
12471247
});

tests/lib/mcp/mcp-server.js

Lines changed: 0 additions & 189 deletions
This file was deleted.

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy