Talk with Your Database
Interact with PostgreSQL, MySQL, MariaDB, and SQLite databases using SQLAlchemy.
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
- Docker Compose: Installation instructions
- Claude Desktop: Download here
- uv: A modern, high-performance Python package manager. If not installed, follow the instructions below.
1. Set Up Environment Variables
- 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
- Download and Install Claude Desktop
Visit the Claude Desktop download page and install the application.
3. Launch the PostgreSQL Database with Dummy Data
- 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.
- This command will launch a PostgreSQL database on
4. Install uv
(if not already installed)
- Install
uv
Execute the following command to installuv
:curl -LsSf https://astral.sh/uv/install.sh | sh
5. Configure and Launch the MCP Server
-
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.
- Tip: If
-
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
- Set Up Environment Variables: Copy
.env.example
to.env
. - Install and Run Claude Desktop: Download from Claude Desktop.
- Launch PostgreSQL with Docker Compose: Run
docker-compose up
to start the database with dummy data. - Install
uv
: Run the provided installation command if necessary. - Configure MCP Server: Update the config file and ensure paths and environment variables are correct.
- 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!
Related Servers
Eka MCP Server
Access medical knowledge-bases and drug information from eka.care. Requires API credentials.
BioMCP
Connects AI assistants to authoritative biomedical data sources like PubMed and ClinicalTrials.gov, enabling natural language queries.
DB Query
Query and export data from various databases including ElasticSearch, MySQL, PostgreSQL, Oracle, and SQLite.
Seoul Public Data
Provides public data for Seoul, South Korea, including subway ridership and cultural event information, via the Seoul Public Data API.
Vertica MCP Server
Provides read-only access to Vertica databases.
Couchbase
Interact with Couchbase databases using natural language. Perform CRUD operations, query buckets, and execute N1QL queries.
Firebolt
Connect your LLM to the Firebolt Data Warehouse for data querying and analysis.
Flexpa FHIR
An MCP server for interacting with FHIR (Fast Healthcare Interoperability Resources) servers, enabling access and search of healthcare data.
Adobe Commerce MCP Server by CData
A read-only MCP server for Adobe Commerce, enabling LLMs to query live data using the CData JDBC driver.
Generect MCP
Generect MCP connects your live lead database directly to AI models like OpenAI or Claude without exports or delays. It streams enriched, up-to-date contact data (titles, firmographics, signals) straight into prompts so LLMs can personalize, score, and recommend leads automatically in real time.