llm-sql-safety-executor-mcp GEMINI.md

llm-sql-safety-executor-mcp GEMINI.md is an instructions file for Gemini CLI from Firstmeridian/llm-sql-safety-executor-mcp. It costs 2,263 tokens per session, scanned A, original, MIT.

A set of project instructions for a Python service that checks SQL queries and runs only read-only queries through an MCP interface. Read-only queries retrieve information without changing database data.

In plain words
What is it for?
Use it when developing or reviewing the SQL safety checker, its database connections, or its MCP service.
Why use it?
It helps an agent understand the project's safety rules, architecture, files, and commands before making changes.

Instructions file for Gemini CLI

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add instructions/firstmeridian/llm-sql-safety-executor-mcp/gemini-md
Clone the repo
git clone --depth 1 https://github.com/Firstmeridian/llm-sql-safety-executor-mcp

Made for: Gemini CLI.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for llm-sql-safety-executor-mcp GEMINI.md

README.md
[![agentmods](https://agentmods.dev/badge/instructions/firstmeridian/llm-sql-safety-executor-mcp/gemini-md.svg)](https://agentmods.dev/instructions/firstmeridian/llm-sql-safety-executor-mcp/gemini-md)
Your own site
<a href="https://agentmods.dev/instructions/firstmeridian/llm-sql-safety-executor-mcp/gemini-md"><img src="https://agentmods.dev/badge/instructions/firstmeridian/llm-sql-safety-executor-mcp/gemini-md.svg" alt="Measured on agentmods" height="20"></a>
Per session 2,263 This file is loaded in full into every session.
When invoked 2,263 The same file — it is already loaded in full.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.02263 $0.02263
Opus 5 $0.01131 $0.01131
Sonnet 5 $0.00453 $0.00453
Haiku 4.5 $0.00226 $0.00226

Measured 5d ago against content hash d095146a00b9, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-05, from the pricing page.

Security

Grade A, and why

llm-sql-safety-executor-mcp GEMINI.md scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 5d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

GEMINI.md · 228 lines

How it starts

The opening of the file, as written. The whole thing — 228 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Gemini Project Context

Project Overview

This project is a Python-based tool designed to allow Large Language Models (LLMs) to safely execute read-only SQL queries. It provides functions to validate a given SQL query to ensure it is safe and read-only (i.e., only SELECT / SHOW / DESCRIBE / EXPLAIN are allowed), and then execute the validated query against a database.

NEW: MCP Service Implementation - The project now includes a Model Context Protocol (MCP) service that wraps the original functionality, providing a standardized interface for AI models to interact with the SQL safety checker.

The primary technologies used are:

  • Python as the programming language.
  • sqlparse for SQL query validation.
  • SQLAlchemy for database connection and execution, using a connection pool.
  • PyMySQL as the database driver for MySQL.
  • python-dotenv for managing database credentials through a .env file.
  • fastMCP for creating the MCP service implementation.

Key Files

  • sql_safety_checker.py: The core logic of the project resides here. It contains:
    • is_sql_safe(sql_query): Validates whether a SQL query is read-only and safe (e.g., SELECT / SHOW / DESCRIBE / EXPLAIN).
    • execute_sql(sql_query): Validates the query using is_sql_safe and then executes it against the database.
  • mcp_sql_server.py: MCP (Model Context Protocol) server implementation that wraps the SQL safety checker functionality (refactored December 2025):
    • query(sql): Primary MCP tool for executing read-only SQL queries (with automatic validation)
    • check_connection(): MCP tool for testing database connectivity
    • list_tables(): MCP tool for listing all tables with estimated row counts
    • describe_table(table_name): MCP tool for retrieving table column info and query recommendations
    • get_full_schema(): MCP tool for getting complete database schema in one call
    • get_table_summary(table_name): Optional MCP tool for getting table statistics (controlled by ENABLE_TABLE_SUMMARY, default disabled)
    • sample(table_name, limit): Optional MCP tool for retrieving sample data (controlled by ENABLE_SCHEMA_TOOLS, default enabled)
    • sql_assistant(): MCP prompt for SQL query assistance
  • test_mcp_functions.py: NEW - Test script to verify MCP functions work correctly (internal tests)
  • test_mcp_client.py: NEW - MCP client test script that simulates real client connections
  • mcp_config.json: NEW - Configuration file for MCP client integration
  • TEST_MCP_CLIENT_GUIDE.md: NEW - Usage guide for the MCP client test script
  • PROMPT_ENGINEERING_BEST_PRACTICES.md: NEW - Guidelines for MCP tool descriptions and prompts
  • REFACTORING_LOG.md: NEW - December 2025 refactoring changes documentation
  • .env.example: NEW - Example environment configuration file
  • requirements.txt: Lists all the necessary Python packages for this project (now includes fastMCP).
  • .gitignore: A standard Python .gitignore file to exclude unnecessary files from version control.
  • GEMINI.md: This file, providing context for the Gemini CLI.

Read the full file on GitHub · 228 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 5d ago First seen · 228 lines · 2,263 tokens per session scan A d095146a00b9

Subscribe to this mod's changes

llm-sql-safety-executor-mcp GEMINI.md is an instructions file published in the GitHub repository Firstmeridian/llm-sql-safety-executor-mcp (6 stars, last pushed 2d ago), licensed MIT. It adds 2,263 tokens to every session, about $0.0113 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.