docs/src/use/mcp.md
{%- from 'components/npm_tabs.macro.html' import npm_tabs with context %}
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 ServerCommand (stdio) from the dropdownnpx @eslint/mcp@latest as the commandESLint as the server IDWorkspace Settings to create the configuration in .vscode/mcp.jsonIf 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.
If your project uses a TypeScript configuration file (eslint.config.ts, eslint.config.mts, or eslint.config.cts), additional setup is required for the MCP server to load it. There are two approaches depending on your environment. For more details, see TypeScript Configuration Files.
When you run the MCP server with npx @eslint/mcp@latest, ESLint is installed into a temporary directory and cannot resolve jiti from your project's node_modules. To use jiti for TypeScript config loading, install both @eslint/mcp and jiti locally:
{{ npm_tabs({ command: "install", packages: ["@eslint/mcp", "jiti"], args: ["--save-dev"] }) }}
Then update your MCP configuration to use the locally installed server (without @latest, so npx resolves the local binary):
VS Code (.vscode/mcp.json):
{
"servers": {
"ESLint": {
"type": "stdio",
"command": "npx",
"args": ["@eslint/mcp"]
}
}
}
Cursor / Windsurf (.cursor/mcp.json or ~/.codeium/windsurf/mcp_config.json):
{
"mcpServers": {
"eslint": {
"command": "npx",
"args": ["@eslint/mcp"]
}
}
}
When @eslint/mcp is installed locally, its bundled ESLint resolves jiti from the shared node_modules directory via standard Node.js module resolution.
Yarn 2+ uses Plug'n'Play by default and does not create a node_modules directory. To run npx @eslint/mcp in a Yarn project, set nodeLinker to node-modules in your .yarnrc.yml and run yarn install again:
nodeLinker: node-modules
With a node_modules directory present, the npx configuration shown above works as expected. The nodeLinker: pnpm setting also works. Only the default Plug'n'Play (nodeLinker: pnp) mode is not supported with npx @eslint/mcp.
If you're using Node.js >= 22.13.0, you can load TypeScript configuration files without jiti by enabling Node.js type stripping and the ESLint unstable_native_nodejs_ts_config flag. Set these as environment variables in your MCP configuration.
VS Code (.vscode/mcp.json):
{
"servers": {
"ESLint": {
"type": "stdio",
"command": "npx",
"args": ["@eslint/mcp@latest"],
"env": {
"ESLINT_FLAGS": "unstable_native_nodejs_ts_config",
"NODE_OPTIONS": "--experimental-transform-types"
}
}
}
}
Cursor / Windsurf (.cursor/mcp.json or ~/.codeium/windsurf/mcp_config.json):
{
"mcpServers": {
"eslint": {
"command": "npx",
"args": ["@eslint/mcp@latest"],
"env": {
"ESLINT_FLAGS": "unstable_native_nodejs_ts_config",
"NODE_OPTIONS": "--experimental-transform-types"
}
}
}
}
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