Installation
Supported Environments
Grain works in: Claude Desktop, Claude Code, VS Code, Cursor, Windsurf, Codex. grain connect sets up Grain in these agents. We test Claude Desktop and VS Code.
Install the CLI
One command. It brings its own runtime, so the machine needs no Node, npm or VS Code.
macOS and Linux:
curl -fsSL https://grain.tools/install.sh | sh
Windows (PowerShell):
irm https://grain.tools/install.ps1 | iex
The installer verifies the download’s checksum, installs Grain into .grain
in your home folder, starts it in the background, and adds its bin folder to
your PATH. It never asks for administrator rights. Open a new terminal, then
connect your AI agents:
grain connect
To try the browser workspace, which is in Beta and may be unstable, run grain ui.
To leave your shell profile and PATH untouched, set GRAIN_NO_MODIFY_PATH=1
before running the installer and add the folder yourself. grain uninstall
removes Grain and keeps your connections and downloaded drivers.
Minimal or container Linux environments without systemd are supported. Grain starts when an agent or editor needs it instead of staying running.
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, or install it
from the command line:
code --install-extension pattrnlabs.grain
Set up each client
Every client runs grain --stdio. Codex, VS Code, Cursor and Windsurf pick
up the PATH the installer set, so grain is enough. Claude Desktop does not
read your shell’s PATH, so give it the full path: /Users/you/.grain/bin/grain
on macOS (run echo "$HOME/.grain/bin/grain" to print yours), or
C:\Users\you\.grain\bin\grain.cmd on Windows (double each backslash
inside JSON).
VS Code
- Open the Extensions view (
Ctrl+Shift+X/Cmd+Shift+X). - Search
Grain SQLand install it. - Reload the window if prompted.
This gives you the SQL editor tab and the local Grain service in one step. VS Code’s SQL editor uses it directly; Copilot Chat still needs the MCP entry below.
To let Copilot Chat’s agent mode reach the same service, run MCP: Open User
Configuration and add grain --stdio under the servers key. The full JSON is
in Connect your agent.
Cursor
Install the extension from Open VSX the same way as VS Code (step above), or register the MCP server directly:
Settings → MCP Servers → Add new MCP server → type command, name
grain, command grain --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": "grain",
"args": ["--stdio"]
}
}
}
Copilot
GitHub Copilot Chat’s agent mode reads VS Code’s own MCP configuration, so use
the same servers entry as the VS Code section above.
Codex
Add a grain entry to your Codex CLI config (~/.codex/config.toml):
[mcp_servers.grain]
command = "grain"
args = ["--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": "/Users/you/.grain/bin/grain",
"args": ["--stdio"]
}
}
}
Restart Claude Desktop fully after editing. If the file already has an
mcpServers object, add only the "grain" entry inside it.