LINQ to DB CLI MCP
The linq2db command-line tool with an MCP server: an agent reads a database schema and runs one SELECT at a time.
- 3,334 ★ on the repository
- Last commit
- MIT
Extended access
Why this level
- The agent reads database data with the profile rights and can change it when `linq2db_execute` is enabled.
Install
- Works in
Manual install
dotnet tool install -g linq2db.cliThe first install command from the README, needs the .NET 10 SDK.
Access and checks
How we reviewExtended accessThe tool runs code or makes network calls and only reads external data.
- The agent reads database data with the profile rights and can change it when `linq2db_execute` is enabled.
This is third-party code. Review the repository files before installing.
What it does
`dotnet linq2db mcp` starts an MCP server over stdio on top of the databases defined as profiles in a local JSON config. The agent first calls `linq2db_info` to learn the profiles, providers, SQL dialects and safety rules. Then `linq2db_schema` returns tables, views, columns, keys and relationships, and `linq2db_query` runs one finished read-only SQL statement. The `linq2db_skill` tool returns a detailed usage guide. The write-capable `linq2db_execute` tool is off by default. It needs the `--enable-execute-tool` flag at server start and `enableExecute: true` in the selected profile. Query responses are capped at 8 MiB, and extra rows are cut off with a warning.
Who it is for. .NET developers who want an agent to see the real schema and data of a database while working on queries and mappings.
Good fit when
- An agent hunts for the cause of a slow query and checks the code against the real data distribution.
- Before editing a mapping you need to know which columns allow NULL and which relationships link the tables.
- An analyst asks a data question and the agent reads the app code and verifies the answer in the database.
- A regression test for a bug needs a sample of real records.
Not a fit when
- A production database holds personal data and there is no separate profile with limited rights.
- You need a migration or DDL tool: `query` is built for reading result sets.
- Only an old .NET SDK is available and version 10 cannot be installed.
Example request
Connect to the dev profile, show the orders table schema and list the ten largest orders from the last month.MCP
- Transport
- stdio
- Authentication
- not required
Limitations
Installing needs the .NET 10 SDK, while running works on .NET 8 or newer. The connection string sits in a config profile: prefer taking it from an environment variable via `--connection-string-env` and keep the credentials file out of git. Windows has an encrypted `credentials` store. The agent can read any table the database user can see, so the profile rights set the access boundary. Legacy Access and Informix drivers may impose bitness requirements.
How to disable. Remove the MCP entry from the client and run `dotnet tool uninstall -g linq2db.cli`. Delete the configuration files with profiles separately, especially if they hold a connection string.
FAQ
How do I enable writes?
Start the server with `--enable-execute-tool` and set `enableExecute: true` in the profile. Without both conditions `linq2db_execute` is not registered. Allow the agent to write only after explicit confirmation.
Which databases are supported?
Those linq2db knows: SQL Server, PostgreSQL, MySQL, Oracle, SQLite, ClickHouse, DB2, Firebird, SAP HANA and more. The provider is set in the profile, and `linq2db_info` lists the available ones.
Can I connect several projects?
Yes. Register the same executable several times with different `--config` files. In each config the `mcp` section sets a name and instructions for its own set of databases.
What if an MCP client is not allowed?
Use `dotnet linq2db query --sql "..."` directly: the command reads the same profiles and prints the result as `json`, `json-table` or `csv`.
Where should I keep the connection string?
Pass it through `--connection-string-env`: a literal string lands in the JSON profile and triggers a warning on `stderr`. Keep the credentials file out of git. On Linux and macOS created files get owner-only permissions.
Discussion
No questions or reviews yet.
Related
MCP serversA Rust terminal database client with MCP and a JSON CLI: agents read schemas and run queries within profile permissions.
One MCP server for SQLite, SQL Server, PostgreSQL and MySQL: read and change data, edit schemas and export to CSV and JSON
An MCP server and the dbcode-cli skill: an agent runs SQL through connections already saved in the DBCode editor extension.
A desktop SQL workspace with a built-in MCP server: the agent reads the schema and runs queries in the same client you already use
MySQL MCP Server Pro
mysql_mcp_server_pro
A MySQL MCP server that runs SQL under access roles, finds tables by comments and analyzes locks, indexes and query plans
A lightweight database workspace with an MCP server: the agent reads the schema, runs queries and explores data in PostgreSQL, MySQL and more
Comparison with similar tools
Cards that share the main search query, and how they differ.
| Tool | Official | Authentication | Repository stars | Main difference |
|---|---|---|---|---|
| LINQ to DB CLI (this card) | yes | not required | 3,334 | |
| MCP Database Server | no | API key | 391 | joins SQLite, SQL Server, PostgreSQL and MySQL in one server and can change data; here writes are off and there are more providers |
| MCP Toolbox for Databases | yes | not required | 16,847 | Google's server with tools from tools.yaml; here the tools are fixed and profiles describe the databases |
README in short
The tool installs as a global dotnet tool. Besides MCP it generates database models and reads schema metadata, and configuration profiles are shared by all commands.