MCP Alchemy

by @runekaagaard

Alchemy MCP Server

MCP Alchemy lets Claude Desktop inspect SQL database structure and execute queries through SQLAlchemy. An optional companion integration exposes complete result sets when the normal response is shortened.

Databases421pythonMPL-2.0

Server facts

MCP Alchemy

GitHub stars

421

Last commit

Oct 15, 2026

Runtime

python

License

MPL-2.0

Project

License
MPL-2.0
Category
Databases

Tech

Runtime
pythonPython
Transports
stdio
Remote access
No

Activity

GitHub stars
421
Last commit
Data as of

Tags

  • Database Schema
  • Parameterized Sql
  • Python
  • Query Results
  • Sqlalchemy

Overview

MCP Alchemy separates the query response an assistant reads from the complete dataset a query may produce. Normal output has a configurable character ceiling, with a default of 4,000, and presents rows vertically with explicit NULL handling and ISO dates. For larger analysis, claude-local-files can provide full results outside the immediate response. Setting its directory variable activates that optional integration, supporting subsequent reporting, visualization, or export. It is a companion project rather than an automatic part of the basic server launch. Query calls also accept parameters, allowing values to be supplied separately from the SQL text.

Before executing SQL, an assistant can discover tables, narrow their names by substring, and inspect selected definitions. Definitions expose nullability, key relationships, types, and columns rather than just a list of names. Database connectivity comes through SQLAlchemy, covering SQLite as well as engines such as Vertica, CrateDB, Oracle, SQL Server, PostgreSQL, MariaDB, and MySQL. The README gives driver-specific uvx examples: SQLite relies on Python's built-in support, while other examples request an additional dependency. DB_URL identifies the connection, and JSON engine options can override defaults. Connection management includes checking before use, recycling older connections, and a small persistent pool with overflow capacity. Queries use autocommit by default, an important behavior when considering writes. The stated license is MPL-2.0, and the client setup is documented around Claude Desktop.

Install & configure

Requirements

  • uv installation providing uvx
  • A database reachable through the chosen SQLAlchemy URL
  • Driver dependency matching the database if not using the SQLite example
Documented launch / install command
uvx --from mcp-alchemy==2025.8.15.91819 --refresh-package mcp-alchemy mcp-alchemy

The version pin and argument sequence reproduce the SQLite README example. For another engine, use its documented --with dependency and matching DB_URL. The remaining environment entries are optional settings listed in the README; the full-result path is meaningful with claude-local-files configured.

Config file · macOS: ~/Library/Application Support/Claude/claude_desktop_config.json

Windows: %APPDATA%\Claude\claude_desktop_config.json

Use Settings → Developer → Edit Config when available. Do not assume a Linux configuration path; check the client documentation for your platform. Remote servers use the app’s connector flow when supported, not the local stdio file shown here. Merge this example with existing settings; do not overwrite unrelated servers.

Claude Desktop configuration
{
  "mcpServers": {
    "mcp-alchemy": {
      "command": "uvx",
      "args": [
        "--from",
        "mcp-alchemy==2025.8.15.91819",
        "--refresh-package",
        "mcp-alchemy",
        "mcp-alchemy"
      ],
      "env": {
        "DB_URL": "<required SQLAlchemy connection URL; use SQLite for this driver-free example>",
        "CLAUDE_LOCAL_FILES_PATH": "<optional directory used by the full-result companion integration>",
        "EXECUTE_QUERY_MAX_CHARS": "<optional character ceiling for query responses>",
        "DB_ENGINE_OPTIONS": "<optional engine overrides encoded as a JSON string>"
      }
    }
  }
}

Read the Claude Desktop setup guide

Config file · Project: .cursor/mcp.json

User: ~/.cursor/mcp.json

The project path is relative to the workspace root. The tilde denotes your user home directory. Use Cursor’s MCP settings to confirm which configuration and scope your installed version is reading. Merge this example with existing settings; do not overwrite unrelated servers.

Cursor configuration
{
  "mcpServers": {
    "mcp-alchemy": {
      "command": "uvx",
      "args": [
        "--from",
        "mcp-alchemy==2025.8.15.91819",
        "--refresh-package",
        "mcp-alchemy",
        "mcp-alchemy"
      ],
      "env": {
        "DB_URL": "<required SQLAlchemy connection URL; use SQLite for this driver-free example>",
        "CLAUDE_LOCAL_FILES_PATH": "<optional directory used by the full-result companion integration>",
        "EXECUTE_QUERY_MAX_CHARS": "<optional character ceiling for query responses>",
        "DB_ENGINE_OPTIONS": "<optional engine overrides encoded as a JSON string>"
      }
    }
  }
}

Read the Cursor setup guide

Config file · Workspace: .vscode/mcp.json

For user scope, use the “MCP: Open User Configuration” command if available. Do not guess a user configuration path across operating systems, profiles, containers, or remote workspaces; check the client documentation. Merge this example with existing settings; do not overwrite unrelated servers.

VS Code configuration
{
  "servers": {
    "mcp-alchemy": {
      "type": "stdio",
      "command": "uvx",
      "args": [
        "--from",
        "mcp-alchemy==2025.8.15.91819",
        "--refresh-package",
        "mcp-alchemy",
        "mcp-alchemy"
      ],
      "env": {
        "DB_URL": "<required SQLAlchemy connection URL; use SQLite for this driver-free example>",
        "CLAUDE_LOCAL_FILES_PATH": "<optional directory used by the full-result companion integration>",
        "EXECUTE_QUERY_MAX_CHARS": "<optional character ceiling for query responses>",
        "DB_ENGINE_OPTIONS": "<optional engine overrides encoded as a JSON string>"
      }
    }
  }
}

Read the VS Code setup guide

Config file · macOS/Linux: ~/.codeium/windsurf/mcp_config.json

Windows: %USERPROFILE%\.codeium\windsurf\mcp_config.json

Open the MCP configuration through Windsurf’s settings when possible to confirm the active file. Paths can differ in managed or future releases; check the client documentation if this location is not present. Merge this example with existing settings; do not overwrite unrelated servers.

Windsurf configuration
{
  "mcpServers": {
    "mcp-alchemy": {
      "command": "uvx",
      "args": [
        "--from",
        "mcp-alchemy==2025.8.15.91819",
        "--refresh-package",
        "mcp-alchemy",
        "mcp-alchemy"
      ],
      "env": {
        "DB_URL": "<required SQLAlchemy connection URL; use SQLite for this driver-free example>",
        "CLAUDE_LOCAL_FILES_PATH": "<optional directory used by the full-result companion integration>",
        "EXECUTE_QUERY_MAX_CHARS": "<optional character ceiling for query responses>",
        "DB_ENGINE_OPTIONS": "<optional engine overrides encoded as a JSON string>"
      }
    }
  }
}

Read the Windsurf setup guide

Config file · Project scope: .mcp.json at the repository root

The project file uses mcpServers. For user scope, use claude mcp add --scope user rather than assuming .mcp.json in your home directory is the user configuration. Check the client documentation for managed settings and storage details. Merge this example with existing settings; do not overwrite unrelated servers.

Claude Code configuration
{
  "mcpServers": {
    "mcp-alchemy": {
      "type": "stdio",
      "command": "uvx",
      "args": [
        "--from",
        "mcp-alchemy==2025.8.15.91819",
        "--refresh-package",
        "mcp-alchemy",
        "mcp-alchemy"
      ],
      "env": {
        "DB_URL": "<required SQLAlchemy connection URL; use SQLite for this driver-free example>",
        "CLAUDE_LOCAL_FILES_PATH": "<optional directory used by the full-result companion integration>",
        "EXECUTE_QUERY_MAX_CHARS": "<optional character ceiling for query responses>",
        "DB_ENGINE_OPTIONS": "<optional engine overrides encoded as a JSON string>"
      }
    }
  }
}

Read the Claude Code setup guide

Examples are translated from the published configuration. Supply your own credentials and verify requirements in the upstream README. Remote connectors are shown only where a supported configuration format is known.

Tools

Source: repository README. Tool descriptions are a documented snapshot, not a live capability check.

ToolWhat it does
schema_definitionsInspect selected tables for column types, keys, relationships, and nullable fields.
filter_table_namesNarrow the table inventory to names containing the requested text.
all_table_namesReturn the connected database's table inventory without a filter.
execute_queryRun SQL with optional parameter values and display rows in a vertical layout.

Use cases

  • Inspect selected table definitions and relationships before drafting a query.
  • Narrow a large table inventory using a name substring.
  • Execute parameterized SQL through a Claude Desktop conversation.
  • Use the companion file integration for analysis that needs unabridged query results.

Strengths

  • Builds database access on SQLAlchemy with multiple documented driver configurations.
  • Connects table discovery to detailed schema inspection rather than query execution alone.
  • Can preserve full datasets separately from shortened assistant-facing output.
  • Exposes engine options for tuning connections and pooling behavior.

Limitations

  • The database-specific examples generally need an additional driver beyond the SQLite setup.
  • An ordinary query response is shortened once it reaches the configured character ceiling.
  • Default autocommit means queries are committed automatically rather than awaiting a later commit.

MCP Alchemy setup notes

  • Check CLAUDE_LOCAL_FILES_PATH, DB_ENGINE_OPTIONS, DB_URL, EXECUTE_QUERY_MAX_CHARS in the MCP Alchemy configuration if startup or authentication fails.
  • MCP Alchemy's stdio example needs a client that launches local processes.

Frequently asked questions

The schema tool reports columns and types together with primary keys, foreign-key relationships, and whether fields are nullable.

Related MCP servers