Database MCP server for schema discovery, comments, and SQL queries.
Copy the AI prompt to install this server into Claude Code, Cursor, or another agent — or use 1-click editor setup below.
💡 Paste into ~/Library/Application Support/Claude/claude_desktop_config.json (macOS) or %APPDATA%\Claude\claude_desktop_config.json (Windows)
AdoMcp is a Model Context Protocol (MCP) server that helps large language models (LLMs) understand database structure, read table comments, and execute SQL queries.
AdoMcp 是一个基于 Model Context Protocol (MCP) 的数据库工具服务,帮助大型语言模型(LLM)理解数据库结构、读取表注释、执行 SQL 查询。
| Tool | Description |
|---|---|
list_connections | List configured database connections |
add_connection | Add (or replace) a database connection at runtime |
remove_connection | Remove a dynamically-added connection |
list_objects | List database objects (table/view/procedure/function/trigger/sequence/synonym, etc.) |
get_table_schema | Get table schema details (columns/types/nullability/PK/default/comments) |
get_table_indexes | Get table indexes |
query_sql | Execute read-only SQL and return CSV |
execute_sql | Execute write SQL (requires --allow-any-sql) |
To reduce mistakes (wrong database/schema/object), use tools in this order:
list_connections to discover available connections.add_connection.list_objects to locate schema + objectType + objectName.get_table_schema for column details (type, nullability, PK, default, comments).get_table_indexes when index/key design matters.query_sql only for read-only verification.execute_sql only when explicitly authorized and server is started with --allow-any-sql.Oracle note: objects without owner prefix may be synonyms. Always confirm the real schema via list_objects first.
| Database | Driver | Comment support |
|---|---|---|
| SQL Server | Microsoft.Data.SqlClient | MS_Description extended properties |
| MySQL / MariaDB | MySqlConnector | TABLE_COMMENT / COLUMN_COMMENT |
| PostgreSQL | Npgsql | obj_description / col_description |
| SQLite | Microsoft.Data.Sqlite | — (SQLite has no native comments) |
| Oracle | Oracle.ManagedDataAccess.Core | ALL_TAB_COMMENTS / ALL_COL_COMMENTS (includes PUBLIC synonyms) |
ORM support: Dapper
AdoMcp loads configuration from multiple sources (later sources override earlier ones):
appsettings.json (in the app directory)appsettings.{Environment}.json~/.adomcp.json — user-level config (%USERPROFILE%\.adomcp.json on Windows), persists connections and AllowAnySql without touching the app directoryADOMCP_You can pre-configure connections in any of these. You can also skip this step entirely and let the LLM add connections dynamically via the add_connection tool.
Supported DbType values: SqlServer | MySql | PostgreSql | Sqlite | Oracle
Security tip: Use .NET User Secrets or environment variables to manage connection strings in production.
~/.adomcp.json)Create ~/.adomcp.json in your home directory to persist personal connections and settings across projects:
By default the server runs in stdio mode (the standard MCP transport for local clients).
Use --http (or ADOMCP_MODE=http) to switch to HTTP/SSE mode.
By default the execute_sql tool is disabled to prevent unauthorised writes.
Enable it via CLI flag, config file, or environment variable (CLI flag wins when explicitly set):
Priority: --allow-any-sql CLI > ADOMCP_ALLOWANYSQL env > ~/.adomcp.json AllowAnySql > appsettings.json AllowAnySql > false (default).
After the package is published to NuGet.org, you can also install it as a global tool:
You can also run dnx directly (installs and runs on demand, .NET 10+):
LLMs can add new database connections during a session using add_connection:
Dynamically-added connections exist only for the lifetime of the process; restart the server or add the connection to appsettings.json for persistence.
Start the server first:
Then configure the client:
All environment variables are prefixed with ADOMCP_ (override appsettings.json):
| Variable | Description |
|---|---|
ADOMCP_MODE | Transport mode: stdio or http (auto-detected when not set) |
ADOMCP_URLS | HTTP listen address, e.g. http://0.0.0.0:5100 |
ADOMCP_ALLOWANYSQL | Enable the execute_sql tool: true or false (default false) |
ADOMCP_DATABASES | JSON-encoded Databases array (overrides config-file connections) |
AdoMcp is registered in the official MCP Registry under the server name io.github.John0King/adomcp.
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/adomcp)<a href="https://allmcps.com/mcp/adomcp"><img src="https://allmcps.com/api/badge/adomcp?style=directory" alt="AdoMcp on AllMCPs" /></a>