DataLink

io.github.pilatPublished by GitHub account pilatv1.2.4Updated Oct 24, 2026

MCP server for secure database access (PostgreSQL, MySQL, SQLite)

VerifiedSTDIODesktop onlyDatabasesDeveloper Tools

Overview

AI-generated overview

A local MCP server that gives an AI assistant secure access to PostgreSQL, MySQL and SQLite databases for schema inspection, queries and writes.

What you can do
List configured database connections and their tables with row counts, and describe table schemas, indexes and foreign keys across PostgreSQL, MySQL and SQLite connections defined by environment variables. Run SELECT queries and view query execution plans. Run INSERT, UPDATE and DELETE statements on connections that are not marked read-only. Apply per-connection safeguards such as prepared statements, single-statement queries, blocked DDL, row and size limits, and query timeouts.
When to use it
Useful when an assistant needs to explore or query one or more relational databases during development or analysis, especially when you want several named connections with per-connection read-only control and built-in limits on result size and query time.
Requirements
Runs locally via npx with Node.js. Each database is configured with a DATALINK_ _URL environment variable (PostgreSQL, MySQL or SQLite URL or file path); optional DATALINK_ _READONLY and DATALINK_ _MAX_TIMEOUT variables control writes and timeouts. URLs may reference other environment variables with ${VAR} syntax. Network access to the database hosts is required.
Before you install
Connection URLs typically embed database usernames and passwords and are stored in the client config file, so protect that file. Connections are writable unless DATALINK_ _READONLY is set to true, and the execute tool can change or delete data. DDL is blocked, but review which connections are exposed and prefer read-only mode where writes are not needed.

Installation

In SourceWeft

  1. Open DataLink in the dashboard and add it to a workspace.
  2. Enable the server for the chats that should use its tools.

Desktop only via STDIO. STDIO servers start a local process, so they need the SourceWeft desktop host.

Other MCP clients

Follow the launch instructions in the repository.

README

@pilat/mcp-datalink

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

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

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
# PostgreSQLpostgresql://user:password@localhost:5432/dbnamepostgresql://user:password@localhost:5432/dbname?sslmode=require
# MySQLmysql://user:password@localhost:3306/dbnamemysql://user:password@localhost:3306/dbname?ssl=true
# SQLitesqlite:///path/to/database.dbsqlite:///Users/me/data/app.sqlitesqlite://../relative/path/data.db

Environment Variable Substitution

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

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_URLDATALINK_MAIN_URL="${DATABASE_URL}"
# Build URL from partsDATALINK_MAIN_URL="postgresql://${DB_USER}:${DB_PASS}@${DB_HOST}:5432/mydb"
# With default valuesDATALINK_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

Source: README.md at commit 1a643a5

Tools

0
SourceWeft has not started this package in its sandbox yet, so its tools are not known.

Version history

1
  1. v1.2.4LatestSep 16, 2026

Score

50% of the applicable checks met

How complete this listing is, computed from the registry entry, the endpoint and public sources. Not a rating of the server and not a statement that it is safe or working today: reachability is a dated check, and no installs or reviews go into the score.

  • Reached in the last 30 days25 pts

    Keep the endpoint answering the MCP handshake; SourceWeft probes it every 30 days.

  • Auth declared10 pts

    Declare the credential headers in the registry entry, or keep the endpoint answering the probe so its auth can be classified.

  • Tools listed15 pts

    Answer tools/list without a credential, or ship a package that starts in a sandbox without one.

  • DescriptionRequired15 pts
  • Logo10 pts
  • Documentation15 pts
  • License10 pts