{
  "markdown": "# @pilat/mcp-datalink\n\nMCP server for PostgreSQL, MySQL, and SQLite. Gives AI assistants secure database access via [Model Context Protocol](https://modelcontextprotocol.io).\n\n```\nnpx @pilat/mcp-datalink\n```\n\nWorks with Claude Desktop, Claude Code, Cursor, Cline, and any MCP-compatible client.\n\n## Installation\n\nAdd to your MCP client config file (see [config locations](#config-file-locations) below):\n\n```json\n{\n  \"mcpServers\": {\n    \"datalink\": {\n      \"command\": \"npx\",\n      \"args\": [\"-y\", \"@pilat/mcp-datalink\"],\n      \"env\": {\n        \"DATALINK_ANALYTICS_URL\": \"postgresql://user:password@localhost:5432/analytics\",\n        \"DATALINK_ANALYTICS_READONLY\": \"true\",\n\n        \"DATALINK_INVENTORY_URL\": \"mysql://user:password@localhost:3306/inventory\",\n\n        \"DATALINK_CACHE_URL\": \"sqlite:///path/to/cache.db\"\n      }\n    }\n  }\n}\n```\n\nThis creates three database connections: `analytics` (read-only), `inventory`, and `cache`.\n\n| Variable | Description |\n|----------|-------------|\n| `DATALINK_{NAME}_URL` | Connection URL (creates database named `{name}`) |\n| `DATALINK_{NAME}_READONLY` | Set to `true` to block writes |\n| `DATALINK_{NAME}_MAX_TIMEOUT` | Max query timeout in ms (caps model requests) |\n\n**Connection URL formats:**\n\n```bash\n# PostgreSQL\npostgresql://user:password@localhost:5432/dbname\npostgresql://user:password@localhost:5432/dbname?sslmode=require\n\n# MySQL\nmysql://user:password@localhost:3306/dbname\nmysql://user:password@localhost:3306/dbname?ssl=true\n\n# SQLite\nsqlite:///path/to/database.db\nsqlite:///Users/me/data/app.sqlite\nsqlite://../relative/path/data.db\n```\n\n### Environment Variable Substitution\n\nURLs support `${VAR}` syntax to reference other environment variables:\n\n```json\n{\n  \"mcpServers\": {\n    \"datalink\": {\n      \"command\": \"npx\",\n      \"args\": [\"-y\", \"@pilat/mcp-datalink\"],\n      \"env\": {\n        \"DATALINK_MAIN_URL\": \"${DATABASE_URL}\"\n      }\n    }\n  }\n}\n```\n\nThis allows reusing existing environment variables (like `DATABASE_URL` from your shell or `.env` file).\n\n**Supported syntax:**\n\n| Syntax | Description |\n|--------|-------------|\n| `${VAR}` | Expands to value of `VAR`, or keeps `${VAR}` if unset |\n| `${VAR:-default}` | Expands to value of `VAR`, or `default` if unset |\n\n**Examples:**\n\n```bash\n# Reference existing DATABASE_URL\nDATALINK_MAIN_URL=\"${DATABASE_URL}\"\n\n# Build URL from parts\nDATALINK_MAIN_URL=\"postgresql://${DB_USER}:${DB_PASS}@${DB_HOST}:5432/mydb\"\n\n# With default values\nDATALINK_MAIN_URL=\"postgresql://localhost:${DB_PORT:-5432}/mydb\"\n```\n\n### Config File Locations\n\n| Client | Config file |\n|--------|-------------|\n| Claude Code | `~/.claude.json` (global) or `.mcp.json` (project) |\n| Claude Desktop (macOS) | `~/Library/Application Support/Claude/claude_desktop_config.json` |\n| Claude Desktop (Windows) | `%APPDATA%\\Claude\\claude_desktop_config.json` |\n| Cursor | `~/.cursor/mcp.json` or Settings → Features → MCP Servers |\n| Cline | `cline_mcp_settings.json` or VS Code settings `cline.mcpServers` |\n\n## Tools\n\n| Tool | Description |\n|------|-------------|\n| `list_databases` | List configured database connections |\n| `list_tables` | List tables with row counts |\n| `describe_table` | Get schema, indexes, foreign keys |\n| `query` | Run SELECT queries |\n| `execute` | Run INSERT/UPDATE/DELETE |\n| `explain` | Show query execution plans |\n\n## Security\n\n- Prepared statements only (no SQL injection)\n- Single statement per query (no chaining)\n- DDL blocked (no DROP, ALTER, TRUNCATE)\n- Readonly mode per connection\n- Response size limit (100 rows, 64KB default, configurable via `DATALINK_MAX_TOTAL_SIZE`)\n- Query timeout: 30s default, model can request up to 10min, `MAX_TIMEOUT` caps it\n\n## License\n\nMIT\n",
  "bytes": 3687,
  "sha": "1857096cc5a96ef2ceb3397131a0a09b3a6cd586224ca61888caddaaceb7bc9e",
  "repo_slug": "pilat/mcp-datalink",
  "fonte": "repo",
  "truncated": false,
  "api": "https://agentalog.com/api/listings/mcp_io_github_pilat_mcp_datalink_1a6c0430/readme"
}