Status: Works great and is in daily use without any known bugs.
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 and a host of other SQLAlchemy-compatible databases.
all_table_names
users, orders, products, categories
filter_table_names
q
(string)Input: "user"
Returns: "users, user_roles, user_permissions"
schema_definitions
table_names
(string[])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
Add to your claude_desktop_config.json
:
{
"mcpServers": {
"my_database": {
"command": "uv",
"args": ["--directory", "/path/to/mcp-alchemy", "run", "server.py"],
"env": {
"DB_URL": "mysql+pymysql://root:secret@localhost/databasename",
}
}
}
}
Environment Variables:
DB_URL
: SQLAlchemy database URL (required)
Examples:
postgresql://user:password@localhost/dbname
mysql+pymysql://user:password@localhost/dbname
mariadb+pymysql://user:password@localhost/dbname
sqlite:///path/to/database.db
CLAUDE_LOCAL_FILES_PATH
: Directory for full result sets (optional)EXECUTE_QUERY_MAX_CHARS
: Maximum output length (optional, default 4000)git clone https://github.com/runekaagaard/mcp-alchemy.git
# Install uv if you haven't already
curl -LsSf https://astral.sh/uv/install.sh | sh
The following database drivers are included by default:
pymysql
psycopg2-binary
To use other databases supported by SQLAlchemy, install the appropriate driver:
# Microsoft SQL Server
uv pip install pymssql
# Oracle
uv pip install cx_oracle
# Other databases
# See: https://docs.sqlalchemy.org/en/20/dialects/
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
Seamless access to top MCP servers powering the future of AI integration.