Multi-Database CRUD MCP Server
Planned integration to provide tools for CRUD operations on a MySQL database, following the same pattern as SQLite and PostgreSQL.
Provides tools for CRUD operations on a PostgreSQL database, including creating, reading, updating, and deleting product records.
Provides tools for CRUD operations on a SQLite database, including creating, reading, updating, and deleting product records.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Multi-Database CRUD MCP Serveradd a product called 'Headphones' with price 79.99"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Multi-Database CRUD MCP Server
This learning project exposes typed MCP tools for product CRUD operations. SQLite works by default, PostgreSQL is supported through configuration, and MySQL can be added later without changing the MCP tools.
Architecture
User -> AI/MCP client -> MCP tools (server.py)
-> database adapter (database.py)
-> SQLite or PostgreSQL
<- structured result <- databaseThe AI never connects directly to the database or generates unrestricted SQL. It selects a narrow tool such as create_product, and the server validates the input before the database adapter executes parameterized SQL.
Related MCP server: MCP Universal DB Client
Available MCP tools
database_healthcreate_productget_productlist_productsupdate_productdelete_product
Start with SQLite
SQLite is included with Python. It does not require Docker, a database server, username, or password.
Install dependencies:
uv syncSelect SQLite in PowerShell:
$env:DB_BACKEND="sqlite" $env:SQLITE_PATH="data/mcp_demo.db"Run the tests:
uv run pytestStart MCP Inspector:
uv run mcp dev src/mcp_database/server.py
The first database tool call automatically creates data/mcp_demo.db and its products table. Call database_health; it should return:
{"connected": true, "backend": "sqlite"}Then try create_product, list_products, update_product, and delete_product in Inspector.
Connect an MCP client to SQLite
Use an absolute path for the project and SQLite file:
{
"mcpServers": {
"database-crud": {
"command": "uv",
"args": [
"--directory",
"C:\\absolute\\path\\to\\MCP_Database",
"run",
"mcp-database"
],
"env": {
"DB_BACKEND": "sqlite",
"SQLITE_PATH": "C:\\absolute\\path\\to\\MCP_Database\\data\\mcp_demo.db"
}
}
}
}The selected database is controlled by DB_BACKEND. The older mcp-postgres command remains available as a compatibility alias.
Switch to PostgreSQL later
The MCP tools require no code changes. Start PostgreSQL and change the environment variables.
Start the provided PostgreSQL container:
docker compose up -d docker compose psSelect PostgreSQL:
$env:DB_BACKEND="postgresql" $env:DATABASE_URL="postgresql://mcp_user:mcp_password@localhost:5432/mcp_demo" uv run mcp dev src/mcp_database/server.py
The container runs sql/init.sql on its first startup. SQLITE_PATH is ignored in PostgreSQL mode.
For an MCP client, replace its environment section with:
"env": {
"DB_BACKEND": "postgresql",
"DATABASE_URL": "postgresql://mcp_user:mcp_password@localhost:5432/mcp_demo"
}MySQL in the future
MySQL is not implemented yet. DB_BACKEND=mysql deliberately returns a clear configuration error. To add it:
Add
PyMySQLormysql-connector-pythontopyproject.toml.Add a MySQL connection context manager in
database.py.Implement the same six data functions using MySQL parameterized queries.
Use MySQL schema syntax such as
AUTO_INCREMENT.Add MySQL integration tests.
server.py will remain unchanged because the backend-specific code is isolated in database.py.
Important SQL differences
Concern | SQLite | PostgreSQL | MySQL |
Driver | Built-in |
| Future driver |
Placeholder |
|
| Usually |
Generated ID |
|
|
|
Server needed | No | Yes | Yes |
Current status | Implemented | Implemented | Planned |
The adapter handles SQLite and PostgreSQL differences while presenting the same functions to the MCP server.
Project files
src/mcp_database/server.py: stable MCP contract and validation.src/mcp_database/database.py: backend selection and database-specific SQL.sql/init.sql: PostgreSQL schema and sample records.compose.yaml: local PostgreSQL service.tests/test_server.py: MCP tool unit tests.tests/test_sqlite_database.py: real SQLite CRUD integration tests..env.example: configuration examples. A plain.envis not loaded automatically; supply variables through PowerShell or MCP client configuration.
How to explain it to a manager
“This proof of concept places a controlled MCP service between an AI assistant and a database. Instead of giving the model unrestricted SQL access, it exposes six typed and auditable operations. A database adapter lets developers use zero-setup SQLite locally and move to PostgreSQL later without changing the MCP contract.”
For production, add authentication, user-level authorization, secret management, audit logging, connection pooling, rate limiting, migrations, monitoring, backups, and separate read/write database roles.
Troubleshooting
DATABASE_URL is required for PostgreSQL: set it whenDB_BACKEND=postgresql.SQLite file missing: call any database tool once; it is created automatically.
PostgreSQL connection refused: verify
docker compose psreports a healthy container.Inspector port 6274 is occupied: close the older Inspector terminal/session before starting another.
Tools do not appear: use an absolute project path and restart the MCP client.
This project uses the official MCP Python SDK.
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- Flicense-qualityDmaintenanceA small MCP server that manages a product inventory using SQLite, providing CRUD operations through exposed MCP tools.Last updated
- AlicenseAqualityCmaintenanceEnables connecting to and querying multiple database types (PostgreSQL, MySQL, SQLite) through a unified interface. Supports managing multiple concurrent database connections with connection pooling and SQL query execution through MCP tools.Last updated5226MIT
- Alicense-qualityAmaintenanceProvides safe, configurable SQL database access via MCP tools, enabling schema introspection, predefined queries, and structured updates with multi-backend support.Last updated2MIT
- Alicense-qualityCmaintenanceExposes sqlite3 database functionality as MCP tools, enabling SQL query execution, schema management, and CRUD operations.Last updated1MIT
Related MCP Connectors
MCP server for managing Prisma Postgres.
UN FAOSTAT global food & agriculture statistics over a local SQLite mirror, via MCP.
MCP-native open-source Notion alternative: read & write pages, databases and kanban boards.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/vinay5199/mcp_poc'
If you have feedback or need assistance with the MCP directory API, please join our Discord server