AdoMcp
AdoMcp is a Model Context Protocol (MCP) server that helps large language models (LLMs) understand database structure, read table comments, and execute SQL queries.
README
AdoMcp
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 查询。
<!-- mcp-name: io.github.John0King/adomcp -->
MCP Tools
| 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) |
Recommended Tool Workflow (for LLM agents)
To reduce mistakes (wrong database/schema/object), use tools in this order:
list_connectionsto discover available connections.- If none are available, call
add_connection. - Before inspecting a table/view, call
list_objectsto locateschema + objectType + objectName. - Use
get_table_schemafor column details (type, nullability, PK, default, comments). - Use
get_table_indexeswhen index/key design matters. - Use
query_sqlonly for read-only verification. - Use
execute_sqlonly 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.
Supported Databases
| 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 · SqlSugarCore
Requirements
Quick Start
1. Configure database connections (optional)
Edit src/AdoMcp/appsettings.json and add pre-configured connections under the Databases array.
You can also skip this step entirely and let the LLM add connections dynamically via the add_connection tool.
"Databases": [
{
"Name": "mydb",
"DbType": "SqlServer",
"ConnectionString": "Server=localhost;Database=MyDb;User Id=sa;Password=***;TrustServerCertificate=true;",
"Description": "Main business database"
}
]
Supported DbType values: SqlServer | MySql | PostgreSql | Sqlite | Oracle
Security tip: Use .NET User Secrets or environment variables to manage connection strings in production.
2. Run the server
Automatic mode detection (recommended)
When stdin is redirected (i.e. launched by an MCP client), stdio mode is used automatically.
When run interactively in a terminal, HTTP/SSE mode is used automatically.
dotnet run --project src/AdoMcp
Specify mode manually
# stdio mode (all logs go to stderr; stdout carries only MCP JSON-RPC)
dotnet run --project src/AdoMcp -- --stdio
# HTTP/SSE mode (default: http://localhost:5100, MCP endpoint /mcp)
dotnet run --project src/AdoMcp -- --http
# Via environment variable
ADOMCP_MODE=http dotnet run --project src/AdoMcp
Enable execute_sql (write operations)
By default the execute_sql tool is disabled to prevent unauthorised writes.
Add --allow-any-sql to enable it:
dotnet run --project src/AdoMcp -- --allow-any-sql
# Combine with transport mode
dotnet run --project src/AdoMcp -- --http --allow-any-sql
3. Run via NuGet / dnx (.NET 10)
After the package is published to NuGet.org, you can run it without cloning the repo:
# Install as a global .NET tool once, then run directly
dotnet tool install -g AdoMcp
adomcp
# Or use dnx (.NET 10+) — installs and runs on demand
dnx AdoMcp
dnx AdoMcp -- --allow-any-sql
Dynamic connections at runtime (no config file needed)
LLMs can add new database connections during a session using add_connection:
User: Connect me to Oracle database oradb01
LLM → calls add_connection(
connectionString = "Data Source=oradb01:1521/PROD;User Id=appuser;Password=***;",
dbType = "Oracle",
name = "prod-oracle",
description = "Production Oracle DB"
)
→ returns: Connection 'prod-oracle' (Oracle) added successfully.
LLM → calls list_objects(connectionName = "prod-oracle")
Dynamically-added connections exist only for the lifetime of the process; restart the server or add the connection to appsettings.json for persistence.
Via dnx (after NuGet publish)
{
"mcpServers": {
"adomcp": {
"command": "dnx",
"args": ["-y","AdoMcp"]
}
}
}
HTTP mode
Start the server first:
dnx -y AdoMcp -- --http
Then configure the client:
{
"mcpServers": {
"adomcp": {
"url": "http://localhost:5100/mcp"
}
}
}
Environment variables
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 |
MCP Registries
Official MCP Registry
This repository now includes server.json for the official MCP Registry with the server name io.github.John0King/adomcp.
To publish to the official MCP Registry:
- Publish the NuGet package
AdoMcpto NuGet.org. - Push a version tag such as
v1.0.1, or manually run thePublish to NuGet and MCP RegistryGitHub Actions workflow. - The workflow publishes the NuGet package, authenticates with GitHub OIDC, and publishes
server.jsonto the MCP Registry.
Build & Pack
# Build
dotnet build
# Pack as a NuGet tool (supports dnx)
dotnet pack src/AdoMcp -c Release -o ./nupkg
# Publish to NuGet.org (set NUGET_API_KEY first)
dotnet nuget push ./nupkg/AdoMcp.*.nupkg --source https://api.nuget.org/v3/index.json --api-key $NUGET_API_KEY
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。