# Elekto MCP for SQL Server

> Elekto MCP for SQL Server is an open-source MCP server for databases. Read-only SQL Server schema inspection and querying for AI assistants. It runs locally on your machine and is started by your AI client.

- **Kind:** MCP server
- **Pricing:** Open source
- **Platforms:** CLI, Self-hosted, Windows, Linux, macOS
- **Repository:** https://github.com/elekto-com-br/elekto-mcp-sql
- **MCP Registry name:** io.github.elekto-com-br/elekto-mcp-sql
- **Categories:** [databases](https://ai-powered.com/categories/databases)
- **Listing updated:** 2026-11-23

## About

Mostly it answers "what is in this database" before it answers anything else. Twenty-one tools cover schemas, tables, views, procedures, functions, extended properties, dependency graphs, index health and column profiles, and a check_permissions tool tells the model what the login cannot see and which GRANT would fix it. Results the login can only partly see say so rather than passing a guess as fact.

Queries go through query_table, which supports filtering, grouping, aggregates, sorting, sampling and pagination, with a max_query_rows setting to cap what leaves the database. compare_schemas diffs two configured databases and generate_dependency_dot emits a Graphviz graph. It targets SQL Server 2017 and later, tested on 2019 and 2022, and ships as a .NET package on NuGet under GPL-3.0.

The README opens with a data warning: rows and definitions returned to the assistant are sent on to the LLM provider. It recommends minimum-privilege accounts, masked or synthetic data and says responsibility rests with the user.

## Features

- **Schema discovery:** List databases, schemas, tables, views, procedures and functions.
- **Definitions and DDL:** Fetch view, procedure and function source and detailed table schemas.
- **Dependency analysis:** Dependency edges, table usage and Graphviz DOT output.
- **Data profiling:** Null ratio, distinct counts, min and max, and top values per column.
- **Index health:** Duplicate and unused index diagnostics plus missing-index suggestions.
- **Permission check:** Shows what the login cannot see and the GRANT that completes it.
- **Capped queries:** query_table with a row limit and a truncated flag.

## Good for

- Let an assistant learn an unfamiliar SQL Server schema
- Trace where a table is referenced across procedures and views
- Compare structure between two databases
- Review index problems on a database

## Install

### Claude Code: Add with the CLI (Terminal)

```sh
claude mcp add elekto-mcp-sql -- dnx Elekto.Mcp.Sql --yes
```

Add --scope user to use it in every project, or --scope project to share it in .mcp.json.

### Claude Code: Or share it with your project (.mcp.json)

```json
{
  "mcpServers": {
    "elekto-mcp-sql": {
      "command": "dnx",
      "args": [
        "Elekto.Mcp.Sql",
        "--yes"
      ]
    }
  }
}
```

### Claude Desktop (claude_desktop_config.json)

```json
{
  "mcpServers": {
    "elekto-mcp-sql": {
      "command": "dnx",
      "args": [
        "Elekto.Mcp.Sql",
        "--yes"
      ]
    }
  }
}
```

Settings → Developer → Edit Config, then quit and reopen Claude Desktop.

### Cursor (~/.cursor/mcp.json)

```json
{
  "mcpServers": {
    "elekto-mcp-sql": {
      "command": "dnx",
      "args": [
        "Elekto.Mcp.Sql",
        "--yes"
      ]
    }
  }
}
```

Use .cursor/mcp.json in a project to share it with the project.

### VS Code (~/.copilot/mcp-config.json)

```json
{
  "mcpServers": {
    "elekto-mcp-sql": {
      "type": "stdio",
      "command": "dnx",
      "args": [
        "Elekto.Mcp.Sql",
        "--yes"
      ]
    }
  }
}
```

Or put the same entry in .mcp.json at your workspace root to share it.

### Codex: Add with the CLI (Terminal)

```sh
codex mcp add elekto-mcp-sql -- dnx Elekto.Mcp.Sql --yes
```

### Codex: Or add to config.toml (~/.codex/config.toml)

```toml
[mcp_servers.elekto-mcp-sql]
command = "dnx"
args = ["Elekto.Mcp.Sql", "--yes"]
```

### Gemini CLI and Antigravity: Gemini CLI (~/.gemini/settings.json)

```json
{
  "mcpServers": {
    "elekto-mcp-sql": {
      "command": "dnx",
      "args": [
        "Elekto.Mcp.Sql",
        "--yes"
      ]
    }
  }
}
```

Or run: gemini mcp add -s user elekto-mcp-sql dnx -- Elekto.Mcp.Sql --yes

### Gemini CLI and Antigravity: Antigravity (~/.gemini/config/mcp_config.json)

```json
{
  "mcpServers": {
    "elekto-mcp-sql": {
      "command": "dnx",
      "args": [
        "Elekto.Mcp.Sql",
        "--yes"
      ]
    }
  }
}
```

Use .agents/mcp_config.json to add it to one workspace only.

### Devin Desktop (~/.config/devin/mcp_config.json)

```json
{
  "mcpServers": {
    "elekto-mcp-sql": {
      "command": "dnx",
      "args": [
        "Elekto.Mcp.Sql",
        "--yes"
      ]
    }
  }
}
```

On Windows the file is %APPDATA%\\devin\\mcp_config.json. Use .devin/mcp_config.json to share it with a project.

### Cline (cline_mcp_settings.json)

```json
{
  "mcpServers": {
    "elekto-mcp-sql": {
      "command": "dnx",
      "args": [
        "Elekto.Mcp.Sql",
        "--yes"
      ]
    }
  }
}
```

Open it from the MCP Servers icon → Configure → Configure MCP Servers.

### Zed (Zed settings.json)

```json
{
  "context_servers": {
    "elekto-mcp-sql": {
      "command": "dnx",
      "args": [
        "Elekto.Mcp.Sql",
        "--yes"
      ]
    }
  }
}
```

Open it with zed: open settings file. Merge context_servers into the settings you already have.

### JetBrains AI Assistant and Junie: AI Assistant (Settings → Tools → AI Assistant → Model Context Protocol (MCP) → Add)

```json
{
  "mcpServers": {
    "elekto-mcp-sql": {
      "command": "dnx",
      "args": [
        "Elekto.Mcp.Sql",
        "--yes"
      ]
    }
  }
}
```

### JetBrains AI Assistant and Junie: Junie (~/.junie/mcp/mcp.json)

```json
{
  "mcpServers": {
    "elekto-mcp-sql": {
      "command": "dnx",
      "args": [
        "Elekto.Mcp.Sql",
        "--yes"
      ]
    }
  }
}
```

Use .junie/mcp/mcp.json to share it with a project.

### Kiro (~/.kiro/settings/mcp.json)

```json
{
  "mcpServers": {
    "elekto-mcp-sql": {
      "command": "dnx",
      "args": [
        "Elekto.Mcp.Sql",
        "--yes"
      ]
    }
  }
}
```

Use .kiro/settings/mcp.json to add it to one workspace only.

### Other clients (your client's MCP settings (most use this shape))

```json
{
  "mcpServers": {
    "elekto-mcp-sql": {
      "command": "dnx",
      "args": [
        "Elekto.Mcp.Sql",
        "--yes"
      ]
    }
  }
}
```

## Tools

From the tool list in its README, going by the names, 19 of 21 tools read data; 2 names don't say. From the server's own tool labels and tool names; not verified by us.

- `list_databases` (name suggests: reads): Databases registered in the configuration.
- `get_database_overview` (name suggests: reads): High-level summary of a database and whether the login sees everything.
- `check_permissions` (name suggests: reads): Shows what the login can and cannot see and the GRANT that completes it.
- `get_schema_summary` (name suggests: reads): Aggregated metrics by schema.
- `list_schemas` (name suggests: reads): Schemas in a database, excluding system schemas.
- `list_tables` (name suggests: reads): User tables with dates, approximate rows and size.
- `list_views` (name suggests: reads): User views, filterable by schema and name.
- `find_columns` (name suggests: reads): Tables and views holding a column matching a pattern.
- `list_procedures` (name suggests: reads): User stored procedures with basic complexity metrics.
- `list_functions` (name suggests: reads): User-defined functions with basic complexity metrics.
- `get_table_schema` (name suggests: reads): Columns, keys, checks, uniques and indexes of a table.
- `get_view_definition` (name suggests: reads): DDL and columns of a view.
- `get_procedure_definition` (name suggests: reads): CREATE PROCEDURE text.
- `get_function_definition` (name suggests: reads): CREATE FUNCTION text.
- `get_dependency_graph` (name suggests: reads): Object dependency edges from foreign keys and SQL dependencies.
- `get_table_usage` (name suggests: reads): References to a table across foreign keys and SQL modules.
- `get_data_profile` (name suggests: reads): Column profile with null ratio, distinct count, min, max and top values.
- `get_index_health` (name suggests: reads): Duplicate and unused index diagnostics and missing-index suggestions.
- `compare_schemas`: Compares table and column structure between two databases.
- `generate_dependency_dot`: Graphviz DOT dependency graph.
- `query_table` (name suggests: reads): SELECT with filtering, grouping, aggregates, sorting, sampling and pagination.

## FAQ

### Can Elekto MCP for SQL Server change data?

It is described as read-only and validates inputs, but the README warns there is always some risk and advises a read-only database account.

### Which SQL Server versions work?

2017 and later; tested on 2019 and 2022.

### Does my data leave my machine?

Results returned to the assistant go to the LLM provider's infrastructure, which the README flags as a privacy risk.

### How can I limit returned data?

Use the max_query_rows setting and a least-privilege login.

### Is Elekto MCP for SQL Server free?

Yes. Elekto MCP for SQL Server is open source, so you can use and self-host it for free.

### How do I add Elekto MCP for SQL Server to Claude Code?

Run this command in your terminal: claude mcp add elekto-mcp-sql -- dnx Elekto.Mcp.Sql --yes

### What are the best alternatives to Elekto MCP for SQL Server?

The closest alternatives to Elekto MCP for SQL Server are Midplane, Datatomcp, Gulliver, GaussDB Read-Only MCP and Zektor.

## Where this comes from

- Description: written from the project's README.
- Install steps: from the official MCP Registry entry.

## Alternatives

- [Midplane](https://ai-powered.com/mcp/midplane): Midplane is an open-source MCP server for databases.
- [Datatomcp](https://ai-powered.com/mcp/datatomcp-2): Datatomcp is a freemium MCP server for analytics and data.
- [Gulliver](https://ai-powered.com/mcp/gulliver): Gulliver is an open-source MCP server for databases.
- [GaussDB Read-Only MCP](https://ai-powered.com/mcp/gaussdb-read-only-mcp): GaussDB Read-Only MCP is an open-source MCP server for databases.
- [Zektor](https://ai-powered.com/mcp/zektor): Zektor is a freemium MCP server for databases.
- [Sqlite Graph MCP](https://ai-powered.com/mcp/sqlite-graph-mcp): Sqlite Graph MCP is an MCP server for databases.
- [Trino](https://ai-powered.com/mcp/trino-2): Trino is an open-source MCP server for databases.
- [APoint MS SQL](https://ai-powered.com/mcp/apoint-ms-sql): APoint MS SQL is a free MCP server for databases.

---
Source: https://ai-powered.com/mcp/elekto-mcp-for-sql-server
