
coleam00/remote-mcp-server-with-auth 是从 https://github.com/coleam00/remote-mcp-server-with-auth. 导入的 MCP 服务器候选
概览
coleam00/remote-mcp-server-with-auth 是从 https://github.com/coleam00/remote-mcp-server-with-auth. 导入的 MCP 服务器候选
概述(AI 翻译)
这是一个模型上下文协议(MCP)服务器,允许你与PostgreSQL数据库聊天,可作为远程MCP服务器部署,通过Cloudflare通过GitHub OAuth。这是生产准备的MCP。
主要特色
- ** 🗄️ 与 Lifespan 的数据库集成**:所有 MCP 工具调用均可直接连接 PostgreSQL 数据库
- ** 🛠️ 模块化、单用途工具**:遵循MCP工具及其描述的最佳实践
- ** 🔐 基于角色的访问**:基于用户名的数据库写入权限
- ** 📊 模式发现**:自动检索表和列信息
- ** 🛡️ SQL 注入保护**:内置验证与净化
- ** 📈 监控**:可选的Sentry集成用于生产监控
- ** ☁️ Cloud Native**:由Cloudflare Workers支持全球范围
模块化建筑
该MCP服务器采用简洁的模块化架构,便于扩展和维护:
src/tools/- 单独文件中的单个工具实现registerAllTools()- 集中式工具注册系统- 可扩展设计 - 通过在
tools/创建文件并注册来添加新工具
本页由 AI 翻译,技术细节请以原文为准。
README
以下为原文 README 节选,完整内容请查看原文。
Cloudflare Remote PostgreSQL Database MCP Server + GitHub OAuth
This is a Model Context Protocol (MCP) server that enables you to chat with your PostgreSQL database, deployable as a remote MCP server with GitHub OAuth through Cloudflare. This is production ready MCP.
Key Features
- 🗄️ Database Integration with Lifespan: Direct PostgreSQL database connection for all MCP tool calls
- 🛠️ Modular, Single Purpose Tools: Following best practices around MCP tools and their descriptions
- 🔐 Role-Based Access: GitHub username-based permissions for database write operations
- 📊 Schema Discovery: Automatic table and column information retrieval
- 🛡️ SQL Injection Protection: Built-in validation and sanitization
- 📈 Monitoring: Optional Sentry integration for production monitoring
- ☁️ Cloud Native: Powered by Cloudflare Workers for global scale
Modular Architecture
This MCP server uses a clean, modular architecture that makes it easy to extend and maintain:
src/tools/- Individual tool implementations in separate filesregisterAllTools()- Centralized tool registration system- Extensible Design - Add new tools by creating files in
tools/and registering them
This architecture allows you to easily add new database operations, external API integrations, or any other MCP tools while keeping the codebase organized and maintainable.
Transport 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.
How It Works
The MCP server provides three main tools for database interaction:
listTables- Get database schema and table information (all authenticated users)queryDatabase- Execute read-only SQL queries (all authenticated users)executeDatabase- Execute write operations like INSERT/UPDATE/DELETE (privileged users only)
Authentication Flow: Users authenticate via GitHub OAuth → Server validates permissions → Tools become available based on user’s GitHub username.
Security Model:
- All authenticated GitHub users can read data
- Only specific GitHub usernames can write/modify data
- SQL injection protection and query validation built-in
Simple Example First
安装
npx mcp-remote https://mcp-github-oauth.<your-subdomain>.workers.dev/mcp