Model Context Protocol (MCP) is an open standard that enables AI models to interact with external tools and services through a unified interface. The ESLint CLI contains an MCP server that you can register with your code editor to allow LLMs to use ESLint directly.
To use MCP servers in VS Code, you must have the Copilot Chat extension installed. After that, follow these steps so add the ESLint MCP server:
Create a .vscode/mcp.json file in your project with the following configuration:
{
"servers": {
"ESLint": {
"type": "stdio",
"command": "npx",
"args": ["@eslint/mcp@latest"]
}
}
}
Alternatively, you can use the Command Palette:
Ctrl+Shift+P (Windows/Linux) or Cmd+Shift+P (macOS)MCP: Add Server
Command (stdio) from the dropdownnpx @eslint/mcp@latest as the commandESLint as the server IDWorkspace Settings to create the configuration in .vscode/mcp.json
If you want to use the ESLint MCP server across all workspaces, you can follow the previous steps and choose User Settings instead of Workspace Settings to add the MCP server to your settings.json file.
Once your MCP server is configured, you can use it with GitHub Copilot’s agent mode:
If you encounter issues with the ESLint MCP server:
MCP: List Servers from the Command PaletteShow Output to view server logsTo configure the ESLint MCP server in Cursor, follow these steps:
Create a .cursor/mcp.json file in your project directory with the following configuration:
{
"mcpServers": {
"eslint": {
"command": "npx",
"args": ["@eslint/mcp@latest"],
"env": {}
}
}
}
If you want to use the ESLint MCP server across all your Cursor workspaces, create a ~/.cursor/mcp.json file in your home directory with the same configuration.
Once configured, the ESLint MCP server should appear in the “Available Tools” section on the MCP settings page in Cursor.
To configure the ESLint MCP server in Windsurf, follow these steps:
Navigate to Windsurf - Settings > Advanced Settings, or open the Command Palette and select “Open Windsurf Settings Page”.
Scroll down to the Cascade section and click the “Add Server” button. Then select “Add custom server +”.
Add the following configuration to your ~/.codeium/windsurf/mcp_config.json file:
{
"mcpServers": {
"eslint": {
"command": "npx",
"args": ["@eslint/mcp@latest"],
"env": {}
}
}
}
After adding the configuration, press the refresh button to update the list of available MCP servers.
Once configured, you can use ESLint tools with Cascade by asking it to:
Note: MCP tool calls in Windsurf will consume credits regardless of success or failure.
Here are some example prompts to an LLM for running ESLint and addressing its findings:
Lint the current file and explain any issues found
Lint and fix #file:index.js
© OpenJS Foundation and other contributors
Licensed under the MIT License.
https://eslint.org/docs/latest/use/mcp