MCP Datalink logo

MCP Datalink

by pilat

Secure MCP database access for PostgreSQL, MySQL, and SQLite with schema inspection and constrained query execution.

Install MCP Datalink

Pick your client, then add it in one click or paste the config.

STDIONode.js
~/Library/Application Support/Claude/claude_desktop_config.json
claude_desktop_config.json
{
  "mcpServers": {
    "pilat-mcp-datalink": {
      "command": "npx",
      "args": [
        "-y",
        "@pilat/mcp-datalink"
      ]
    }
  }
}

Settings → Developer → Edit Config, merge this into mcpServers, then fully quit and reopen Claude Desktop.

We couldn’t confirm it starts correctly

We ran the install command but it didn't respond within our test window — this can mean a slow first-time install rather than a real problem.

npx -y @pilat/mcp-datalink

No response to initialize.

This is an experimental automated check and can have false negatives — missing environment variables, a slow cold install, etc. It doesn’t necessarily mean something’s wrong. Last checked .

Overview

This server connects MCP clients to configured PostgreSQL, MySQL, and SQLite databases. It supports schema inspection, read queries, data modification, and query plans, with prepared statements, single-statement queries, DDL blocking, timeouts, and response limits. Use it when an AI assistant needs controlled access to relational database data.

Use cases

  • Inspect database tables, schemas, indexes, and foreign keys
  • Run read-only SELECT queries against configured databases
  • Execute INSERT, UPDATE, and DELETE statements where writes are allowed
  • Review query execution plans
  • Separate database connections with per-connection read-only settings

Key features

  • PostgreSQL, MySQL, and SQLite connections
  • Table listings with row counts
  • Schema, index, and foreign-key inspection
  • Parameterized queries with single-statement enforcement
  • Per-connection read-only mode
  • Query timeouts and response-size limits

Tools6

What MCP Datalink lets your agent do. Expand a tool for its parameters.

Self-reported~56 tokens of context

Security & health

What it can reach and how reliably it runs — from our own checks, not the maintainer’s claims.

ActiveLast checked

Recent health check succeeded.

17/18 checks healthy over the last 111d

Supply-chain signal

No high-severity advisories surfaced by our automated scan.

Critical 0High 0Medium 0Low 0

Scanned 11d ago via OSV.dev · @pilat/mcp-datalink (npm)

Adoption & maintenance

Factual signals from GitHub, npm, and our automated checks — not a rating.

GitHub stars5Stargazers on the source repository.
npm downloads187Package downloads in the last 30 days.
Last commit3d agoMost recent push to the default branch.
Install checkInconclusiveDidn't respond in our test window — often a slow first install.
Tools exposed6Callable tools this server registers over MCP.
Directory activity6 viewsConfig copies, upvotes, and views on AllMCPs.

From the project README

@pilat/mcp-datalink

MCP server for PostgreSQL, MySQL, and SQLite. Gives AI assistants secure database access via Model Context Protocol.

Terminal
npx @pilat/mcp-datalink

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):

config.json
{
  "mcpServers": {
    "datalink": {
      "command": "npx",
      "args": ["-y", "@pilat/mcp-datalink"],
      "env": {
        "DATALINK_ANALYTICS_URL": "postgresql://user:password@localhost:5432/analytics",
        "DATALINK_ANALYTICS_READONLY": "true",

        "DATALINK_INVENTORY_URL": "mysql://user:password@localhost:3306/inventory",

        "DATALINK_CACHE_URL": "sqlite:///path/to/cache.db"
      }
    }
  }
}

This creates three database connections: analytics (read-only), inventory, and cache.

VariableDescription
DATALINK_{NAME}_URLConnection URL (creates database named {name})
DATALINK_{NAME}_READONLYSet to true to block writes
DATALINK_{NAME}_MAX_TIMEOUTMax query timeout in ms (caps model requests)

Connection URL formats:

bash
# PostgreSQL
postgresql://user:password@localhost:5432/dbname
postgresql://user:password@localhost:5432/dbname?sslmode=require

# MySQL
mysql://user:password@localhost:3306/dbname
mysql://user:password@localhost:3306/dbname?ssl=true

# SQLite
sqlite:///path/to/database.db
sqlite:///Users/me/data/app.sqlite
sqlite://../relative/path/data.db

Environment Variable Substitution

URLs support ${VAR} syntax to reference other environment variables:

config.json
{
  "mcpServers": {
    "datalink": {
      "command": "npx",
      "args": ["-y", "@pilat/mcp-datalink"],
      "env": {
        "DATALINK_MAIN_URL": "${DATABASE_URL}"
      }
    }
  }
}

This allows reusing existing environment variables (like DATABASE_URL from your shell or .env file).

Supported syntax:

SyntaxDescription
${VAR}Expands to value of VAR, or keeps ${VAR} if unset
${VAR:-default}Expands to value of VAR, or default if unset

Examples:

bash
# Reference existing DATABASE_URL
DATALINK_MAIN_URL="${DATABASE_URL}"

# Build URL from parts
DATALINK_MAIN_URL="postgresql://${DB_USER}:${DB_PASS}@${DB_HOST}:5432/mydb"

# With default values
DATALINK_MAIN_URL="postgresql://localhost:${DB_PORT:-5432}/mydb"

Config File Locations

ClientConfig 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
Clinecline_mcp_settings.json or VS Code settings cline.mcpServers

Tools

ToolDescription
list_databasesList configured database connections
list_tablesList tables with row counts
describe_tableGet schema, indexes, foreign keys
queryRun SELECT queries
executeRun INSERT/UPDATE/DELETE
explainShow query execution plans

Security

  • Prepared statements only (no SQL injection)
  • Single statement per query (no chaining)
  • DDL blocked (no DROP, ALTER, TRUNCATE)
  • Readonly mode per connection
  • Response size limit (100 rows, 64KB default, configurable via DATALINK_MAX_TOTAL_SIZE)
  • Query timeout: 30s default, model can request up to 10min, MAX_TIMEOUT caps it

License

MIT

Reviews

No reviews yet — be the first to share how it worked for you.

Frequently Asked Questions about MCP Datalink

It supports PostgreSQL, MySQL, and SQLite through configured connection URLs.

It provides an execute tool for INSERT, UPDATE, and DELETE statements, unless the connection is configured as read-only.

The server uses prepared statements, allows one statement per query, blocks DROP, ALTER, and TRUNCATE, and supports query timeouts and response-size limits.

Related MCP servers

Add a badge to your READMEShow it’s listed — live SVG, Markdown or HTML.

AllMCPs Directory Badge

Full Badge Customizer

Showcase your server listing on GitHub or your project documentation. Embed this dynamic SVG badge to highlight official listing status and live engagement.

Badge Style:
Live Dynamic SVG PreviewMCP Datalink AllMCPs Directory Badge
Markdown (GitHub README)
[![AllMCPs](https://allmcps.com/api/badge/pilat-mcp-datalink?style=directory)](https://allmcps.com/mcp/pilat-mcp-datalink)
HTML Embed
<a href="https://allmcps.com/mcp/pilat-mcp-datalink"><img src="https://allmcps.com/api/badge/pilat-mcp-datalink?style=directory" alt="MCP Datalink on AllMCPs" /></a>