MCP-Python

MCP-Python

A server that enables interaction with PostgreSQL, MySQL, MariaDB, or SQLite databases through Claude Desktop using natural language queries.

rhabraken

Databases
Search
Local
Python
Visit Server

README

Talk with Your Database Using MCP

Talk with Your Database Using MCP

This guide explains how to set up and run your MCP server to interact with your PostgreSQL database using Claude Desktop. It should also work with MySQL, MariaDB, SQLite as it uses sqlalchemy under the hood. This project is build on top of https://github.com/runekaagaard/mcp-alchemy

Note: This guide assumes you have a basic understanding of Docker, environment variables, and CLI usage.


Prerequisites


1. Set Up Environment Variables

  1. Copy and Rename the Environment File
    Duplicate the provided .env.example file and rename it to .env:
    cp .env.example .env
    

2. Set Up Claude Desktop

  1. Download and Install Claude Desktop
    Visit the Claude Desktop download page and install the application.

3. Launch the PostgreSQL Database with Dummy Data

  1. Run Docker Compose
    Ensure Docker Compose is installed and run:
    docker-compose up -d
    
    • This command will launch a PostgreSQL database on localhost:5432 and populate it with dummy data.

4. Install uv (if not already installed)

  1. Install uv
    Execute the following command to install uv:
    curl -LsSf https://astral.sh/uv/install.sh | sh
    

5. Configure and Launch the MCP Server

  1. Create/Update the MCP Server Configuration
    Save the following JSON configuration in your MCP server config file (adjust paths if necessary):

    {
      "mcpServers": {
        "my_database": {
          "command": "uv",
          "args": [
            "--directory",
            "/directory/where/this/app/is/located/app/",
            "run",
            "server.py"
          ],
          "env": {
            "DB_URL": "postgresql://postgres:password@localhost:5432/mydatabase"
          }
        }
      }
    }
    
    • Tip: If uv is installed in a non-standard location, update the "command" value to reflect the full path to the executable.
  2. Launch the MCP Server
    With the configuration in place, the MCP server will automatically start each time Claude Desktop is launched.


6. Enjoy Your Setup

  • Open Claude Desktop.
  • The tool will automatically call your MCP server, enabling you to interact with your database seamlessly.

Summary

  1. Set Up Environment Variables: Copy .env.example to .env.
  2. Install and Run Claude Desktop: Download from Claude Desktop.
  3. Launch PostgreSQL with Docker Compose: Run docker-compose up to start the database with dummy data.
  4. Install uv: Run the provided installation command if necessary.
  5. Configure MCP Server: Update the config file and ensure paths and environment variables are correct.
  6. Launch and Enjoy: Start Claude Desktop to begin interacting with your database via MCP.

If you encounter any issues or need further assistance, please refer to the relevant documentation or contact your support team.

Happy coding!

Recommended Servers

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
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
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
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
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
YouTube Transcript MCP Server

YouTube Transcript MCP Server

This server retrieves transcripts for given YouTube video URLs, enabling integration with Goose CLI or Goose Desktop for transcript extraction and processing.

Featured
Python
Supabase MCP Server

Supabase MCP Server

A Model Context Protocol (MCP) server that provides programmatic access to the Supabase Management API. This server allows AI models and other clients to manage Supabase projects and organizations through a standardized interface.

Featured
JavaScript