mcp-postgres
Verified Safeby Anashel-RPG
Overview
LLM-powered data analysis and exploration on a PostgreSQL database, utilizing Cloudflare Workers for scalable and secure deployment.
Installation
npm run deploy:allEnvironment Variables
- MCP_API_KEY
- MCP_SERVER_URL
- OPENAI_API_KEY
- SESSION_TTL
- TOTP_ISSUER
- TOTP_ACCOUNT
- HYPERDRIVE_ID (in wrangler.toml)
- ALLOWED_SOURCES
- EXCLUDED_SCHEMAS
- DEFAULT_MODEL
- MAX_TOOL_ITERATIONS
- LLM_MAX_TOKENS
- PG_QUERY_TIMEOUT_MS
Security Notes
The project demonstrates strong security practices. SQL queries use parameterized statements and identifier escaping to prevent injection. API keys are managed via environment variables and validated with `timingSafeEqual`. TOTP-based 2FA with brute-force protection is implemented for `llm-app`. Cross-Origin Resource Sharing (CORS) is explicitly configured. Sensitive data is sanitized from logs and error messages. Durable Objects are used for secure state persistence. Content Security Policy (CSP) and other security headers are enforced for frontend assets. Inputs and LLM outputs are truncated to prevent context window attacks and excessive costs, and markdown content is sanitized for XSS prevention. Default settings prioritize fail-closed security for unauthenticated access. Minor improvements could involve stricter input validation on all API endpoints or more frequent key rotation policies.
Similar Servers
sqrl
A build tool and CLI for compiling, running, and testing DataSQRL projects, including the deployment of GraphQL, REST, and Micro-Context Protocol (MCP) API servers, Flink stream processing jobs, and database interactions.
mcp
Provides an AI agent toolkit and server implementation to interact with PostHog analytics data, manage feature flags, create insights, and perform other analytics tasks through natural language queries.
txt2mcp
Converts text files or remote URLs into Model Context Protocol (MCP) servers, providing a searchable interface for AI agents.
agent-tool
A full-stack AI agent platform offering conversational AI with RAG, multi-LLM support, and extensible tooling via Model Context Protocol (MCP) servers.