{"id":47977891,"url":"https://github.com/firas-mcp-servers/mcp-sql-bridge","last_synced_at":"2026-04-04T10:58:26.449Z","repository":{"id":344213739,"uuid":"1180236473","full_name":"firas-mcp-servers/mcp-sql-bridge","owner":"firas-mcp-servers","description":"Read-only MCP server for SQL — give your AI assistant schema-aware access to SQLite, PostgreSQL, and MySQL. No cloud, no writes.","archived":false,"fork":false,"pushed_at":"2026-03-14T18:25:38.000Z","size":192,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2026-04-04T10:58:22.105Z","etag":null,"topics":["ai-tools","claude","cursor","database","fastapi","mcp","model-context-protocol","mysql","open-source","postgresql","python","sql","sqlite"],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/firas-mcp-servers.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"docs/SECURITY.md","support":".github/SUPPORT.md","governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-03-12T20:56:27.000Z","updated_at":"2026-03-14T18:25:42.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/firas-mcp-servers/mcp-sql-bridge","commit_stats":null,"previous_names":["firas-mcp-servers/mcp-sql-bridge"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/firas-mcp-servers/mcp-sql-bridge","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/firas-mcp-servers%2Fmcp-sql-bridge","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/firas-mcp-servers%2Fmcp-sql-bridge/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/firas-mcp-servers%2Fmcp-sql-bridge/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/firas-mcp-servers%2Fmcp-sql-bridge/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/firas-mcp-servers","download_url":"https://codeload.github.com/firas-mcp-servers/mcp-sql-bridge/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/firas-mcp-servers%2Fmcp-sql-bridge/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31397056,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-04T10:20:44.708Z","status":"ssl_error","status_checked_at":"2026-04-04T10:20:06.846Z","response_time":60,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ai-tools","claude","cursor","database","fastapi","mcp","model-context-protocol","mysql","open-source","postgresql","python","sql","sqlite"],"created_at":"2026-04-04T10:58:26.373Z","updated_at":"2026-04-04T10:58:26.439Z","avatar_url":"https://github.com/firas-mcp-servers.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# MCP SQL Bridge\n\n\u003c!-- mcp-name: io.github.firas-mcp-servers/mcp-sql-bridge --\u003e\n\n**Local-SQL-Insight** — Give your AI assistant direct, read-only access to your SQL databases over the [Model Context Protocol](https://modelcontextprotocol.io). No APIs, no cloud. Your data stays on your machine.\n\n---\n\n## Why use this?\n\n- **Schema-aware AI** — The agent sees table names, columns, and full `CREATE TABLE` DDL so it can write correct SQL.\n- **Business context** — Expose a project `README.md` as a resource so the AI understands your domain and conventions.\n- **Read-only by design** — Only `SELECT` is allowed. No accidental writes or schema changes.\n- **Stdio transport** — Works with Cursor, Claude Desktop, and any MCP host. No ports or network setup.\n- **Multi-database (Pro)** — Use the same tools against SQLite, PostgreSQL, and MySQL by switching a `backend` and connection string.\n\n---\n\n## Quick start\n\n```bash\ngit clone \u003cyour-repo-url\u003e\ncd mcp-sql-bridge\npoetry install\n```\n\nThen plug the server into your editor or desktop app (see below).\n\n**Run \u0026 test:** See **[RUN_AND_TEST.md](RUN_AND_TEST.md)** for how to run the MCP server, the web server, unit tests, and Docker-based integration tests (e.g. `poetry run python scripts/run_docker_integration.py`).\n\n### Web server (optional)\n\nA small FastAPI app provides a **landing page**, **Swagger UI**, and **documentation** (MkDocs):\n\n```bash\npoetry install --with web\nmkdocs build          # build docs (optional; without this, /documentation shows build instructions)\npoetry run mcp-sql-bridge-web\n```\n\nOpen [http://localhost:8000](http://localhost:8000) for the home page, [http://localhost:8000/docs](http://localhost:8000/docs) for Swagger, [http://localhost:8000/redoc](http://localhost:8000/redoc) for ReDoc, and [http://localhost:8000/documentation](http://localhost:8000/documentation) for the full docs site (after `mkdocs build`).\n\n---\n\n## How to use with Cursor\n\n1. **Install the server** (if not already):\n   ```bash\n   cd /path/to/mcp-sql-bridge\n   poetry install\n   ```\n\n2. **Configure MCP**  \n   Open Cursor Settings → **Tools \u0026 MCP** (or edit the config file directly).  \n   Add the server using the template in **`mcp-config.json`** in this repo:\n\n   - **Option A — Global config**  \n     Put the contents of `mcp-config.json` into:\n     - **macOS / Linux:** `~/.cursor/mcp.json`\n     - **Windows:** `%APPDATA%\\Cursor\\mcp.json`\n\n   - **Option B — Project config**  \n     Copy `mcp-config.json` into your project as `.cursor/mcp.json` (and adjust the `cwd` path to this repo if needed).\n\n3. **Set the path**  \n   In the config, set `cwd` (or the path in `args`) to the **absolute path** of your `mcp-sql-bridge` project directory so Cursor can run `poetry run mcp-sql-bridge` from there.\n\n4. **Restart Cursor**  \n   MCP servers load at startup. Restart Cursor after changing the config.\n\n5. **Use it**  \n   In any chat, the AI can call **Local-SQL-Insight** tools: `list_tables`, `execute_readonly_query`, and read the **Database README** resource.  \n   - For SQLite, point it at a file path (e.g. `./data/app.db`) with `backend: \"sqlite\"` or by omitting `backend`.  \n   - For PostgreSQL/MySQL (Pro), provide a `backend` and `connection_string` URL.\n\n---\n\n## How to use with Claude Desktop\n\n1. **Install the server** (if not already):\n   ```bash\n   cd /path/to/mcp-sql-bridge\n   poetry install\n   ```\n\n2. **Locate Claude’s config file**  \n   - **macOS:** `~/Library/Application Support/Claude/claude_desktop_config.json`  \n   - **Windows:** `%APPDATA%\\Claude\\claude_desktop_config.json`\n\n3. **Add the MCP server**  \n   Add a `mcpServers` entry (or merge into existing) like this, using the **absolute path** to your `mcp-sql-bridge` directory:\n\n   ```json\n   {\n     \"mcpServers\": {\n       \"local-sql-insight\": {\n         \"command\": \"poetry\",\n         \"args\": [\"run\", \"mcp-sql-bridge\"],\n         \"cwd\": \"/absolute/path/to/mcp-sql-bridge\"\n       }\n     }\n   }\n   ```\n\n   If Claude Desktop uses a different Python environment, you can instead use the full path to the `mcp-sql-bridge` executable in the project’s virtualenv, for example:\n\n   ```json\n   {\n     \"mcpServers\": {\n       \"local-sql-insight\": {\n         \"command\": \"/absolute/path/to/mcp-sql-bridge/.venv/bin/mcp-sql-bridge\",\n         \"args\": []\n       }\n     }\n   }\n   ```\n\n4. **Restart Claude Desktop**  \n   Restart the app so it picks up the new MCP config.\n\n5. **Use it**  \n   Claude can use the **list_tables** and **execute_readonly_query** tools and read the **Database README** resource.  \n   - For SQLite, use your SQLite file path (e.g. `~/project/data/app.db`).  \n   - For PostgreSQL/MySQL, supply connection URLs when the model asks for database details.\n\n---\n\n## What the server provides\n\n| Capability | Description |\n|------------|-------------|\n| **list_tables** | Lists every table, its columns, and the full `CREATE TABLE` statement. Supports `backend: \"sqlite\" | \"postgres\" | \"mysql\"`. |\n| **execute_readonly_query** | Runs a `SELECT` query and returns results as a formatted text table. Supports all backends via `backend` and `connection_string` / `db_path`. |\n| **schema_summary** | Compact overview of tables and key columns for a quick schema scan. |\n| **sample_rows** | Limited sample rows from a given table to understand data shape and example values. |\n| **explain_database** | High-level explanation of the database based on its schema. |\n| **suggest_indexes_for_query** | Heuristic index suggestions for a given SELECT query (no writes). |\n| **Database README** (resource) | Serves `README.md` from the server’s current working directory so the AI can read your project’s business context. |\n| **Database README template** (resource) | A markdown template for per-database README files (owners, conventions, key tables, gotchas). |\n\nFor SQLite, the server validates that paths point to real SQLite files (magic header check) and returns clear errors if a path is wrong or not a database.  \nFor PostgreSQL/MySQL, it validates connections and reports connection/auth errors clearly; use read-only roles in production.\n\n### Connection strings (PostgreSQL \u0026 MySQL)\n\nUse the `connection_string` argument with `backend: \"postgres\"` or `backend: \"mysql\"` when calling `list_tables` or `execute_readonly_query`.\n\n**PostgreSQL** — URL format (password in URL is optional; use env vars in production):\n\n- `postgresql://user:password@localhost:5432/dbname`\n- `postgresql://user@localhost:5432/dbname` (no password)\n- `postgresql://localhost:5432/dbname` (peer/auth trust)\n\n**MySQL** — URL format:\n\n- `mysql://user:password@localhost:3306/dbname`\n- `mariadb://user:password@localhost:3306/dbname`\n\nInstall optional drivers: `poetry install --extras postgres` and/or `poetry install --extras mysql` (or `--extras pro` for both). Example MCP configs for multi-database setups are in **`examples/mcp-config-pro.json`** and **`examples/README.md`**.\n\n---\n\n## Documentation\n\n- [Main README](README.md) (this file) — quick start and usage.\n- [docs/](docs/) — [security and hardening](docs/SECURITY.md), [error taxonomy](docs/ERROR_TAXONOMY.md), [pricing and licensing](docs/PRICING_AND_LICENSING.md), [launch and marketing](docs/LAUNCH_AND_MARKETING.md), [future ideas](docs/FUTURE.md).\n- [CONTRIBUTING.md](CONTRIBUTING.md) — development setup, tests, release, PyPI.\n\n## Requirements\n\n- **Python 3.11+**\n- **Poetry** (recommended) or `pip` for dependencies\n- Optional extras:\n  - `postgres` extra for PostgreSQL (`psycopg`)\n  - `mysql` extra for MySQL (`pymysql`)\n\n## Feedback and support\n\n- **Bug reports and feature ideas:** [Open an issue](https://github.com/firas-mcp-servers/mcp-sql-bridge/issues).\n- **Questions and discussions:** [GitHub Discussions](https://github.com/firas-mcp-servers/mcp-sql-bridge/discussions).\n- Feedback from users (issues, discussions, or contact) is used to prioritize the roadmap and any future paid offerings.\n\n## Support \u0026 maintenance\n\n- Targeted Python: 3.11+\n- MCP: current stable versions at time of release\n- Backwards-compatible changes will be released as minor versions; breaking changes will bump the major or minor version and be noted in `CHANGELOG.md`.\n- The project is intended to be feature-complete after the 0.2.x line; future work will focus on fixes and compatibility updates only.\n\n---\n\n## License\n\nMIT. See [LICENSE](LICENSE) for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffiras-mcp-servers%2Fmcp-sql-bridge","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffiras-mcp-servers%2Fmcp-sql-bridge","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffiras-mcp-servers%2Fmcp-sql-bridge/lists"}