MCP Alchemy

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.

runekaagaard

Databases
Developer Tools
Local
Python
Visit Server

README

MCP Alchemy

Status: Works great and is in daily use without any known bugs.

Status 2: I'm currently working on publishing it to PYPI and finding the most userfriendly way to run it with uvx, so inspect installation instructions to change during the next couple of weeks.

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 and a host of other SQLAlchemy-compatible databases.

MCP Alchemy in action

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

Usage with Claude Desktop

Add to your claude_desktop_config.json:

{
  "mcpServers": {
    "my_database": {
      "command": "uv",
      "args": ["--directory", "/path/to/mcp-alchemy", "run", "mcp_alchemy.py"],
      "env": {
        "DB_URL": "mysql+pymysql://root:secret@localhost/databasename",
      }
    }
  }
}

Environment Variables:

  • DB_URL: SQLAlchemy database URL (required) Examples:
    • PostgreSQL: postgresql://user:password@localhost/dbname
    • MySQL: mysql+pymysql://user:password@localhost/dbname
    • MariaDB: mariadb+pymysql://user:password@localhost/dbname
    • SQLite: 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)

Installation

  1. Clone repository:
git clone https://github.com/runekaagaard/mcp-alchemy.git
  1. Ensure you have uv
# Install uv if you haven't already
curl -LsSf https://astral.sh/uv/install.sh | sh
  1. Add database to claude_desktop_config.json (see above)

Database Drivers

The following database drivers are included by default:

  • SQLite: Built into Python, no additional installation needed
  • MySQL/MariaDB: Via pymysql
  • PostgreSQL: Via 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/

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.

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

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
Excel MCP Server

Excel MCP Server

A Model Context Protocol server that enables AI assistants to read from and write to Microsoft Excel files, supporting formats like xlsx, xlsm, xltx, and xltm.

Featured
Local
Go
Playwright MCP Server

Playwright MCP Server

Provides a server utilizing Model Context Protocol to enable human-like browser automation with Playwright, allowing control over browser actions such as navigation, element interaction, and scrolling.

Featured
Local
TypeScript
MCP Package Docs Server

MCP Package Docs Server

Facilitates LLMs to efficiently access and fetch structured documentation for packages in Go, Python, and NPM, enhancing software development with multi-language support and performance optimization.

Featured
Local
TypeScript
Claude Code MCP

Claude Code MCP

An implementation of Claude Code as a Model Context Protocol server that enables using Claude's software engineering capabilities (code generation, editing, reviewing, and file operations) through the standardized MCP interface.

Featured
Local
JavaScript
@kazuph/mcp-taskmanager

@kazuph/mcp-taskmanager

Model Context Protocol server for Task Management. This allows Claude Desktop (or any MCP client) to manage and execute tasks in a queue-based system.

Featured
Local
JavaScript
Apple MCP Server

Apple MCP Server

Enables interaction with Apple apps like Messages, Notes, and Contacts through the MCP protocol to send messages, search, and open app content using natural language.

Featured
Local
TypeScript
DuckDuckGo MCP Server

DuckDuckGo MCP Server

A Model Context Protocol (MCP) server that provides web search capabilities through DuckDuckGo, with additional features for content fetching and parsing.

Featured
Python