Run SQL queries and inspect database schemas through safe, visible MCP tools.
Copy the AI prompt to install this server into Claude Code, Cursor, or another agent โ or use 1-click editor setup below.
One-click editor setup isnโt available for this listing yet โ we donโt have a confirmed install command, and weโd rather show nothing than point your editor at the wrong package or host. Follow the projectโs own setup instructions, linked above.
A fast SQL workspace for VS Code, and for the AI agents you work with.
Docs ยท Changelog ยท Report a bug ยท Ask a question
Run SQL from any .sql file with Ctrl+Enter and get the results in a
sortable grid inside VS Code. Passwords stay in your OS keychain, and Grain
has no hosted service.

Ctrl+Enter
(Cmd+Enter on macOS).The demo reads two CSV files through Grain's built-in DuckDB connection, so there's nothing to set up. To query your own database, run Grain: Manage Connections, add a profile, and test it before you save.

If Grain is useful to you, a star on this repo helps other developers find it.
Grain can serve your database connections to Claude Code, Cursor, and GitHub Copilot over MCP. Agents get read-only access by default, and every query an agent runs shows up in your Grain results panel, so you can see exactly what it did.
MCP is off until you turn on grain.mcpEnabled in settings. Setup steps for
each client are in the MCP docs, and example
prompts are in examples/agents/.
| Feature | What it does |
|---|---|
| Run from the editor | Ctrl+Enter runs the file; Run Query Under Cursor runs one statement; Run Query in New Tab keeps the previous result |
| Non-blocking queries | Queries run in a background process, so a slow query doesn't freeze VS Code |
| Connection manager | Create, test, and switch database profiles without editing JSON |
| Result grid | Sort, filter, and resize columns, see each column's SQL type, copy a selection as TSV |
| Full export | The grid shows the first 500 rows; export re-runs the query and writes every row to CSV, TSV, or JSON |
| Agent access over MCP | Claude Code, Cursor, and Copilot can query your connections; their results land in your panel |
| Remote setups | Works over WSL, dev containers, GitHub Codespaces, and Remote - SSH |
| Relational databases | PostgreSQL | MySQL | SQL Server | SQLite |
|---|---|---|---|---|
| Data warehouses | Snowflake | BigQuery | ||
| Query engines & lakehouses | Trino / Presto | DuckDB | ||
| Search | Elasticsearch |
Through Trino or Presto you can query your cluster's Iceberg, Delta Lake, and Hive tables. DuckDB queries local CSV and Parquet files directly.
PostgreSQL and Trino / Presto are bundled with the extension. The others load their driver on first use, and if a driver is missing, Grain tells you what to install.
Need another database? Request a connector. Requests with the most ๐ get built first.
Runnable queries for Postgres, MySQL,
Elasticsearch, and DuckDB, plus
agent prompts. Open any .sql file with Grain installed
and press Ctrl+Enter.
grain.mcpSafeMode on (the
default), agents can only run SELECT, SHOW, DESCRIBE, EXPLAIN, WITH,
and metadata queries. Agents can't read stored passwords or change saved
connections.grain.telemetry.enabled.Is Grain open source?
No. Grain is closed-source. This repo holds the issue tracker, docs, and
examples.
Which databases does it support?
The nine listed above. To ask for another one,
request a connector.
Do my queries or passwords leave my machine?
No. There's no Grain server. Queries go straight from VS Code to your database,
and passwords stay in your OS keychain. See Privacy for what the
anonymous telemetry does and doesn't include.
How do I connect Claude Code or Cursor?
Turn on grain.mcpEnabled, then follow the steps for your client in the
MCP docs.
Why does my database show a driver error?
Some connectors load their driver on first use. The error message names what
to install. If it's still failing after that,
file a bug report
with the Output panel logs (View โ Output โ Grain).
We don't have a fixed roadmap yet. What we build next depends a lot on what people ask for here, especially connector requests. See CONTRIBUTING.md for how to file a good issue.
Grain is closed-source. See LICENSE.
No reviews yet โ be the first to share how this listing worked for you.
Showcase your server listing on GitHub or your project documentation. Embed this dynamic SVG badge to highlight official listing status and live engagement.
[](https://allmcps.com/mcp/grain)<a href="https://allmcps.com/mcp/grain"><img src="https://allmcps.com/api/badge/grain?style=directory" alt="Grain on AllMCPs" /></a>