Fastmcp Sqltools logo

Fastmcp Sqltools

Connects AI agents to PostgreSQL, MySQL, or SQLite for schema inspection and SQL execution.

Install Fastmcp Sqltools

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

STDIOPython
~/Library/Application Support/Claude/claude_desktop_config.json
claude_desktop_config.json
{
  "mcpServers": {
    "fastmcp-sqltools": {
      "command": "uvx",
      "args": [
        "fastmcp-sqltools"
      ],
      "env": {
        "DATABASE_URL": "YOUR_VALUE_HERE"
      }
    }
  }
}

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

Values are written into the snippet above so you can paste it as is. They never leave your browser.

Install not yet sandbox-tested— the server itself is confirmed live (we called its tools/list endpoint). The stdio install command is a separate, ongoing check.

Overview

The fastmcp-sqltools MCP server connects AI agents to PostgreSQL, MySQL, and SQLite databases through FastMCP. It detects the database type from DATABASE_URL and exposes tools for listing tables, inspecting schemas, and running SQL. A read-only query tool restricts execution to SELECT statements, while the general query tool can perform data changes and DDL. Use it when an agent needs direct database inspection or controlled SQL access.

Use cases

  • Inspect database tables and schemas
  • Run read-only SQL analysis
  • Execute controlled data updates
  • Explore PostgreSQL, MySQL, or SQLite databases

Key features

  • Supports PostgreSQL, MySQL, and SQLite
  • Lists tables by schema
  • Returns columns, types, constraints, and indexes
  • Executes arbitrary SQL
  • Provides a read-only SELECT tool

Tools4

What Fastmcp Sqltools lets your agent do. Expand a tool for its parameters.

Verified live~379 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.

16/19 checks healthy over the last 111d

Supply-chain signal

No high-severity advisories surfaced by our automated scan.

Critical 0High 0Medium 0Low 0

Scanned 10d ago via OSV.dev · fastmcp-sqltools (PyPI)

Adoption & maintenance

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

GitHub stars1Stargazers on the source repository.
Last commit7d agoMost recent push to the default branch.
Tools exposed4Callable tools this server registers over MCP.

How Fastmcp Sqltools works

What fastmcp-sqltools MCP server does

The fastmcp-sqltools MCP server gives an MCP-compatible client access to a configured SQL database. It supports PostgreSQL, MySQL, and SQLite, with the database engine selected from the format of the DATABASE_URL environment variable.

Its capabilities cover both database discovery and query execution. An agent can enumerate tables in a schema, retrieve column and structural details for a table, run unrestricted SQL, or use a read-only path for SELECT statements. This makes the server suitable for database exploration, schema-aware analysis, and tasks that require SQL execution from an agent.

How it works

The server is built with FastMCP and communicates with an MCP client using the server configuration supplied by that client. Database connections use asyncpg for PostgreSQL, aiomysql for MySQL, and aiosqlite for SQLite.

The connection target is provided through DATABASE_URL. PostgreSQL URLs may use either the postgresql or postgres scheme. MySQL uses the mysql scheme, while SQLite uses sqlite:/// followed by the database path. The server identifies the database type from this URL rather than requiring a separate database-type setting.

Setup and configuration

Install or launch the package with uvx and register it as an MCP server in the client configuration. The documented Claude Desktop configuration invokes fastmcp-sqltools as the uvx package and passes DATABASE_URL through the environment.

Example connection formats are:

  • postgresql://user:password@host:port/database
  • postgres://user:password@host:port/database
  • mysql://user:password@host:port/database
  • sqlite:///path/to/database.db

For SQLite, three slashes are used for an absolute path. Replace the placeholder credentials, host, port, database name, or file path with the target database connection details.

Tools and capabilities

The fastmcp-sqltools MCP server exposes four tools:

  • list_tables lists tables in a specified schema.
  • get_table_schema returns table structure, including columns, types, constraints, and indexes.
  • execute_query runs arbitrary SQL. It supports statements such as INSERT, UPDATE, DELETE, and DDL in addition to queries.
  • execute_safe_query runs read-only SELECT statements and applies additional safety checks intended to prevent data modification.

Use get_table_schema before generating SQL when the agent needs current column or constraint information. Prefer execute_safe_query for inspection and reporting tasks where writes are not required.

Limitations and notes

The fastmcp-sqltools MCP server does not make every query read-only. execute_query can modify data or database structure, so exposing it to an agent requires care and appropriate database permissions. The safer tool is limited to SELECT queries and is intended for read-only access.

The provided configuration requires a valid DATABASE_URL. Connection behavior and available operations also depend on the selected database engine and the permissions of the configured database account. The documented setup specifically shows Claude Desktop, while the server uses the standard MCP process configuration through uvx.

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 Fastmcp Sqltools

fastmcp-sqltools is an MCP server that connects AI agents to PostgreSQL, MySQL, or SQLite databases through FastMCP. Its main tools list tables, inspect table schemas, execute arbitrary SQL, and run read-only SELECT queries with additional safety checks. It detects the database type from the DATABASE_URL environment variable.

Install and launch it with uvx by adding `fastmcp-sqltools` as the command in your MCP client configuration. Set DATABASE_URL in the configuration environment, using the documented URL format for PostgreSQL, MySQL, or SQLite.

fastmcp-sqltools supports PostgreSQL, MySQL, and SQLite. It selects the database implementation from DATABASE_URL and uses asyncpg, aiomysql, or aiosqlite for the corresponding database type.

Use the `execute_safe_query` tool for read-only SQL. It accepts SELECT queries and applies additional safety checks to prevent data modification; use `execute_query` only when arbitrary SQL, including DML or DDL, is required.

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