mcp-enterprise-starter
Provides read-only access to PostgreSQL databases with query sandboxing, sensitive column masking, and rate limiting.
Click on "Deploy 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., "@mcp-enterprise-starter What tables are available?"
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.
mcp-enterprise-starter
A production-grade MCP (Model Context Protocol) server that gives AI agents safe, authenticated access to a PostgreSQL database. Built as a reference implementation for teams building custom MCP servers for enterprise workflows.
Architecture
┌─────────────────┐ ┌──────────────────────────────────┐ ┌────────────┐
│ Claude Desktop │ │ MCP Enterprise Server │ │ │
│ VS Code │────▶│ │────▶│ PostgreSQL │
│ Any MCP Client │ │ Auth → Validation → Tool Logic │ │ │
└─────────────────┘ └──────────────────────────────────┘ └────────────┘Security layers:
API key authentication on every request
SQL query sandboxing (SELECT only, keyword blocklist)
Parameterized queries (no SQL injection)
Sensitive column masking (email, SSN)
Row limit enforcement
Per-key rate limiting
Structured JSON audit logging
Related MCP server: postgres-mcp-query-tool
Quick Start
Option 1: Docker Compose (recommended)
git clone https://github.com/agrgroup/mcp-enterprise-starter.git
cd mcp-enterprise-starter
cp .env.example .env
docker compose up --buildPostgreSQL starts with seeded sample data. The MCP server connects automatically.
Option 2: Local Development
git clone https://github.com/agrgroup/mcp-enterprise-starter.git
cd mcp-enterprise-starter
npm install
cp .env.example .env
# Start PostgreSQL separately, then seed it:
psql $DATABASE_URL < seed.sql
# Run the server
npm run devConnect Claude Desktop
Copy the Claude Desktop config from mcp-config.json into your Claude Desktop configuration file:
macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
Linux: ~/.config/Claude/claude_desktop_config.json
{
"mcpServers": {
"enterprise-db": {
"command": "node",
"args": ["dist/server.js"],
"cwd": "/path/to/mcp-enterprise-starter",
"env": {
"DATABASE_URL": "postgres://mcp_user:mcp_password@localhost:5432/mcp_enterprise",
"API_KEYS": "your-api-key",
"ALLOWED_TABLES": "departments,users,projects",
"SENSITIVE_COLUMNS": "email,ssn"
}
}
}
}Restart Claude Desktop. Ask: "What tables are available?" to verify the connection.
Connect VS Code
Add to your .vscode/settings.json or user settings:
{
"mcp": {
"servers": {
"enterprise-db": {
"command": "node",
"args": ["dist/server.js"],
"cwd": "${workspaceFolder}/../mcp-enterprise-starter",
"env": {
"DATABASE_URL": "postgres://mcp_user:mcp_password@localhost:5432/mcp_enterprise",
"API_KEYS": "your-api-key",
"ALLOWED_TABLES": "departments,users,projects",
"SENSITIVE_COLUMNS": "email,ssn"
}
}
}
}
}Tools
Tool | Description |
| Execute read-only SQL queries with automatic row limiting and sensitive column masking |
| List all tables available for querying (from the configured allowlist) |
| Get column definitions, types, and constraints for a specific table |
Resources
URI Pattern | Description |
| Table schema as structured JSON |
Configuration
Variable | Default | Description |
| — | PostgreSQL connection string |
| — | Comma-separated list of valid API keys |
|
| Tables the agent can access |
|
| Columns to mask in query results |
|
| Default row limit for queries |
|
| Maximum row limit (even if query specifies higher) |
|
| Requests per minute per API key |
|
| Transport mode: |
|
| Logging level |
Testing
npm test # Run all tests
npm run test:watch # Watch modeTests mock the PostgreSQL connection so no database is needed.
Adapt for Your Own Database
Update
ALLOWED_TABLESin.envto expose your tablesUpdate
SENSITIVE_COLUMNSto mask your sensitive fieldsUpdate
seed.sqlwith your schema (or remove it and use an existing database)Add new tools in
src/tools/following the pattern inquery-database.tsUpdate
src/server.tsto register your new toolsAdd write operations cautiously — start read-only, add writes with explicit confirmation patterns
Security Notes
API keys are checked on every tool call. No key = no access.
Only SELECT queries are allowed. DROP, DELETE, INSERT, UPDATE, and other write operations are blocked at the query level.
Sensitive columns are masked before results reach the agent. The agent never sees raw PII.
Row limits prevent accidental full-table scans on large tables.
All requests are logged as structured JSON to stderr for audit trails.
The production Docker image runs as a non-root user.
License
MIT
Available Tools
3 toolsget_schemaA
Get the column schema for a specific database table, including column names, data types, nullability, and constraints.
Inputs: table_name (required).
list_tablesA
List all database tables that are available for querying. Returns table names from the configured allowlist.
Inputs: no named parameters.
query_databaseA
Execute a read-only SQL query against the database. Only SELECT statements are allowed. Results from sensitive columns (email, SSN) are automatically masked. Queries are limited to a maximum number of rows.
Inputs: query (required), params.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 3 tools
Each tool has a clearly distinct purpose: listing tables, getting schema for a specific table, and executing queries. No overlap or ambiguity.
All tools follow a consistent verb_noun snake_case pattern (get_schema, list_tables, query_database), making naming predictable.
3 tools is on the lower end but appropriate for a focused database starter. It covers essential operations without being too sparse.
Core operations (list tables, get schema, query) are present, but missing advanced features like explain plans or index info. Adequate for a starter.
Maintenance
Related MCP Connectors
Hosted PostgreSQL MCP server for Claude, ChatGPT and Cursor, with each action switched per account.
Xata MCP server lets AI agents interact with your Xata projects, and Postgres database branches.
Analytical memory for AI agents: a real Postgres queried in plain English over MCP. One command.
Text-to-SQL MCP server: read-only queries on PostgreSQL, MySQL and SQL Server with your real schema
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceA production-ready MCP server that connects AI assistants to any PostgreSQL database with 25 tools and role-based access control.12 npmMIT
- FlicenseNot gradedqualityDmaintenanceAn MCP server that gives an AI agent scoped, safe access to your Postgres databases with per-connection access control, row caps, timeouts, and defense-in-depth read-only enforcement.-
- AlicenseNot gradedqualityDmaintenanceA Model Context Protocol (MCP) server that provides secure, role-based access to PostgreSQL databases for AI agents.MIT
- FlicenseNot gradedqualityDmaintenanceAn enterprise-grade MCP server that enables LLM agents to securely interact with PostgreSQL databases and the local file system under absolute sandbox boundaries.-