Elekto.Mcp.Sql
以下摘录自该仓库的 README(片段) · 在 GitHub 读完整 README →
Read-only MCP server for SQL Server 2017+ introspection and querying (tested on 2019 and 2022).
Exposes schema metadata, object definitions, and data queries via the MCP protocol (stdio),
allowing GitHub Copilot (and other MCP clients, like Claude, etc.) to understand your database structure
without storing credentials in the repository.
⚠️ Privacy and Data Security Warning
MCP servers act as a bridge between your local data and AI language models. When you use
this server with an AI assistant (such as GitHub Copilot, Claude, or others), the following
happens:
1. The AI agent calls tools on this server to read data from your SQL Server database.
2. The results — which may include table schemas, stored procedure definitions, or actual
row data — are sent back to the AI agent and transmitted to the LLM provider's
infrastructure for analysis.
3. **This means your data leaves your machine and is sent to a third-party service**
(Microsoft, Anthropic, OpenAI, etc.), subject to their respective terms of service
and privacy policies.
Before connecting this server to any database, carefully consider:
- What data could be read? Does it include PII, financial records, trade secrets,
or other sensitive information?
- Who is the LLM provider and what are their data retention and privacy policies?
- Are you authorized to share this data with that third party under applicable laws
and regulations?
**Recommendations:**
- Never connect to databases containing sensitive data unless you have explicitly assessed
and accepted this risk.
- Use database accounts with the minimum required privileges (read-only, restricted to
specific schemas where possible).
- Use max_query_rows to limit how much data can be returned in a single call.
- Prefer databases with anonymized or synthetic data for development and exploration.
- AI agents can be **extremely creative** in finding ways to execute a task. Altouht this server
is designed to be read-only and to validate all inputs, **there is always a risk of
unintended consequences** when exposing database access to an AI agent.
**Regardless of the precautions you take, the responsibility for any consequences arising
from the use of this tool rests entirely with you.** This software is provided *as is*
with no warranties of any kind.
Available Tools
| Tool | Description |
| -------------------------- | ------------------------------------------------------------ |
| list_databases | Databases registered in the configuration |
| get_database_overview | High-level database summary (counts, size, connection metadata), and whether the login sees everything |
| check_permissions | What the connected login can and cannot see, the GRANT that completes it, and whether it could write |
| get_schema_summary | Aggregated metrics by schema (objects, rows, size) |
| list_schemas | Schemas in a database (excluding system schemas) |
| list_tables | User tables with schema, dates, approximate rows and estimated size; filterable by schema and name pattern |
| list_views | User views, filterable by schema and name pattern |
| find_columns | Every table and view holding a column whose name matches a pattern |
| list_procedures | User stored procedures (with basic complexity metrics) |
| list_functions | User-defined functions (with basic complexity metrics) |
| get_table_schema | Columns with unambiguous type declarations, all extended properties, PKs, FKs, checks, uniques and indexes with key order and declared key width |
| get_view_definition | DDL definition + columns of a view, with the same column detail |
| get_procedure_definition | CREATE PROCEDURE text |
| get_function_definition | CREATE FUNCTION text |
| get_dependency_graph | Object dependency edges (FK + SQL dependencies) |
| get_table_usage | References to a table across FKs and SQL modules |
| get_data_profile | Column profile (null ratio, distinct count, min/max, top values) |
| get_index_health | Duplicate/unused index diagnostics + missing-index suggestions |
| compare_schemas | Compares table/column structure between two configured databases |
| generate_dependency_dot | Graphviz DOT dependency graph with node metadata (node_kind) |
| query_table | SELECT from a table or view with filtering, grouping, secure aggregates, sorting, sampling and pagination |
Upgrading from 1.x
Version 2.0.0 changes what the tools return and how their parameters are declared. Nothing
needs reconfiguring — connection files, .mcp.json and the CLI arguments are unchanged —