Multi-database MCP server that exposes Legion Query Runner database operations as Model Context Protocol (MCP) tools, resources and prompts.
https://github.com/TheRaLabs/legion-mcpYou're building AI applications that need database access, and you're tired of juggling different client libraries, connection strings, and authentication patterns for each database type. Every new project means learning another database driver, writing more boilerplate, and dealing with inconsistent interfaces.
Legion MCP changes that equation completely.
Most database tools force you into database-specific silos. Want to query PostgreSQL? Learn psycopg2. Need MySQL? Figure out PyMySQL. Add SQL Server to the mix? Time for pyodbc. Each database type demands its own connection logic, error handling, and query patterns.
When you're building AI agents that need to work across different data sources, this fragmentation becomes a productivity killer. You end up writing database-specific code that can't be reused, maintaining separate connection pools, and dealing with different authentication mechanisms for each system.
Legion MCP provides a single, consistent API that works identically across PostgreSQL, MySQL, SQL Server, BigQuery, Oracle, SQLite, Redshift, CockroachDB, and RDS MySQL. Same tools, same commands, same authentication flow - regardless of what's running underneath.
{
"mcpServers": {
"database-mcp": {
"command": "uvx",
"args": ["database-mcp"],
"env": {
"DB_CONFIGS": "[
{\"id\":\"analytics\", \"db_type\":\"pg\", \"configuration\":{...}},
{\"id\":\"users\", \"db_type\":\"mysql\", \"configuration\":{...}},
{\"id\":\"warehouse\", \"db_type\":\"bigquery\", \"configuration\":{...}}
]"
}
}
}
}
Set it up once, query everything the same way. No more context switching between different database clients or remembering which syntax works with which system.
Instead of writing SQL and hoping your AI assistant understands the context, Legion MCP exposes database operations as proper MCP tools that AI systems can use intelligently. Your assistant can:
The sql_query prompt lets you describe what you want in plain English, and the system handles the SQL generation, execution, and result formatting. No more copying table schemas into prompts or explaining database relationships manually.
Forget about maintaining schema documentation or feeding table structures to your AI. Legion MCP automatically discovers and exposes database schemas as MCP resources. When your AI needs to know what tables exist or what columns are available, it queries the live schema - always current, never outdated.
# Your assistant automatically knows about:
- All available tables across connected databases
- Column names and types for each table
- Which database contains which tables
- Sample data for understanding data patterns
This eliminates the constant back-and-forth of "What tables do we have?" and "What's the column name for...?" Your AI tools have direct access to current schema information.
Real applications rarely live in a single database. You might have user data in PostgreSQL, analytics in BigQuery, and session data in Redis. Legion MCP handles multi-database scenarios as first-class functionality:
find_table to locate data across all connectionsThe select_database prompt guides users through choosing the right database for their query, while tools like list_databases and get_database_info provide programmatic access to connection details.
Data Analysis Across Systems: Your AI can pull user behavior from PostgreSQL, join it with sales data from MySQL, and push results to BigQuery - all through the same interface, with automatic query optimization for each database type.
Schema Migration Assistance: When moving between database types, the unified schema representation makes it easy to compare table structures and generate migration scripts. Same column information format whether you're looking at Oracle or SQLite.
Development Environment Consistency: Use SQLite locally, PostgreSQL in staging, and managed cloud databases in production. Your AI tools work identically across all environments because the Legion MCP interface never changes.
Legion MCP works with your existing MCP-compatible AI development environment. No framework lock-in, no architectural changes required. Install with uvx and add your database configurations - you're running queries through AI assistants within minutes.
The server handles connection pooling, credential management, and query optimization internally. You focus on building features while it manages the database complexity.
If you're building AI applications that need reliable, consistent database access across multiple systems, Legion MCP eliminates the integration overhead that's been slowing you down. One interface, multiple databases, zero context switching.