Direct Database Access MCP Server
Provides tools for interacting with a PostgreSQL database, allowing listing of tables, querying, executing write operations (INSERT/UPDATE/DELETE) for privileged users, and saving queries with parameters for later execution.
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., "@Direct Database Access MCP Serverlist all tables in the database"
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.
About
MCP SERVER where allow you chat with your database(Postgresql) using AI
You can deploy this MCP server as a remote MCP server using Cloudflare Workers
Related MCP server: PostgreSQL Remote Cloudflare MCP Worker
Key features
List the tables of your database
Query the tables of your database
Execute write operations like INSERT/UPDATE/DELETE (privileged users only)
Create queries and saved to execute later. PS: you can create queries with parameters and save the queries to execute later.
All operations sent to Cloudflare Workers will check the api-key sent in the header
Folder structure
- src/
- database/ // Database connection and utils
- tools/ // Tools implementation
- repositories/ // Repositories implementationTransport Protocols
This MCP server supports both modern and legacy transport protocols:
/mcp- Streamable HTTP (recommended): Uses a single endpoint with bidirectional communication, automatic connection upgrades, and better resilience for network interruptions/sse- Server-Sent Events (legacy): Uses separate endpoints for requests/responses, maintained for backward compatibility
For new implementations, use the /mcp endpoint as it provides better performance and reliability.
Prerequisites
Node.js installed on your machine
A Cloudflare account (free tier works)
A PostgreSQL database (local or hosted)
Step 1: Install Wrangler CLI
Install Wrangler globally to manage your Cloudflare Workers:
npm install -g wranglerStep 2: Authenticate with Cloudflare
Log in to your Cloudflare account:
wrangler loginThis will open a browser window where you can authenticate with your Cloudflare account.
Step 3: Clone and Install dependencies
Clone the repo directly & install dependencies: pnpm install.
Environment Variables Setup
Before running the MCP server, you need to configure several environment variables for authentication and database access.
Create Environment Variables File
Create your
.dev.varsfile from the example:cp .dev.vars.example .dev.varsConfigure all required environment variables in
.dev.vars:ACCESS_TOKEN=random_value_to_use_as_api_key DATABASE_URL=postgresql://username:password@localhost:5432/database_name
Database setup
To save the queries to execute later you will need execute the SQL script on your database. PS: you need to execute the script named instructions.sql only once.
Run the server locally
wrangler dev This makes the server available at http://localhost:8792
Production Deployment
Deploy
Deploy the MCP server to make it available on your workers.dev domain
wrangler deployAccess the remote MCP server from Kilo Code and Vscode
You can access the remote MCP server from Kilo Code and Vscode using the following configuration:
// Kilocode MCP
{
"mcpServers": {
"direct-database-mcp-server-prod": {
"url": "url_cloudflare_workers_generated_after_deployed/sse",
"headers": {
"api-key": "Bearer same_value_of_ACCESS_TOKEN"
}
}
}
}
// Vscode MCP
{
"servers": {
"direct-database-mcp-server-prod": {
"url": "https://my-mcp-server.tiagorosadacost.workers.dev/sse",
"headers": {
"api-key": "Bearer 701cdccb-e605-423f-a778-66ed0698117f"
}
}
}
}
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-quality-maintenanceA Cloudflare Worker that provides a Model Context Protocol (MCP) interface for PostgreSQL databases, allowing AI assistants like Claude and Cursor to interact with PostgreSQL databases through natural language.1
- Flicense-qualityCmaintenanceA Cloudflare Workers-based MCP server that provides PostgreSQL database access capabilities to AI assistants, allowing them to query and manipulate PostgreSQL databases through the Model Context Protocol.
- Alicense-qualityDmaintenanceA production-ready MCP server that enables chatting with PostgreSQL databases via Cloudflare Workers with GitHub OAuth authentication.MIT
- Alicense-qualityDmaintenanceEnables chatting with PostgreSQL databases through secure GitHub OAuth authentication, supporting read operations for all users and write operations for privileged users. Deployable as a production-ready remote MCP server on Cloudflare Workers with automatic schema discovery and SQL injection protection.1MIT
Related MCP Connectors
Analytical memory for AI agents: a real Postgres queried in plain English over MCP. One command.
Query PostgreSQL databases in plain English — LLM-generated, safety-validated SQL.
GibsonAI MCP server: manage your databases with natural language
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/tiago123456789/direct-database-access-mcp-server'
If you have feedback or need assistance with the MCP directory API, please join our Discord server