loading…
Search for a command to run...
loading…
Provides LLMs with full PostgreSQL database access, including tools for query execution, schema management, and data export. It also features a dedicated insigh
Provides LLMs with full PostgreSQL database access, including tools for query execution, schema management, and data export. It also features a dedicated insights system for storing business memos and supports both local stdio and remote HTTP transport.
A Model Context Protocol (MCP) server that provides LLMs with generic database access capabilities for PostgreSQL databases. Built with Python and FastMCP.
cd general-database-mcp-python
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
pip install -r requirements.txt
cp .env.example .env
# Edit .env with your database credentials
python main.py
docker build -t general-database-mcp .
docker run -p 8008:8008 \
-e DATABASE_URL="postgresql://user:password@host:5432/database" \
-e MCP_TRANSPORT=http \
general-database-mcp
Database Configuration (choose one option):
Option 1: DATABASE_URL (recommended)
DATABASE_URL=postgresql://user:password@host:5432/database
Option 2: Individual parameters
DB_HOST=localhost
DB_PORT=5432
DB_NAME=your_database
DB_USER=your_username
DB_PASSWORD=your_password
Server Configuration:
PORT=8008
MCP_TRANSPORT=stdio # Options: stdio (local) or http (remote)
API_KEY=your_secret_key # Optional: for authentication
read_queryExecute SELECT queries to read data from the database.
query (string) - SQL SELECT statementwrite_queryExecute INSERT, UPDATE, or DELETE queries to modify data.
query (string) - SQL modification statementexport_queryExecute a SELECT query and export results in CSV or JSON format.
query (string) - SQL SELECT statementformat (string) - "csv" or "json" (default: "json")create_tableCreate new tables in the database.
query (string) - CREATE TABLE statementalter_tableModify existing table schema (add columns, rename, etc.).
query (string) - ALTER TABLE statementdrop_tableRemove a table from the database with safety confirmation.
table_name (string) - Name of table to dropconfirm (boolean) - Must be True to proceedlist_tablesGet a list of all tables in the database.
describe_tableView schema information for a specific table.
table_name (string) - Name of tableappend_insightAdd a business insight to the memo table.
insight (string) - Text of the insightlist_insightsList all business insights stored in the memo table.
health_checkHealth check endpoint for monitoring and deployment verification.
Add to your Claude Desktop configuration file:
macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
Windows: %APPDATA%\Claude\claude_desktop_config.json
Linux: ~/.config/Claude/claude_desktop_config.json
{
"mcpServers": {
"database": {
"command": "python",
"args": [
"/absolute/path/to/general-database-mcp-python/main.py"
],
"env": {
"DATABASE_URL": "postgresql://user:password@localhost:5432/mydb"
}
}
}
}
Query data:
Show me all tables in the database.
Describe the structure of the users table.
Select all records from the products table where price > 100.
Modify data:
Insert a new user with name 'John Doe' and email '[email protected]'.
Update all products in the 'Electronics' category to increase price by 10%.
Delete all orders older than 2 years.
Schema operations:
Create a new table called 'logs' with columns for id, timestamp, and message.
Add a 'created_at' column to the users table.
Drop the temporary_data table (confirm=True).
Export data:
Export all customer data as CSV.
Export sales summary as JSON.
Business insights:
Add an insight: "Sales increased 25% in Q4 due to holiday promotions"
Show me all stored insights.
general-database-mcp-python/
├── main.py # FastMCP server entry point
├── db/
│ ├── __init__.py
│ └── postgres_adapter.py # PostgreSQL adapter with connection pooling
├── tools/
│ ├── __init__.py
│ ├── query_tools.py # Query execution tools
│ ├── schema_tools.py # DDL operation tools
│ └── insights_tools.py # Business insights tools
└── utils/
├── __init__.py
└── format_utils.py # Response formatting and CSV conversion
# TODO: Add test suite
python -m pytest tests/
MIT License - See LICENSE file for details
Contributions are welcome! Please feel free to submit a Pull Request.
For issues, questions, or contributions, please open an issue on the repository.
Current Version: 1.0.0
Run in your terminal:
claude mcp add general-purpose-mcp-database-server -- npx Yes, General Purpose Database Server MCP is free — one-click install via Unyly at no cost.
No, General Purpose Database Server runs without API keys or environment variables.
Self-hosted: the server runs locally on your machine via the install command above.
Open General Purpose Database Server on unyly.org, pick your client tab (Claude Desktop, Claude Code, Cursor) and press Install — the config is generated automatically, no JSON editing.
Query your database in natural language
by AnthropicA universal database MCP server supporting simultaneous connections to multiple databases. It provides tools for database operations, health analysis, SQL optim
by wenb1n-devThis server enables interaction with PostgreSQL databases through the Model Context Protocol, optimized for the AWS Bedrock AgentCore Runtime. It provides tools
by madhurprashRead-only database access with schema inspection.
by modelcontextprotocolNot sure what to pick?
Find your stack in 60 seconds
Author?
Embed badge for your README
Browse similar
All data MCPs