📇 🏠 - Secure access to PostgreSQL, MySQL and SQLite databases with parameterized queries and schema inspection
@pilat/mcp-datalink
以下摘录自该仓库的 README(片段) · 在 GitHub 读完整 README →
MCP server for PostgreSQL, MySQL, and SQLite. Gives AI assistants secure database access via Model Context Protocol.
Works with Claude Desktop, Claude Code, Cursor, Cline, and any MCP-compatible client.
Installation
Add to your MCP client config file (see config locations below):
This creates three database connections: analytics (read-only), inventory, and cache.
| Variable | Description |
|----------|-------------|
| DATALINK_{NAME}_URL | Connection URL (creates database named {name}) |
| DATALINK_{NAME}_READONLY | Set to true to block writes |
| DATALINK_{NAME}_MAX_TIMEOUT | Max query timeout in ms (caps model requests) |
**Connection URL formats:**
Environment Variable Substitution
URLs support ${VAR} syntax to reference other environment variables:
This allows reusing existing environment variables (like DATABASE_URL from your shell or .env file).
**Supported syntax:**
| Syntax | Description |
|--------|-------------|
| ${VAR} | Expands to value of VAR, or keeps ${VAR} if unset |
| ${VAR:-default} | Expands to value of VAR, or default if unset |
**Examples:**
Config File Locations
| Client | Config file |
|--------|-------------|
| Claude Code | ~/.claude.json (global) or .mcp.json (project) |
| Claude Desktop (macOS) | ~/Library/Application Support/Claude/claude_desktop_config.json |
| Claude Desktop (Windows) | %APPDATA%\Claude\claude_desktop_config.json |
| Cursor | ~/.cursor/mcp.json or Settings → Features → MCP Servers |
| Cline | cline_mcp_settings.json or VS Code settings cline.mcpServers |
Tools
| Tool | Description |
|------|-------------|
| list_databases | List configured database connections |
| list_tables | List tables with row counts |
| describe_table | Get schema, indexes, foreign keys |
| query | Run SELECT queries |
| execute | Run INSERT/UPDATE/DELETE |
| explain | Show query execution plans |
Security
- Prepared statements only (no SQL injection)
- Single statement per query (no chaining)
- DDL blocked (no DROP, ALTER, TRUNCATE)