Grain SQL MCP Server
by pattrnlabsio.github.pattrnlabs/grainv0.10.30
Run SQL queries and inspect database schemas through safe, visible MCP tools.
context tax
queued
security
queued
cold start
queued
freshness
Active1d ago
Install Grain SQL MCP server
Install in Claude Code
claude mcp add grain-tools -e GRAIN_CONNECTIONS='<grain-connections>' -- npx -y grain-toolsInstall in Cursor
{
"mcpServers": {
"grain-tools": {
"command": "npx",
"args": [
"-y",
"grain-tools"
],
"env": {
"GRAIN_CONNECTIONS": "<grain-connections>"
}
}
}
}Add to ~/.cursor/mcp.json (global) or .cursor/mcp.json (project).
Install in Claude Desktop
{
"mcpServers": {
"grain-tools": {
"command": "npx",
"args": [
"-y",
"grain-tools"
],
"env": {
"GRAIN_CONNECTIONS": "<grain-connections>"
}
}
}
}Settings → Developer → Edit Config (claude_desktop_config.json), then restart.
Install in VS Code
{
"servers": {
"grain-tools": {
"type": "stdio",
"command": "npx",
"args": [
"-y",
"grain-tools"
],
"env": {
"GRAIN_CONNECTIONS": "<grain-connections>"
}
}
}
}Add to .vscode/mcp.json in your workspace.
Install in Windsurf
{
"mcpServers": {
"grain-tools": {
"command": "npx",
"args": [
"-y",
"grain-tools"
],
"env": {
"GRAIN_CONNECTIONS": "<grain-connections>"
}
}
}
}Add to ~/.codeium/windsurf/mcp_config.json.
Configuration
| Variable | Required | Secret | Description |
|---|---|---|---|
| GRAIN_CONNECTIONS | — | yes | JSON array of Grain connection profiles for headless use. |
| GRAIN_MCP_SAFE_MODE | — | — | Set to false to allow mutating SQL. Defaults to true. |
| GRAIN_MAX_ROWS | — | — | Maximum rows returned by query tools. Defaults to 10000. |
Freshness
Active — last maintenance signal 1d ago. The newest of the signals below sets the band.
Last commit (default branch)
2026-09-23 · 16d ago · GitHub
Latest release
2026-10-08 · 1d ago · GitHub · v0.10.30
Package published
no data · npm/PyPI
Registry entry updated
2026-10-08 · 1d ago · official registry · v0.10.30
FAQ
›How do I install the Grain SQL MCP server in Claude Code?
Run: claude mcp add grain-tools -e GRAIN_CONNECTIONS='<grain-connections>' -- npx -y grain-tools. For Cursor, VS Code, Claude Desktop and Windsurf, use the install tabs above.
›Does Grain SQL require an API key?
Yes. It expects GRAIN_CONNECTIONS, of which 1 is a secret.
›Can I use Grain SQL as a remote (hosted) MCP server?
No hosted endpoint is published; it runs locally over stdio.
›Is Grain SQL in the official MCP registry?
Yes, as io.github.pattrnlabs/grain.
Alternatives to Grain SQL
Other database MCP servers.