Skip to content

Installation

Supported Environments

Grain works in: VS Code, Cursor, Windsurf, Copilot, Codex, and Claude Desktop.

Install the CLI

One command attaches Grain to any MCP client, on every platform. It needs no global install — -y matters because an MCP client starts the server with no terminal, so npm’s install prompt would have nobody to answer it.

npx -y grain-tools --stdio

To install it globally instead:

curl -fsSL https://grain.tools/install.sh | sh

Install the Extension

The extension provides both the editor workspace and the local MCP daemon. It is a VS Code extension, so it installs the same way in VS Code, Cursor, and Windsurf — search Grain SQL in your editor’s Extensions view.

Set up each client

Whichever client you use, it needs to reach the same command from Install the CLI. What follows is where to paste it.

VS Code

  1. Open the Extensions view (Ctrl+Shift+X / Cmd+Shift+X).
  2. Search Grain SQL and install it.
  3. Reload the window if prompted.

This gives you the SQL editor tab and the local daemon in one step — no separate MCP configuration needed for VS Code’s own UI.

To let Copilot Chat’s agent mode reach the same daemon, either install the extension above (it registers automatically), or, without the full editor UI, open the Extensions view and search @mcp Grain — the gallery entry carries the command, so there’s nothing to paste.

Cursor

Install the extension from Open VSX the same way as VS Code (step above), or register the MCP server directly:

Settings → MCP ServersAdd new MCP server → type command, name grain, command npx -y grain-tools --stdio.

Windsurf

Install the extension from Open VSX the same way as VS Code, or add the server through Cascade’s MCP settings (Windsurf Settings → Cascade → MCP Servers → Add server, or edit the config file directly):

{
  "mcpServers": {
    "grain": {
      "command": "npx",
      "args": ["-y", "grain-tools", "--stdio"]
    }
  }
}

Copilot

GitHub Copilot Chat’s agent mode reads VS Code’s own MCP configuration, so this is the same setup as the VS Code section above — install the extension, or search @mcp Grain in the Extensions view if you only want the MCP connection.

Codex

Add a grain entry to your Codex CLI config (~/.codex/config.toml):

[mcp_servers.grain]
command = "npx"
args = ["-y", "grain-tools", "--stdio"]

Restart Codex after editing.

Claude Desktop

Claude Desktop has no command-line registration, so it’s configured by file.

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Windows: %APPDATA%\Claude\claude_desktop_config.json
{
  "mcpServers": {
    "grain": {
      "command": "npx",
      "args": ["-y", "grain-tools", "--stdio"]
    }
  }
}

Restart Claude Desktop fully after editing. If the file already has an mcpServers object, add only the "grain" entry inside it.

Documentation