LINQ to DB — Claude Code MCP server: schemas and SQL
An MCP server that gives your agent access to database schemas and SQL execution through LINQ to DB. Handy when you need to inspect tables or run a query without leaving the chat.
Open on GitHubWhat LINQ to DB does
LINQ to DB is a C# database access library: a thin layer between your POCOs and the database, with queries written as LINQ expressions and checked by the compiler. The MCP server exposes that library to your agent so it can inspect schemas and run SQL across multiple database providers.
Inside is the same library you'd use in a normal project. Connections are described with DataOptions, and a connection string goes into the DataConnection or DataContext constructor. On .NET Framework you put it in web.config or app.config; there's also a custom settings provider via ILinqToDBSettings. The docs suggest building a configured DataOptions instance once and reusing it everywhere — registering it in your DI container, for example.
One thing to know: LINQ to DB has no change-tracking, so you manage that yourself. If your project already runs on Entity Framework, that's worth checking before you wire this up — there's a separate linq2db.EntityFrameworkCore package for EF projects.
What it helps with
- inspect table structure and relations without opening a DB client
- run SQL against several database providers from one place
- compare the database schema against generated model code
- catch query errors at compile time instead of runtime
- configure a connection string once and reuse it in DI
Example prompts for the agent
- Show me the schema of the Orders table and how it relates to Customers
- Run a query: how many orders came in last month
- Compare table structures across two databases and list the differences
How to install LINQ to DB
Install
The MCP registry has no launch command for it: see the repository README
Step by step, with commands for each platform: How to add an MCP server to Claude Code, Codex, Cursor, VS Code, Gemini CLI and more
Questions about LINQ to DB
How do I install LINQ to DB in Claude?
There's no install command for Claude — add the MCP server manually in your client's MCP configuration.
What does LINQ to DB do?
It's a C# database access library that uses LINQ expressions instead of magic strings. The MCP server exposes it to your agent for schema inspection and SQL execution.
Does LINQ to DB handle change-tracking?
No, there's no built-in change-tracking, so you manage it yourself. In return you get more control over queries and faster data access.