mcpField
D
DataLink

DataLink

Local
github.com/pilatDatabases5Updated 2w ago

About DataLink

DataLink is an MCP server that gives AI assistants access to PostgreSQL, MySQL, and SQLite databases. It provides schema inspection and query tools, with per-connection read-only settings and safeguards for queries.

Key features

  1. 01Connect PostgreSQL, MySQL, and SQLite
  2. 02List databases and tables
  3. 03Inspect schemas, indexes, and keys
  4. 04Run and explain queries
  5. 05Per-connection read-only mode
  6. 06Query safety limits

Use cases

  1. 01Inspect database tables and schemas
  2. 02Run read-only analytics queries
  3. 03Review query execution plans
  4. 04Allow controlled data changes

MCP support

DataLink exposes database listing, schema inspection, query, execute, and explain tools to MCP clients.

Configuration

Local server config is the same for every client. Copy it into your client’s MCP config file.

mcp.json · Universal config
{
"mcpServers": {
"pilat-mcp-datalink": {
"command": "npx",
"args": [
"-y",
"@pilat/mcp-datalink"
],
"env": {
"DATALINK_ANALYTICS_URL": "<DATALINK_ANALYTICS_URL>",
"DATALINK_ANALYTICS_READONLY": "<DATALINK_ANALYTICS_READONLY>"
}
}
}
}
Run commandnpx -y @pilat/mcp-datalink
Environment variables to set
DATALINK_ANALYTICS_URLSecretDatabase connection URL. Pattern: DATALINK_<NAME>_URL where <NAME> identifies the database. Supports postgresql://, mysql://, or file path for SQLite.
DATALINK_ANALYTICS_READONLYSet to 'true' for read-only access. Pattern: DATALINK_<NAME>_READONLY

Local servers need a runtime on your machine (e.g. Node.js 18+). Config file locations differ by client; see your client’s docs.

Packages
npm@pilat/mcp-datalink1.2.4

Tools

6

Saved tool list · updated 2w ago

This tool takes no parameters.

Details

From the project 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):

{
  "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:

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

{
  "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:

# 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

Comments

Markdown supported

New to MCP?

From what the protocol is to installing your first server, these answers cover most first questions.

An open protocol that defines how AI applications connect to external tools and data in a uniform way. Clients talk to the model; MCP servers provide tools, resources and prompt templates. They exchange standard messages, so one server can be reused by many clients.