MCP Directory

MCP Alchemy

Connect Claude directly to PostgreSQL, MySQL, SQLite, Oracle, MS SQL and other SQLAlchemy databases.

Unverified
stdio (local)
No auth
Stale
Python

Add to your client

Copy the config for your MCP client and paste it into its config file.

Install / run
uvx --from mcp-alchemy==2025.8.15.91819 --refresh-package mcp-alchemy mcp-alchemy

Paste into ~/Library/Application Support/Claude/claude_desktop_config.json

{
  "mcpServers": {
    "mcp-alchemy": {
      "command": "uvx",
      "args": [
        "--from",
        "mcp-alchemy==2025.8.15.91819",
        "--with",
        "psycopg2-binary",
        "--refresh-package",
        "mcp-alchemy",
        "mcp-alchemy"
      ],
      "env": {
        "DB_URL": "postgresql://user:password@localhost/dbname"
      }
    }
  }
}

Requires `uv` (the Python package runner). Install it from https://docs.astral.sh/uv/ if `uvx` is not found.

Before you start

  • uv installed (curl -LsSf https://astral.sh/uv/install.sh | sh)
  • A SQLAlchemy-compatible database and its driver (e.g. psycopg2-binary, pymysql, pymssql, oracledb)
  • A DB_URL connection string for the target database

About MCP Alchemy

MCP Alchemy gives Claude access to and knowledge about relational databases through SQLAlchemy. It exposes tools to list and search tables, retrieve detailed schema definitions including primary keys and foreign key relationships, and execute SQL queries with parameter support. Output is rendered in a readable vertical format with smart truncation, and large result sets can be exported via the optional claude-local-files integration.

Tools & capabilities (4)

all_table_names

Return all table names in the database as a comma-separated list. No input required.

filter_table_names

Find tables matching a substring. Input: q (string). Returns matching table names.

schema_definitions

Get detailed schema for specified tables. Input: table_names (string[]). Returns column names and types, primary keys, foreign key relationships, and nullable flags.

execute_query

Execute a SQL query with vertical output format. Inputs: query (string) and optional params (object). Features smart truncation of large results, clean NULL display, ISO formatted dates, and full result set access via claude-local-files.

What this server can do

MCP Alchemy provides tools for these capabilities — tap one to see every MCP server that does the same:

When to use it

  • Explore and understand an unfamiliar database structure
  • Write and validate SQL queries with Claude's help
  • Discover relationships between tables via foreign keys
  • Analyze large datasets and generate reports and visualizations

Security notes

Connects to your databases using credentials embedded in the DB_URL connection string. Use a least-privilege database account, since the LLM can execute arbitrary SQL via the execute_query tool.

MCP Alchemy FAQ

Which databases are supported?

PostgreSQL, MySQL, MariaDB, SQLite, Oracle, MS SQL Server, CrateDB, Vertica, and any other SQLAlchemy-compatible database. You add the appropriate driver in the --with parameter and set a matching DB_URL.

How do I handle result sets larger than Claude's context window?

Set the CLAUDE_LOCAL_FILES_PATH environment variable and configure claude-local-files. The integration activates automatically, giving access to complete result sets for deeper analysis and export.

Can I tune the database connection pool?

Yes. MCP Alchemy uses connection pooling optimized for long-running MCP servers (pool_pre_ping=True, pool_size=1, max_overflow=2, pool_recycle=3600, AUTOCOMMIT). You can override these via the DB_ENGINE_OPTIONS environment variable, which accepts a JSON string of SQLAlchemy engine options.

I get a uv versioning error after a new release. What do I do?

After a new version release there can be a period of up to 600 seconds while the local cache clears, causing uv to raise a versioning error. Restarting the MCP client again resolves it.

Alternatives to MCP Alchemy

Google's official MCP server with prebuilt BigQuery tools, querying datasets via Application Default Credentials.

Verified
stdio (local)
OAuth
Go
10 tools
Updated 2 months agoRepo

Create, manage, and query your InstantDB apps, schemas, permissions, and data from your AI editor.

Unverified
HTTP (remote)
OAuth
TypeScript
7 tools
Updated 1 month agoRepo

Zero-dependency, token-efficient database MCP server for Postgres, MySQL, SQL Server, MariaDB, and SQLite.

Unverified
stdio (local)
No auth
TypeScript
3 tools
Updated 1 month agoRepo