Database Mcp Server
Pricing
Pay per usage
Go to Apify Store
Database Mcp Server
MCP Server for AI database access. Connect to PostgreSQL, MySQL, or SQLite. Query data, inspect schemas, list tables, describe columns, view indexes and foreign keys. 11 tools for complete database intelligence. Works with Claude Desktop and any MCP client.
Pricing
Pay per usage
Rating
0.0
(0)
Developer
Quadruped
Maintained by Community
Actor stats
0
Bookmarked
2
Total users
1
Monthly active users
17 days ago
Last modified
Categories
Share
MCP Server for AI database access. Connect to PostgreSQL, MySQL, or SQLite. Query data, inspect schemas, manage tables. 11 tools for complete database intelligence.
Features
- Multi-database - PostgreSQL, MySQL, SQLite
- Query execution - SELECT with automatic LIMIT protection
- Schema inspection - Tables, columns, foreign keys, indexes
- Safe operations - Separate read (query) and write (execute) tools
- Cloud-ready - Secure connections via Apify infrastructure
Input Parameters
| Parameter | Type | Description |
|---|---|---|
tool | string | Database tool to execute |
dbType | string | postgresql, mysql, or sqlite |
connectionString | string | Full connection URI |
host | string | Database host |
port | integer | Database port |
database | string | Database name |
user | string | Username |
password | string | Password (secret) |
ssl | boolean | Enable SSL (default: true) |
query | string | SQL query to execute |
tableName | string | Table for describe/info operations |
limit | integer | Max rows to return (default: 1000) |
timeout | integer | Query timeout in ms (default: 30000) |
sqliteUrl | string | URL to SQLite database file |
sqliteData | string | Base64-encoded SQLite database |
Tools
| Tool | Description |
|---|---|
db.connect | Connect to database |
db.disconnect | Close connection |
db.query | Execute SELECT (read-only) |
db.execute | Execute INSERT/UPDATE/DELETE/DDL |
db.list_tables | List all tables |
db.describe_table | Get column definitions |
db.get_schema | Full schema (all tables) |
db.list_databases | List databases on server |
db.table_info | Row count, size statistics |
db.foreign_keys | Foreign key relationships |
db.indexes | Index information |
Examples
Connect to PostgreSQL
{"tool": "db.connect","dbType": "postgresql","connectionString": "postgresql://user:pass@host:5432/dbname"}
Or with individual parameters:
{"tool": "db.connect","dbType": "postgresql","host": "your-host.com","port": 5432,"database": "mydb","user": "myuser","password": "mypassword","ssl": true}
Connect to MySQL
{"tool": "db.connect","dbType": "mysql","host": "your-mysql-host.com","port": 3306,"database": "mydb","user": "myuser","password": "mypassword"}
Connect to SQLite (URL)
{"tool": "db.connect","dbType": "sqlite","sqliteUrl": "https://example.com/database.db"}
Query Data
{"tool": "db.query","dbType": "postgresql","connectionString": "postgresql://...","query": "SELECT * FROM users WHERE active = true","limit": 100}
Get Schema
{"tool": "db.get_schema","dbType": "postgresql","connectionString": "postgresql://..."}
Describe Table
{"tool": "db.describe_table","dbType": "postgresql","connectionString": "postgresql://...","tableName": "users"}
Execute Statement
{"tool": "db.execute","dbType": "postgresql","connectionString": "postgresql://...","query": "INSERT INTO logs (message) VALUES ('Hello World')"}
Output Schema
| Field | Type | Description |
|---|---|---|
type | string | Always tool_result |
tool | string | Tool that was executed |
status | string | success or error |
data | object | Result data (rows, fields) |
rowCount | integer | Number of rows returned |
executionTime | integer | Query time in ms |
error | string | Error message if failed |
Success Response
{"type": "tool_result","tool": "db.query","status": "success","data": {"rows": [...],"fields": ["column1", "column2"]},"rowCount": 10,"executionTime": 45}
Error Response
{"type": "tool_result","tool": "db.query","status": "error","error": "relation \"users\" does not exist"}
MCP Integration
Claude Desktop
{"mcpServers": {"database": {"command": "npx","args": ["-y", "@anthropic/apify-mcp-client", "constant_quadruped/database-mcp-server"]}}}
Apify Client (JavaScript)
import { ApifyClient } from 'apify-client';const client = new ApifyClient({ token: 'YOUR_TOKEN' });const run = await client.actor('constant_quadruped/database-mcp-server').call({tool: 'db.query',dbType: 'postgresql',connectionString: 'postgresql://user:pass@host:5432/db',query: 'SELECT * FROM users LIMIT 10'});const { items } = await client.dataset(run.defaultDatasetId).listItems();console.log(items);
Apify Client (Python)
from apify_client import ApifyClientclient = ApifyClient("YOUR_TOKEN")run = client.actor("constant_quadruped/database-mcp-server").call(run_input={"tool": "db.query","dbType": "postgresql","connectionString": "postgresql://user:pass@host:5432/db","query": "SELECT * FROM users LIMIT 10"})items = client.dataset(run["defaultDatasetId"]).list_items().itemsprint(items)
Use Cases
- Data exploration - Understand database structure
- Report generation - Query data for AI reports
- Schema documentation - Auto-generate database docs
- Data migration - Inspect source and target schemas
- Debugging - Query logs and metrics tables
Security
- Passwords and connection strings marked as secrets
- SSL enabled by default for PostgreSQL and MySQL
- Query results limited to prevent memory issues
- Separate read (query) and write (execute) operations
License
MIT


