Get the FREE Ultimate OpenClaw Setup Guide →

sql

SQL MCP is a Model Context Provider (MCP) server that allows AI applications to execute SQL queries

Installation
Run this command in your terminal to add the MCP server to Claude Code.
Run in terminal:
Command
claude mcp add --transport stdio adetxt-sql-mcp npx @adetxt/sql-mcp

How to use

This MCP server, sql-mcp, exposes a Model Context Protocol interface for interacting with SQL databases. It provides a standardized way to execute queries, inspect schemas, and manage data through MCP-compatible clients. With sql-mcp running, you can connect your MCP-enabled tools to a SQL database and perform operations like reading table structures, listing schemas, running parameterized queries, and performing transactional work within the MCP workflow. The server is designed to be drop-in compatible with other MCP tooling, so you can plug it into existing MCP-enabled environments and leverage familiar MCP commands to interact with your SQL backend.

How to install

Prerequisites:

  • Node.js and npm (or core club tools that provide npx)
  • Access to a SQL database you want to expose via MCP

Installation options (all rely on running the MCP server via npx):

  1. Install in Widsurf (run the MCP server with npx):
{
  "mcpServers": {
    "sql-mcp": {
      "command": "npx",
      "args": ["@adetxt/sql-mcp"]
    }
  }
}
  1. Install in Cursor (same npx approach):
{
  "mcpServers": {
    "sql-mcp": {
      "command": "npx",
      "args": ["@adetxt/sql-mcp"]
    }
  }
}
  1. Install in VS Code (stdio type configuration):
{
  "mcp": {
    "servers": {
      "sql-mcp": {
        "type": "stdio",
        "command": "npx",
        "args": ["@adetxt/sql-mcp"]
      }
    }
  }
}

Prerequisites summary:

  • Node.js and npm installed on the host
  • Access to the target SQL database (host, port, username, password, database name)
  • Optional: environment variables for database connection (see additional notes and environment variables below)

Additional notes

Environment and configuration tips:

  • Set a DATABASE_URL or individual DB_HOST, DB_PORT, DB_USER, DB_PASSWORD, and DB_NAME variables as required by your environment so sql-mcp can connect to the SQL backend.
  • Ensure network access from the MCP host to the SQL database (firewalls, VPC/subnet routing, and SSL requirements).
  • When starting, verify connection strings and permissions on the target database (read/write permissions as needed).
  • If you run into authentication or connectivity issues, check the MCP server logs for host/port, authentication errors, or TLS/SSL mismatch messages.
  • For multi-database setups, ensure the server configuration supports selecting the appropriate database/schema per request.

Related MCP Servers

Sponsor this space

Reach thousands of developers