- Home
- MCP servers
- Database
Database
- python
86
GitHub Stars
python
Language
6 months ago
First Indexed
2 months ago
Catalog Refreshed
Documentation & install
Readme and setup notes from the catalogue, plus a client-ready config you can copy for your MCP host.
Installation
Add the following to your MCP client configuration file.
Configuration
View docs{
"mcpServers": {
"theralabs-legion-mcp": {
"command": "uvx",
"args": [
"database-mcp"
],
"env": {
"DB_TYPE": "pg",
"DB_CONFIG": "{\"host\":\"localhost\",\"port\":5432,\"user\":\"user\",\"password\":\"pw\",\"dbname\":\"dbname\"}",
"DB_CONFIGS": "[{\"id\":\"pg_main\",\"db_type\":\"pg\",\"configuration\":{...},\"description\":\"PostgreSQL Database\"}]"
}
}
}
}You can access and query multiple databases through a single MCP server that exposes database operations to AI assistants. This server uses the Model Context Protocol (MCP) SDK to present schemas, data, and query capabilities as MCP resources, tools, and prompts you can invoke from your AI workflow. It supports connecting to several database engines, handles credentials securely, and works with common AI development environments with minimal setup.
How to use
You use an MCP client to connect to the MCP server and perform operations like listing available databases, inspecting schemas, finding specific tables, and running SQL queries. For multi-database setups, you select the target database for each action using dedicated commands in your MCP client, and the server handles routing the request to the correct database.
How to install
Prerequisites: you need Python, and you may also use a Python MCP client or an MCP-compatible interface. You can run the server locally or through a package manager as shown.
Multi-database setup and usage notes
- The server supports multiple databases at once. You specify a database identity for each operation so you target the right data source.
Security and deployment notes
Credential management is handled securely, with credentials separated from application code. When deploying, choose the environment and tooling you already use (for example, MCP-enabled FastAPI projects or other AI toolchains) and configure the database connections through environment variables or an MCP settings JSON.
Prompts and tools overview
You access database schemas, run queries, and retrieve results through MCP resources and tools such as listing databases, getting table schemas, describing tables, and executing SQL queries. These tools are designed to work uniformly across all connected databases.
Troubleshooting basics
If you encounter connection issues, verify your DB_TYPE and connection configuration, ensure your network allows access to the database endpoints, and check that the MCP server has the correct environment variables set for each database.
Available tools
execute_query
Execute a SQL query and return results as a markdown table
execute_query_json
Execute a SQL query and return results as JSON
get_table_columns
Get column names for a specific table
get_table_types
Get column types for a specific table
get_query_history
Get the recent query history
list_databases
List all available database connections
get_database_info
Get detailed information about a database including schema
find_table
Find which database contains a specific table
describe_table
Get detailed description of a table including column names and types
get_table_sample
Get a sample of data from a table