Database Assistant MCP Server
Server Configuration
Describes the environment variables required to run the server.
| Name | Required | Description | Default |
|---|---|---|---|
| MODEL | No | LLM model ID | bedrock.claude-sonnet-4-6 |
| DB_HOST | Yes | Database hostname or RDS endpoint | |
| DB_NAME | Yes | Database name | |
| DB_PORT | No | Database port | 5432 |
| DB_TYPE | No | postgresql or mysql | postgresql |
| DB_USER | Yes | Database user (use a read-only user) | |
| MAX_ROWS | No | Maximum rows returned per query | 1000 |
| DB_PASSWORD | Yes | Database password | |
| QUERY_TIMEOUT | No | Max query execution time (seconds) | 10 |
| CSV_EXPORT_DIR | No | Directory for CSV exports | /tmp/db_exports |
| OPENAI_API_KEY | No | LLM API key (for generate_sql) | |
| ALLOWED_SCHEMAS | No | Comma-separated schema allowlist | |
| OPENAI_BASE_URL | No | LLM API endpoint (for generate_sql) |
Capabilities
Features and capabilities supported by this server
| Capability | Details |
|---|---|
| tools | {
"listChanged": false
} |
| prompts | {
"listChanged": false
} |
| resources | {
"subscribe": false,
"listChanged": false
} |
| experimental | {} |
Tools
Functions exposed to the LLM to take actions
| Name | Description |
|---|---|
| list_databasesA | List all available databases on the connected server. |
| list_schemasA | List all schemas in the connected database. For PostgreSQL returns schema names, for MySQL returns databases. |
| list_tablesA | List all tables in a schema with their types (BASE TABLE or VIEW) and approximate row counts. |
| describe_tableA | Get detailed table information: columns (name, type, nullable, default), constraints (PK, FK, unique), and indexes. |
| describe_relationshipsA | Show foreign key relationships for a table: both outgoing (this table references others) and incoming (others reference this table). |
| sample_dataA | Get a quick preview of data in a table. Returns the first N rows to help understand data format and contents. |
| validate_sqlA | Check if a SQL query is safe to execute. Validates that it is read-only, single-statement, and contains no dangerous operations. Use before run_sql to preview validation. |
| run_sqlA | Execute a read-only SQL query. The query is validated for safety before execution. Supports pagination (100 rows per page). Returns columns, rows, row count, and execution time. |
| explain_queryA | Run EXPLAIN ANALYZE on a SQL query to show the execution plan. Helps understand performance characteristics like index usage, sequential scans, and estimated costs. |
| generate_sqlA | Generate a SQL query from a natural language question. Uses the database schema as context and an LLM to produce a valid SELECT query. The generated query is validated for safety. |
| export_csvA | Execute a SQL query and export results as a CSV file. The query is validated for safety. Returns the file path of the generated CSV. |
Prompts
Interactive templates invoked by user choice
| Name | Description |
|---|---|
No prompts | |
Resources
Contextual data attached and managed by the client
| Name | Description |
|---|---|
No resources | |
Latest Blog Posts
- 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/vinycoolguy2015/database_mcp_server'
If you have feedback or need assistance with the MCP directory API, please join our Discord server