mcp alchemy
Connects Claude Desktop directly to databases, allowing it to explore database structures, write SQL queries, analyze datasets, and create reports through an API layer with tools for table exploration and query execution.
Connects Claude Desktop directly to databases, allowing it to explore database structures, write SQL queries, analyze datasets, and create reports through an API layer with tools for table exploration and query execution.
Status: Works great and is in daily use without any known bugs.
Status2: I just added the package to PyPI and updated the usage instructions. Please report any issues :)
Let Claude be your database expert! MCP Alchemy connects Claude Desktop directly to your databases, allowing it to:
Works with PostgreSQL, MySQL, MariaDB, SQLite, Oracle, MS SQL Server, CrateDB, and a host of other SQLAlchemy-compatible databases.
Ensure you have uv installed:
# Install uv if you haven't already
curl -LsSf https://astral.sh/uv/install.sh | sh
Add to your claude_desktop_config.json
. You need to add the appropriate database driver in the --with
parameter.
{
"mcpServers": {
"my_sqlite_db": {
"command": "uvx",
"args": ["--from", "mcp-alchemy==2025.04.09.091234", "mcp-alchemy"],
"env": {
"DB_URL": "sqlite:///path/to/database.db"
}
}
}
}
{
"mcpServers": {
"my_postgres_db": {
"command": "uvx",
"args": ["--from", "mcp-alchemy==2025.04.09.091234", "--with", "psycopg2-binary", "mcp-alchemy"],
"env": {
"DB_URL": "postgresql://user:password@localhost/dbname"
}
}
}
}
{
"mcpServers": {
"my_mysql_db": {
"command": "uvx",
"args": ["--from", "mcp-alchemy==2025.04.09.091234", "--with", "pymysql", "mcp-alchemy"],
"env": {
"DB_URL": "mysql+pymysql://user:password@localhost/dbname"
}
}
}
}
{
"mcpServers": {
"my_mssql_db": {
"command": "uvx",
"args": ["--from", "mcp-alchemy==2025.04.09.091234", "--with", "pymssql", "mcp-alchemy"],
"env": {
"DB_URL": "mssql+pymssql://user:password@localhost/dbname"
}
}
}
}
{
"mcpServers": {
"my_oracle_db": {
"command": "uvx",
"args": ["--from", "mcp-alchemy==2025.04.09.091234", "--with", "cx_oracle", "mcp-alchemy"],
"env": {
"DB_URL": "oracle+cx_oracle://user:password@localhost/dbname"
}
}
}
}
{
"mcpServers": {
"my_cratedb": {
"command": "uvx",
"args": ["--from", "mcp-alchemy==2025.04.09.091234", "--with", "sqlalchemy-cratedb>=0.42.0.dev1", "mcp-alchemy"],
"env": {
"DB_URL": "crate://user:password@localhost:4200/?schema=testdrive"
}
}
}
}
For connecting to CrateDB Cloud, use a URL like
crate://user:[email protected]:4200?ssl=true
.
DB_URL
: SQLAlchemy database URL (required)CLAUDE_LOCAL_FILES_PATH
: Directory for full result sets (optional)EXECUTE_QUERY_MAX_CHARS
: Maximum output length (optional, default 4000)Returns comma-separated list of tables
users, orders, products, categories
filter_table_names
q
(string)Returns matching table names
Input: "user"
Returns: "users, user_roles, user_permissions"
schema_definitions
table_names
(string[])Returns table definitions including:
users:
id: INTEGER, primary key, autoincrement
email: VARCHAR(255), nullable
created_at: DATETIME
Relationships:
id -> orders.user_id
execute_query
query
(string): SQL queryparams
(object, optional): Query parameters1. row
id: 123
name: John Doe
created_at: 2024-03-15T14:30:00
email: NULL
Result: 1 rows
When claude-local-files is configured:
The integration automatically activates when CLAUDE_LOCAL_FILES_PATH
is set.
Contributions are warmly welcomed! Whether it's bug reports, feature requests, documentation improvements, or code contributions - all input is valuable. Feel free to:
The goal is to make database interaction with Claude even better, and your insights and contributions help achieve that.
Mozilla Public License Version 2.0