MCP SQL Rust logo

MCP SQL Rust

Rust MCP server for querying MySQL, PostgreSQL, and SQLite with guarded SQL and compact columnar results.

Install MCP SQL Rust

Run the project’s own setup commands, in order.

Setup steps from the project

mcp-sql-rust installs with its own steps rather than a config we can generate, so these are copied as-is. Follow them in order and run the commands in a terminal. Source: github.com

  1. 1. Install
    curl -fsSL https://raw.githubusercontent.com/rzlco666/strut-stack-sql/main/install.sh | bash
    
  2. 2. Start the server
    strut-stack-sql                          # stdio, read-only
    
  3. 3. Start the server
    strut-stack-sql --http 127.0.0.1:8080
    

Overview

The mcp-sql-rust MCP server connects AI agents to MySQL, PostgreSQL, and SQLite through a Rust binary. It provides three default tools for object search, SQL execution, and query-performance analysis, returning columnar JSON with row and byte limits. SQL is checked with an AST guard before database pool checkout, with read-only defaults, optional write access, and configurable DDL exposure. Reach for it when an agent needs database access over stdio or Streamable HTTP without a language-specific client integration.

Use cases

  • Query database objects from an AI coding agent
  • Execute guarded SQL against PostgreSQL, MySQL, or SQLite
  • Analyze query performance through MCP tools
  • Expose database access over stdio or Streamable HTTP

Key features

  • MySQL, PostgreSQL, and SQLite support
  • Three default database tools
  • AST-based SQL guard
  • Columnar JSON results with row and byte caps
  • Read-only defaults with optional write and DDL controls
  • Stdio and Streamable HTTP transports

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.

13/13 checks healthy over the last 83d

Adoption & maintenance

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

GitHub stars1Stargazers on the source repository.
Last commit4mo agoMost recent push to the default branch.

How MCP SQL Rust works

What mcp-sql-rust does

The mcp-sql-rust MCP server gives MCP-compatible agents access to MySQL, PostgreSQL, and SQLite from one executable. It is designed to keep tool responses compact: query results use a column-oriented {cols, rows, meta} structure, with limits on returned rows and bytes.

The default operating mode exposes three tools: search_objects, execute_sql, and analyze_query_performance. Running the binary with --full-tools enables additional tools; DDL aliases also require --allow-ddl. The project is distributed under the MIT license and can run independently of the wider StrutStack ecosystem.

How it works

The mcp-sql-rust MCP server accepts MCP requests through standard input/output or Streamable HTTP. HTTP mode is enabled with --http, such as --http 127.0.0.1:8080, and provides /mcp plus a /healthz endpoint.

SQL passes through an AST-based guard before the server checks out a database connection. The guard rejects multi-statement input and applies write and complexity controls. The default command is read-only; --allow-writes enables write access. Client-side timeouts are supported alongside PostgreSQL statement_timeout and MySQL max_execution_time controls.

Results are intentionally structured for agent use rather than displayed as conventional row-by-row text. This reduces repeated column names in tool output while preserving metadata in the response.

Setup and configuration

Install the released binary with the project’s shell installer:

Terminal
curl -fsSL https://raw.githubusercontent.com/rzlco666/strut-stack-sql/main/install.sh | bash
strut-stack-sql --version

The installer places the executable in ~/.local/bin and creates the mcp-sql-rust compatibility alias. That directory must be available on PATH. Homebrew, Scoop, winget, Docker, and Cargo installation paths are also documented by the project.

Set DATABASE_URL to the target connection string, for example a PostgreSQL URL in a project .env file. Credentials are not needed for startup: without this variable, the process uses an in-memory SQLite database so MCP initialization can complete, but it cannot run queries against the intended external database. Cursor can launch the binary directly, or use the supplied workspace launcher to load a nested apps/api/.env file.

Tools and capabilities

  • Search database objects with search_objects.
  • Execute SQL with execute_sql.
  • Inspect query performance with analyze_query_performance.
  • Enable additional tools with --full-tools.
  • Use PostgreSQL, MySQL, or SQLite through the same binary.
  • Choose stdio or Streamable HTTP transport.

The mcp-sql-rust MCP server is a fit for agents that need controlled database inspection or carefully enabled mutations. Review the project’s security and tool documentation before enabling writes or DDL.

Limitations and notes

The server does not guarantee that a configured database is reachable at startup; the documented launcher intentionally does not block startup on a dead database. The fallback in-memory SQLite database can make initialization succeed without proving that production credentials or connectivity are correct.

Write operations are not available in the default read-only mode. DDL aliases have an additional --allow-ddl requirement, and the full tool set is not enabled unless --full-tools is supplied. The project reports benchmark measurements in its documentation but explicitly does not claim a QPS leaderboard.

Written by AllMCPs with AI assistance from the project’s README and listing data. How we build listings

Reviews

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

Frequently Asked Questions about MCP SQL Rust

mcp-sql-rust is an MCP server that connects AI agents to MySQL, PostgreSQL, and SQLite. Its main tools search database objects, execute SQL, and analyze query performance. It is written in Rust, returns compact columnar results, and supports stdio or Streamable HTTP transport.

Install it by running the project’s shell installer, which places the binary in ~/.local/bin. Run `curl -fsSL https://raw.githubusercontent.com/rzlco666/strut-stack-sql/main/install.sh | bash`, then verify it with `strut-stack-sql --version`. Ensure ~/.local/bin is on your PATH.

Set the `DATABASE_URL` environment variable to the target database connection string. Without it, the server starts with an ephemeral `sqlite::memory:` database so MCP initialization can succeed, but it will not connect to the intended external database.

Yes, mcp-sql-rust works with Cursor through its standard MCP configuration. Configure Cursor to launch `strut-stack-sql`, optionally pass `--full-tools`, and set `DATABASE_URL` in the project environment. The repository also provides a workspace launcher for loading nested `.env` files.

Enable writes with `--allow-writes`; DDL aliases additionally require `--allow-ddl`. The default command remains read-only, and the extra tool set is enabled separately with `--full-tools`. Review the project’s security guidance before changing these defaults.

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 SQL Rust AllMCPs Directory Badge
Markdown (GitHub README)
[![AllMCPs](https://allmcps.com/api/badge/mcp-sql-rust?style=directory)](https://allmcps.com/mcp/mcp-sql-rust)
HTML Embed
<a href="https://allmcps.com/mcp/mcp-sql-rust"><img src="https://allmcps.com/api/badge/mcp-sql-rust?style=directory" alt="MCP SQL Rust on AllMCPs" /></a>