Legion MCP logo

Legion MCP

by TheRaLabs

Query and inspect multiple database systems through one MCP interface with SQL, schema discovery, and database selection tools.

Install Legion MCP

Pick your client, then add it in one click or paste the config.

STDIOPython
~/Library/Application Support/Claude/claude_desktop_config.json
claude_desktop_config.json
{
  "mcpServers": {
    "theralabs-legion-mcp": {
      "command": "uvx",
      "args": [
        "database-mcp"
      ],
      "env": {
        "DB_TYPE": "YOUR_VALUE_HERE",
        "DB_CONFIG": "YOUR_VALUE_HERE",
        "DB_CONFIGS": "YOUR_VALUE_HERE"
      }
    }
  }
}

Settings → Developer → Edit Config, merge this into mcpServers, then fully quit and reopen Claude Desktop.

Values are written into the snippet above so you can paste it as is. They never leave your browser.

We couldn’t confirm it starts correctly

We ran the install command but it didn't respond within our test window — this can mean a slow first-time install rather than a real problem.

uvx database-mcp

Process exited before answering initialize.

This is an experimental automated check and can have false negatives — missing environment variables, a slow cold install, etc. It doesn’t necessarily mean something’s wrong. Last checked .

Overview

TheRaLabs/legion-mcp MCP server exposes database connections and SQL operations through the Model Context Protocol. It uses Legion Query Runner connectors with the MCP Python SDK to support PostgreSQL, Redshift, CockroachDB, MySQL, RDS MySQL, SQL Server, BigQuery, Oracle DB, and SQLite. Configure one database with DB_TYPE and DB_CONFIG, or provide multiple connections through DB_CONFIGS and select the target database by ID. Reach for it when an AI assistant needs consistent query and schema tools across different database technologies.

Use cases

  • Query several supported databases from one AI assistant
  • Inspect schemas before generating SQL
  • Find the database that contains a table
  • Return query results as markdown or JSON

Key features

  • Multi-database connection support
  • SQL execution with markdown or JSON results
  • Schema and table inspection
  • Cross-database table discovery
  • Query history access
  • MCP resources and prompts

Tools10

What Legion MCP lets your agent do. Expand a tool for its parameters.

Self-reported~150 tokens of context

Security & health

What it can reach and how reliably it runs — from our own checks, not the maintainer’s claims.

ActiveLast checked

Recent health check succeeded.

26/27 checks healthy over the last 95d

Supply-chain signal

No high-severity advisories surfaced by our automated scan.

Critical 0High 0Medium 0Low 0

Scanned 7d ago via OSV.dev · database-mcp (PyPI)

Adoption & maintenance

Factual signals from GitHub, npm, and our automated checks — not a rating.

GitHub stars95Stargazers on the source repository.
Last commit1y agoMost recent push to the default branch.
Install checkInconclusiveDidn't respond in our test window — often a slow first install.
Tools exposed10Callable tools this server registers over MCP.
Directory activity8 viewsConfig copies, upvotes, and views on AllMCPs.

How Legion MCP works

What TheRaLabs/legion-mcp MCP server does

TheRaLabs/legion-mcp MCP server provides a common MCP interface for querying and inspecting several database systems. Supported connection types include PostgreSQL, Redshift, CockroachDB, MySQL, RDS MySQL, Microsoft SQL Server, BigQuery, Oracle DB, and SQLite. Database access is provided through Legion Query Runner connectors rather than separate database-specific MCP tools.

The server supports both single-database and multi-database configurations. In a multi-database setup, each connection can have an ID and description. Agents can inspect the available connections, identify the database containing a table, review schema details, and then run queries against the selected database.

How it works

TheRaLabs/legion-mcp MCP server uses the MCP Python SDK to expose database operations as tools. It also provides database schema and metadata as MCP resources and includes prompts intended to guide database operations. The select_database prompt helps with choosing a connection when several databases are configured.

For a single connection, set DB_TYPE to a supported database code and provide its connection settings in DB_CONFIG as JSON. For multiple connections, use DB_CONFIGS, a JSON array containing each connection's type, configuration, and optional descriptive information. Tools that operate on a selected connection can receive its db_id.

The server can be configured through environment variables, command-line arguments, or MCP client settings JSON.

Setup and configuration

The documented direct runner is uvx database-mcp. An MCP client configuration passes database settings through the env object. A single-database setup uses DB_TYPE and DB_CONFIG; a multi-database setup uses DB_CONFIGS instead. The JSON format inside these variables depends on the selected database connector, so connection fields must follow the configuration expected by Legion Query Runner.

Database IDs may be supplied explicitly in a multi-database configuration. If an ID is omitted, the server generates one from the database type and description.

Tools and capabilities

TheRaLabs/legion-mcp MCP server exposes tools for:

  • Running SQL and returning results as a markdown table with execute_query.
  • Running SQL and returning results as JSON with execute_query_json.
  • Listing columns or column types for a specific table.
  • Reviewing recent query history.
  • Listing configured database connections.
  • Viewing database information and schema details.
  • Finding which configured database contains a named table.
  • Getting a detailed table description, including column names and types.
  • Retrieving a sample of table data.

In multi-database deployments, list_databases, get_database_info, and find_table support connection discovery before query execution. Database-specific credentials are kept in the connection configuration rather than embedded in SQL or application logic.

Limitations and notes

The server does not provide one universal connection format for every database. Each supported type has its own configuration requirements, which are documented by the Legion Query Runner connectors. Multi-database queries require the caller to identify the target connection, commonly by supplying db_id.

It does not describe write restrictions, query timeouts, result-size limits, role-based access controls, or transaction behavior. Review the connector-specific documentation and deployment environment before granting an agent access to production data.

Reviews

No reviews yet — be the first to share how it worked for you.

Frequently Asked Questions about Legion MCP

Run `uvx database-mcp`, or install the `database-mcp` package with pip as documented in the README.

It supports PostgreSQL, Redshift, CockroachDB, MySQL, RDS MySQL, Microsoft SQL Server, BigQuery, Oracle DB, and SQLite.

Set `DB_CONFIGS` to a JSON array containing each connection's database type, configuration, and description. You can provide an ID for each connection or let the server generate one.

Yes. Use the `execute_query_json` tool to return query results as JSON; `execute_query` returns a markdown table.

Related MCP servers

Add a badge to your READMEShow it’s listed — live SVG, Markdown or HTML.

AllMCPs Directory Badge

Full Badge Customizer

Showcase your server listing on GitHub or your project documentation. Embed this dynamic SVG badge to highlight official listing status and live engagement.

Badge Style:
Live Dynamic SVG PreviewLegion MCP AllMCPs Directory Badge
Markdown (GitHub README)
[![AllMCPs](https://allmcps.com/api/badge/theralabs-legion-mcp?style=directory)](https://allmcps.com/mcp/theralabs-legion-mcp)
HTML Embed
<a href="https://allmcps.com/mcp/theralabs-legion-mcp"><img src="https://allmcps.com/api/badge/theralabs-legion-mcp?style=directory" alt="Legion MCP on AllMCPs" /></a>