{
  "markdown": "# text2sql-mcp\n\n<!-- mcp-name: io.github.cpenniman12/text2sql-mcp -->\n\nMCP server for [text2sql-framework](https://github.com/cpenniman12/text2sql-framework). Plugs into Claude Desktop, Cursor, Goose, or any other MCP-compatible assistant and lets it ask a SQL database questions in natural language.\n\nThe agent explores the schema, writes SQL, executes it against the real DB, and self-corrects on errors — no RAG layer, no schema descriptions, no pre-computed embeddings.\n\n## Install\n\nOut of the box, `text2sql-mcp` supports **SQLite + Anthropic**:\n\n```bash\npip install text2sql-mcp\n# or\nuvx text2sql-mcp\n```\n\nFor other databases or LLM providers, install with the matching extra so the right driver gets installed:\n\n| You want… | Install command |\n| --- | --- |\n| SQLite (default) | `uvx text2sql-mcp` |\n| Postgres | `uvx 'text2sql-mcp[postgres]'` |\n| MySQL | `uvx 'text2sql-mcp[mysql]'` |\n| Snowflake | `uvx 'text2sql-mcp[snowflake]'` |\n| BigQuery | `uvx 'text2sql-mcp[bigquery]'` |\n| OpenAI models | add `openai`, e.g. `uvx 'text2sql-mcp[postgres,openai]'` |\n\n## Configure\n\nSet environment variables in your MCP client config:\n\n| Variable | Required | Description |\n| --- | --- | --- |\n| `TEXT2SQL_DATABASE_URL` | yes | SQLAlchemy URL, e.g. `sqlite:///mydb.db`, `postgresql://user:pass@host/db` |\n| `ANTHROPIC_API_KEY` *or* `OPENAI_API_KEY` | yes | LLM provider key |\n| `TEXT2SQL_MODEL` | no | LangChain model id (default: `anthropic:claude-sonnet-4-6`) |\n| `TEXT2SQL_INSTRUCTIONS` | no | Business rules / hints, e.g. \"Revenue = net of refunds.\" |\n| `TEXT2SQL_EXAMPLES` | no | Path to a scenarios.md file for the agent's `lookup_example` tool |\n\n### Claude Desktop / Cursor / generic MCP\n\n```json\n{\n  \"mcpServers\": {\n    \"text2sql\": {\n      \"command\": \"uvx\",\n      \"args\": [\"text2sql-mcp\"],\n      \"env\": {\n        \"TEXT2SQL_DATABASE_URL\": \"sqlite:///mydb.db\",\n        \"ANTHROPIC_API_KEY\": \"sk-ant-...\"\n      }\n    }\n  }\n}\n```\n\n### Goose CLI\n\n```bash\ngoose configure\n# Add Extension → Command-line Extension\n# Name: text2sql\n# Command: uvx text2sql-mcp\n# Env: TEXT2SQL_DATABASE_URL, ANTHROPIC_API_KEY\n```\n\n## Tools\n\n- **`query(question, max_rows=100)`** — ask the database a natural-language question. Returns `{sql, data, error, row_count, tool_calls_made}`.\n\n## How it works\n\nUnder the hood this is a thin wrapper around [text2sql-framework](https://github.com/cpenniman12/text2sql-framework), which uses LangChain Deep Agents to do iterative tool-calling against a single `execute_sql` tool. See the framework README for benchmarks (19/20 on Spider zero-shot across 80 tables) and architecture details.\n\n## License\n\nMIT\n",
  "bytes": 2627,
  "sha": "4ab9860cea77fa06a3265a3e2e90975e3817bd5ba490f94d87b0d11cdf933d4e",
  "repo_slug": "cpenniman12/text2sql-mcp",
  "fonte": "repo",
  "truncated": false,
  "api": "https://agentalog.com/api/listings/mcp_io_github_cpenniman12_text2sql_mcp_7a12b257/readme"
}