mcpField
F
fastmcp-sqltools

fastmcp-sqltools

Local
github.com/atarkowskaDatabases1Updated 42w ago

About fastmcp-sqltools

fastmcp-sqltools is a FastMCP server for accessing PostgreSQL, MySQL, and SQLite databases. It offers table and schema inspection alongside query execution, including a read-only option with safety checks.

Key features

  1. 01List database tables
  2. 02Inspect table schemas
  3. 03Execute SQL queries
  4. 04Run read-only SELECT queries with safety checks
  5. 05Support PostgreSQL, MySQL, and SQLite

Use cases

  1. 01Inspect available tables and their schemas
  2. 02Run database queries from an MCP client
  3. 03Perform guarded, read-only SELECT queries
  4. 04Access a PostgreSQL, MySQL, or SQLite database

MCP support

The server exposes database table, schema, and query operations as tools for MCP clients. It detects the database type from the DATABASE_URL environment variable.

Configuration

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

mcp.json · Universal config
{
"mcpServers": {
"atarkowska-fastmcp-sqltools": {
"command": "uvx",
"args": [
"fastmcp-sqltools"
]
}
}
}
Run commanduvx fastmcp-sqltools

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
pypifastmcp-sqltools0.3.0

Tools

4

Saved tool list · updated 2w ago

ParameterTypeRequiredDescription
schemaanyNoDatabase schema name (default: None, uses default schema for the database)

Details

From the project README

FastMCP SQL Tools

mcp-name: io.github.atarkowska/fastmcp-sqltools

A Model Context Protocol (MCP) server built with FastMCP that provides SQL database access with support for PostgreSQL, MySQL, and SQLite.

Features

  • list_tables: List all tables in the database
  • get_table_schema: Get detailed schema information for a table including columns, types, constraints, and indexes
  • execute_query: Execute any SQL query (INSERT, UPDATE, DELETE, DDL, etc.)
  • execute_safe_query: Execute read-only SELECT queries with additional safety checks

Supported Databases

  • PostgreSQL: Full support via asyncpg
  • MySQL: Full support via aiomysql
  • SQLite: Full support via aiosqlite

The server automatically detects the database type from the DATABASE_URL environment variable.

Configuration

Add the following to your claude_desktop_config.json:

{
    "mcpServers": {
        "sql-mcp-tools": {
            "command": "uvx",
            "args": [
                "fastmcp-sqltools"
            ],
            "env": {
                "DATABASE_URL": "<your-database-url>"
            }
        }
    }
}
Database URL Format

The DATABASE_URL should be in one of the following formats:

  • PostgreSQL: postgresql://user:password@host:port/database or postgres://user:password@host:port/database
  • MySQL: mysql://user:password@host:port/database
  • SQLite: sqlite:///path/to/database.db (use three slashes for absolute path)

License

This project is licensed under the GNU Affero General Public License v3.0 (AGPL-3.0). See the LICENSE file for details.

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.