Thoth
About
A secure, read-only MCP server for querying MySQL, PostgreSQL, and Redis datasources
Details
- Author
- pennxiv
- Categories
- Developer Tools
Jump to
Setup
Install Thoth in your MCP client (Claude Desktop, Cursor, Windsurf, and others).
Repository: https://github.com/pennxiv/thoth-mcp
Follow the installation instructions in the repository README, then restart your MCP client.
A security-first,read-onlyMCP server for AI assistants to safely query MySQL, PostgreSQL, and Redis.
Every query passes through a layered safety pipeline before it ever reaches your database — so you can give an AI assistant data-access capabilities without handing it a loaded gun.
- Why use this?
- Features
- Quick Start
- Configuration
- MCP Tools
- Security
- Transports
- Architecture
- Development
- License
- Read-only by design.Writes are structurally impossible — there is noexecutepath that ever mutates data.
- Defense in depth.SQL is validated three ways (SELECT enforcement → injection detection → automatic LIMIT). Redis commands are restricted to an explicit allowlist.
- Secrets never leave your config.Passwords are loaded from env vars and stripped from logs and error messages.
- One server, many datasources.Connect to all your databases through a single MCP endpoint.
- Works with any MCP client— Claude Code, Cursor, Windsurf, and anything else that speaks MCP.
- Query multiple MySQL, PostgreSQL, and Redis instances through one server
- Three-layer SQL safety (SELECT enforcement + injection detection + automatic LIMIT)
- Redis command allowlist (only explicitly safe read-only commands)
- Markdown output for efficient AI context usage
- stdio, SSE, and streamable-http transports
- Docker Compose stack with seed data for local development
- Python 3.10+
- Docker and Docker Compose (optional, for containerized deployment)
# Clone git clone https://github.com/pennxiv/thoth-mcp.git cd thoth-mcp # Set up a virtual environment python -m venv .venv source .venv/bin/activate # or .venv\Scripts\activate on Windows # Install pip install -e ".[dev]" # Point at your datasources and run export THOTH_DATASOURCES_FILE=config/datasources.yaml python -m thoth_mcp
# Starts the server in streamable-http mode on port 8080 docker compose up -d --build # Connect from any machine on your network: # http://<server-ip>:8080/mcp
Claude Code(~/.claude.jsonor project.mcp.json):
{ "mcpServers": { "thoth": { "url": "http://<server-ip>:8080/mcp", "transport": "streamable-http" } } }
{ "mcpServers": { "thoth": { "url": "http://<server-ip>:8080/mcp", "transport": "streamable-http" } } }
For local-only use, configure the client to launch the server over stdio instead — no HTTP exposure needed.
Create adatasources.yamlfile (or setTHOTH_DATASOURCES_FILEto point at one):
mysql: prod_db: host: mysql.example.com port: 3306 user: readonly_user password: ${MYSQL_PROD_PASSWORD} # overridden via environment variable database: production min_pool_size: 1 max_pool_size: 10 redis: cache: host: redis.example.com port: 6379 db: 0 min_pool_size: 1 max_pool_size: 10
Passwords should never live in config files. Override them via environment variables using the patternTHOTH_<TYPE>__<NAME>__PASSWORD:
export THOTH_MYSQL__PROD_DB__PASSWORD=secret123 export THOTH_POSTGRES__WAREHOUSE__PASSWORD=another_secret export THOTH_REDIS__CACHE__PASSWORD=redis_secret
Seeconfig/datasources.yamlfor a full example with all three datasource types.
This server is built around the assumption that anything reaching the database must be read-only and injection-free.
- SELECT-only enforcement— only SELECT statements are permitted.
- Injection pattern detection— blocks UNION injection, comment obfuscation, and multi-statement attacks.
- Automatic LIMIT injection— queries without a LIMIT clause receive a default limit (100 rows) to prevent unbounded scans.
Only these read-only commands are permitted:GET,HGET,HGETALL,LRANGE,SMEMBERS,TTL,TYPE,LLEN,SCARD,EXISTS,HEXISTS,SRANDMEMBER,ZCARD,ZSCORE,ZRANGE.
Commands likeSET,DEL,KEYS, andFLUSHALLare explicitly blocked.
Error messages never expose hostnames, IPs, connection strings, or credentials. This holds even when connection setup or query execution fails.
When running instreamable-httporssemode, the server listens on0.0.0.0:8080by default. Place it behind authenticated network boundaries — do not expose it directly to the public internet without additional auth. SeeSECURITY.md.
SSE mode exposes/sse(client connections) and/messages/(POST endpoint).
When serving over HTTP transports (streamable-httporsse) youshouldsetTHOTH_API_TOKENto protect the server. With a token set, every MCP request must carry anAuthorization: Bearer <token>header; requests without a valid token are rejected with401 Unauthorized. The/healthendpoint is always open for monitoring probes.
# On the server export THOTH_API_TOKEN=$(openssl rand -hex 32) # generate a strong token export MCP_TRANSPORT=streamable-http export MCP_PORT=8080 python -m thoth_mcp
# On the client (curl) curl -H "Authorization: Bearer <token>" http://server:8080/mcp
WhenTHOTH_API_TOKENis unset, authentication is disabled — suitable for localstdiousage, butnever expose an unauthenticated HTTP instance to the public internet.
┌──────────────────────────────────────────────────────────────┐ │ FastMCP Server │ │ ┌─────────────┐ ┌──────────────┐ ┌─────────────┐ │ │ │ MySQL Tools │ │PostgreSQL │ │ Redis Tools │ │ │ │ │ │Tools │ │ │ │ │ └──────┬──────┘ └──────┬───────┘ └──────┬──────┘ │ │ │ │ │ │ │ ┌──────▼──────┐ ┌──────▼───────┐ ┌──────▼──────┐ │ │ │ MySQL Pool │ │PostgreSQL │ │ Redis Pool │ │ │ │ Manager │ │Pool Manager │ │ Manager │ │ │ └──────┬──────┘ └──────┬───────┘ └──────┬──────┘ │ │ │ │ │ ┌──────────┐ │ │ ┌──────▼──────┐ ┌──────▼───────┐ ┌──────▼──────┐ │ │ │ SQL Safety │ │ SQL Safety │ │Redis Safety │ │ │ └──────┬──────┘ └──────┬───────┘ └──────┬──────┘ │ │ └───────────────┴────────────────┴───│ Config │ │ │ └──────────┘ │ └──────────────────────────────────────────────────────────────┘ │ │ │ ┌────▼────┐ ┌────▼─────┐ ┌────▼────┐ │ MySQL │ │PostgreSQL│ │ Redis │ │ DB │ │ DB │ │Instance │ └─────────┘ └──────────┘ └─────────┘
# Run the test suite pytest tests/ -v # Run a single test file pytest tests/test_mysql_tools.py -v # Run with coverage pytest tests/ --cov=src/thoth_mcp --cov-report=html # Lint ruff check src/ tests/
SeeCONTRIBUTING.mdfor contribution guidelines andCHANGELOG.mdfor version history.
thoth-mcp/ ├── src/thoth_mcp/ │ ├── config.py # Configuration loading │ ├── server.py # FastMCP server assembly │ ├── __main__.py # Entry point │ ├── db/ # Connection pool managers (mysql, postgresql, redis) │ ├── tools/ # MCP tools (mysql, postgresql, redis, discovery) │ └── utils/ # Safety layers, formatters, logging ├── tests/ # Test suite ├── docker/ # Docker seed data ├── config/ # Example configurations └── pyproject.toml
This is a web browser that enables your coding agent, such as Claude Code, to visit websites on your behalf and assist you in identifying bugs or creating UI test cases.
Create crafted UI components inspired by the best 21st.dev design engineers.
Bring agent evaluations, observability, and synthetic test set generation directly into your IDE for free with Galileo's new MCP server
An MCP server to help AI assistants to answer questions and generate AccelByte Extend SDK code more effectively .
MCP server for AI Diagram Maker — generate beautiful software engineering diagrams directly inside Cursor, Claude Desktop, Claude Code, or any MCP-compatible AI agent
ALAPI MCP Tools,Call hundreds of API interfaces via MCP
AI-powered SVG animation generator that transforms static files into animated SVG components using the Allyson platform
MCP server that gives AI assistants on-demand access to 1,500+ amCharts docs, ~300 code examples, and 1000+ class API references.
APIMatic MCP Server is used to validate OpenAPI specifications using APIMatic. The server processes OpenAPI files and returns validation summaries by leveraging APIMatic’s API.
One shared context layer for AI agents and humans — live API specs, DB schemas, and versioned contracts across repos so every agent and teammate works from the same source of truth.
Build and deploy full-stack Next.js apps with 98 tools for React, AWS, and MongoDB
Sign in to leave a review
Use Google, GitHub, or an email account so ratings stay tied to real people.
No reviews posted yet.





