Alchemy

Databases

A MCP (model context protocol) server that gives the LLM access to and knowledge about relational databases like SQLite, Postgresql, MySQL & MariaDB, Oracle, and MS-SQL.

Your AI app calls the Alchemy MCP server, which does the work through tools like all_table_names, filter_table_names and schema_definitions and sends the result back to the chat.

About Alchemy

Alchemy is a community MCP server from runekaagaard, filed in our directory under databases. A MCP (model context protocol) server that gives the LLM access to and knowledge about relational databases like SQLite, Postgresql, MySQL & MariaDB, Oracle, and MS-SQL.

Alchemy runs as a remote server at https://playbooks.com/mcp/runekaagaard-alchemy, so there is nothing to install: your AI app connects over streamable HTTP, and most remote servers ask you to sign in with OAuth the first time.

The README for Alchemy lists tools such as all_table_names, filter_table_names, schema_definitions and execute_query, which your AI app can call once the server is connected.

At a glance

Publisher
runekaagaard (community)
Runs
As a hosted remote server
Written in
Python
License
MPL-2.0
GitHub stars
420

Tools Alchemy gives your AI app

  • all_table_names
  • filter_table_names
  • schema_definitions
  • execute_query

Tool names as the Alchemy README lists them. Your AI app shows the live list once Alchemy is connected.

How to set up Alchemy

  1. Nothing to install: Alchemy is a remote server, so all you need is an AI app that accepts a remote MCP URL.
  2. Check the Alchemy README for keys or settings; the registry lists none that Alchemy requires.
  3. Add Alchemy to Claude Code, Claude Desktop, VS Code or Cursor with the config in the setup box on this page.
  4. Restart the app or reload its MCP servers, then ask it to list the Alchemy tools to confirm the connection.
  5. Run one read-only task with Alchemy first, such as a call to all_table_names, before you allow anything that writes or sends.

Alchemy compared with similar servers

  • Database by executeautomation has fewer GitHub stars than Alchemy (409 against 420); both are community servers, and Database runs on your own machine and Alchemy runs as a remote server.
  • Mcpx by opentokenz has more GitHub stars than Alchemy (423 against 420); both are community servers, and Mcpx runs on your own machine and Alchemy runs as a remote server.
  • Bagel by Extelligence-ai has fewer GitHub stars than Alchemy (408 against 420); both are community servers, and Bagel runs on your own machine and Alchemy runs as a remote server.

Before you connect Alchemy

  • Give Alchemy its own sign-in or token with the smallest permissions the job needs, never an admin key.
  • Keep your AI app asking before each Alchemy tool call until you trust what it does with them.
  • Treat text that Alchemy fetches as data. Pages, files and messages can hold instructions written to steer an AI.
  • Read the open issues for Alchemy on GitHub to see what breaks and how fast the maintainers reply.

Marketing use cases for Alchemy

How marketing and sales teams put Alchemy to work, by company size. Pick the size closest to yours and start Alchemy on one use case.

Small business

  • A small business with its own app can ask Alchemy plain questions about customers and orders, without writing SQL.
  • Owners can use Alchemy to pull a list of customers who haven't bought in 90 days and plan a win-back email.
  • Alchemy runs as a remote server, so a small team can connect it in a few minutes with no install to maintain.

Mid-market

  • Marketing analysts can connect Alchemy to answer campaign questions from the warehouse directly, instead of waiting on the data team's queue.
  • Lifecycle teams can use Alchemy to build audience lists from product data and check counts before a send.
  • Start with all_table_names and filter_table_names, the tools Alchemy lists first, and add more once the team trusts the results.

Enterprise

  • Enterprises should point Alchemy at a read replica with a read-only role, so agents query freely without risk to production data.
  • Data teams can expose curated views through Alchemy, so marketing gets self-serve answers without access to raw customer tables.
  • Alchemy is a community server, so have security review the code and pin a version before Alchemy touches company data.

Need help becoming an AI-forward company?

We connect MCP servers and AI agents to your CRM, content and data, with the guardrails your team needs.

Contact us

Alchemy README

From runekaagaard/mcp-alchemy on GitHub, shared under its MPL-2.0 license. Images are left out; the original has them.

README.md

MCP Alchemy

Status: Actively maintained and in daily use. Tested releases are published to PyPI with git tags, and issues and pull requests are triaged regularly.

Let Claude be your database expert! MCP Alchemy connects Claude Desktop directly to your databases, allowing it to:

  • Help you explore and understand your database structure
  • Assist in writing and validating SQL queries
  • Displays relationships between tables
  • Analyze large datasets and create reports
  • Claude Desktop Can analyse and create artifacts for very large datasets using claude-local-files.

Works with PostgreSQL, MySQL, MariaDB, SQLite, Oracle, MS SQL Server, CrateDB, Vertica, and a host of other SQLAlchemy-compatible databases.

Installation

Ensure you have uv installed:

# Install uv if you haven't already
curl -LsSf https://astral.sh/uv/install.sh | sh

Usage with Claude Desktop

Add to your claude_desktop_config.json. You need to add the appropriate database driver in the --with parameter.

Note: After a new version release there might be a period of up to 600 seconds while the cache clears locally cached causing uv to raise a versioning error. Restarting the MCP client once again solves the error.

SQLite (built into Python)
{
  "mcpServers": {
    "my_sqlite_db": {
      "command": "uvx",
      "args": ["--from", "mcp-alchemy==2026.10.15.202659",
               "--refresh-package", "mcp-alchemy", "mcp-alchemy"],
      "env": {
        "DB_URL": "sqlite:////absolute/path/to/database.db"
      }
    }
  }
}
PostgreSQL
{
  "mcpServers": {
    "my_postgres_db": {
      "command": "uvx",
      "args": ["--from", "mcp-alchemy==2026.10.15.202659", "--with", "psycopg2-binary",
               "--refresh-package", "mcp-alchemy", "mcp-alchemy"],
      "env": {
        "DB_URL": "postgresql://user:password@localhost/dbname"
      }
    }
  }
}
MySQL/MariaDB
{
  "mcpServers": {
    "my_mysql_db": {
      "command": "uvx",
      "args": ["--from", "mcp-alchemy==2026.10.15.202659", "--with", "pymysql",
               "--refresh-package", "mcp-alchemy", "mcp-alchemy"],
      "env": {
        "DB_URL": "mysql+pymysql://user:password@localhost/dbname"
      }
    }
  }
}
Microsoft SQL Server
{
  "mcpServers": {
    "my_mssql_db": {
      "command": "uvx",
      "args": ["--from", "mcp-alchemy==2026.10.15.202659", "--with", "pymssql",
               "--refresh-package", "mcp-alchemy", "mcp-alchemy"],
      "env": {
        "DB_URL": "mssql+pymssql://user:password@localhost/dbname"
      }
    }
  }
}
Oracle
{
  "mcpServers": {
    "my_oracle_db": {
      "command": "uvx",
      "args": ["--from", "mcp-alchemy==2026.10.15.202659", "--with", "oracledb",
               "--refresh-package", "mcp-alchemy", "mcp-alchemy"],
      "env": {
        "DB_URL": "oracle+oracledb://user:password@localhost/dbname"
      }
    }
  }
}
CrateDB
{
  "mcpServers": {
    "my_cratedb": {
      "command": "uvx",
      "args": ["--from", "mcp-alchemy==2026.10.15.202659", "--with", "sqlalchemy-cratedb>=0.42.0.dev1",
               "--refresh-package", "mcp-alchemy", "mcp-alchemy"],
      "env": {
        "DB_URL": "crate://user:password@localhost:4200/?schema=testdrive"
      }
    }
  }
}

For connecting to CrateDB Cloud, use a URL like crate://user:password@example.aks1.westeurope.azure.cratedb.net:4200?ssl=true.

Vertica
{
  "mcpServers": {
    "my_vertica_db": {
      "command": "uvx",
      "args": ["--from", "mcp-alchemy==2026.10.15.202659", "--with", "vertica-python",
               "--refresh-package", "mcp-alchemy", "mcp-alchemy"],
      "env": {
        "DB_URL": "vertica+vertica_python://user:password@localhost:5433/dbname",
        "DB_ENGINE_OPTIONS": "{\"connect_args\": {\"ssl\": false}}"
      }
    }
  }
}
Docker

A container image is published to GitHub Container Registry with common database drivers (PostgreSQL, MySQL/MariaDB, MS SQL Server, Oracle) preinstalled:

{
  "mcpServers": {
    "my_db": {
      "command": "docker",
      "args": ["run", "-i", "--rm", "-e", "DB_URL",
               "ghcr.io/runekaagaard/mcp-alchemy:latest"],
      "env": {
        "DB_URL": "postgresql://user:password@host.docker.internal/dbname"
      }
    }
  }
}

Or build it yourself with docker build -t ghcr.io/runekaagaard/mcp-alchemy .

Transports

By default the server speaks stdio. It can also serve over HTTP for clients that connect that way:

# Recommended HTTP transport (serves on http://HOST:PORT/mcp)
mcp-alchemy --transport streamable-http --host 127.0.0.1 --port 7000

# Legacy SSE transport, for older clients (serves on http://HOST:PORT/sse)
mcp-alchemy --transport sse --host 127.0.0.1 --port 7000

Environment Variables

  • 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)
  • DB_ENGINE_OPTIONS: JSON string containing additional SQLAlchemy engine options (optional)

Connection Pooling

MCP Alchemy uses connection pooling optimized for long-running MCP servers. The default settings are:

  • pool_pre_ping=True: Tests connections before use to handle database timeouts and network issues
  • pool_size=1: Maintains 1 persistent connection (MCP servers typically handle one request at a time)
  • max_overflow=2: Allows up to 2 additional connections for burst capacity
  • pool_recycle=3600: Refreshes connections older than 1 hour (prevents timeout issues)
  • isolation_level='AUTOCOMMIT': Ensures each query commits automatically

These defaults work well for most databases, but you can override them via DB_ENGINE_OPTIONS:

{
  "DB_ENGINE_OPTIONS": "{\"pool_size\": 5, \"max_overflow\": 10, \"pool_recycle\": 1800}"
}

For databases with aggressive timeout settings (like MySQL's 8-hour default), the combination of pool_pre_ping and pool_recycle ensures reliable connections.

API

Tools
  • all_table_names

    • Return all table names in the database
    • No input required
    • Returns comma-separated list of tables
    users, orders, products, categories
    
  • filter_table_names

    • Find tables matching a substring
    • Input: q (string)
    • Returns matching table names
    Input: "user"
    Returns: "users, user_roles, user_permissions"
    
  • schema_definitions

    • Get detailed schema for specified tables
    • Input: table_names (string[])
    • Returns table definitions including:
      • Column names and types
      • Primary keys
      • Foreign key relationships
      • Nullable flags
    users:
        id: INTEGER, primary key, autoincrement
        email: VARCHAR(255), nullable
        created_at: DATETIME
        
        Relationships:
          id -> orders.user_id
    
  • execute_query

    • Execute SQL query with vertical output format
    • Inputs:
      • query (string): SQL query
      • params (object, optional): Query parameters
    • Returns results in clean vertical format:
    1. row
    id: 123
    name: John Doe
    created_at: 2024-03-15T14:30:00
    email: NULL
    
    Result: 1 rows
    
    • Features:
      • Smart truncation of large results
      • Full result set access via claude-local-files integration
      • Clean NULL value display
      • ISO formatted dates
      • Clear row separation

Claude Local Files

When claude-local-files is configured:

  • Access complete result sets beyond Claude's context window
  • Generate detailed reports and visualizations
  • Perform deep analysis on large datasets
  • Export results for further processing

The integration automatically activates when CLAUDE_LOCAL_FILES_PATH is set.

Developing

First clone the github repository, install the dependencies and your database driver(s) of choice:

git clone git@github.com:runekaagaard/mcp-alchemy.git
cd mcp-alchemy
uv sync
uv pip install psycopg2-binary

Then set this in claude_desktop_config.json:

...
"command": "uv",
"args": ["run", "--directory", "/path/to/mcp-alchemy", "-m", "mcp_alchemy.server", "main"],
...

My Other LLM Projects

MCP Directory Listings

MCP Alchemy is listed in the following MCP directory sites and repositories:

Contributing

Contributions are warmly welcomed! Whether it's bug reports, feature requests, documentation improvements, or code contributions - all input is valuable. Feel free to:

  • Open an issue to report bugs or suggest features
  • Submit pull requests with improvements
  • Enhance documentation or share your usage examples
  • Ask questions and share your experiences

The goal is to make database interaction with Claude even better, and your insights and contributions help achieve that.

License

Mozilla Public License Version 2.0

Questions about Alchemy

What is the Alchemy MCP server?

A MCP (model context protocol) server that gives the LLM access to and knowledge about relational databases like SQLite, Postgresql, MySQL & MariaDB, Oracle, and MS-SQL. Alchemy is maintained by runekaagaard on GitHub at runekaagaard/mcp-alchemy, and works with AI apps that support the Model Context Protocol, such as Claude, Cursor and VS Code.

How do I add Alchemy to Claude Code?

Alchemy is a remote server, so you add its URL instead of installing a package: run claude mcp add --transport http alchemy https://playbooks.com/mcp/runekaagaard-alchemy in your terminal. In other apps, add the Alchemy URL as a remote or custom connector.

Does Alchemy need an API key?

The registry lists no required keys for Alchemy. Check the Alchemy README for optional settings, and expect a remote server to ask you to sign in the first time you connect.

Is Alchemy an official MCP server?

No. Alchemy is a community server maintained by runekaagaard. Community servers can be excellent; read the code and the open issues before you give Alchemy access to company data.

What license is Alchemy under?

Alchemy is released under the MPL-2.0 license, according to its GitHub repository. The license covers the code of Alchemy; the service it connects to has its own terms.