{
  "markdown": "# Secure Schema MCP\n\n<!-- mcp-name: io.github.Siddharth-coder13/secure-schema -->\n\nA read-only MCP server that gives AI coding tools database structure without exposing row data. It returns table and view names, columns, types, keys, and relationships in a compact format designed to reduce LLM token usage.\n\n## What it exposes\n\n| Exposed | Not exposed |\n|---|---|\n| Table and view names | Row values or query results |\n| Column names and SQL types | Row counts or samples |\n| Primary and unique keys | Database credentials |\n| Foreign-key relationships | Write or query tools |\n\nSchema metadata can still be sensitive. A column name such as `ssn` reveals information even without values, so production deployments should always use the table allowlist and a dedicated database account.\n\n## Requirements\n\n- An MCP-compatible client such as Cursor or Codex\n- A reachable SQLite, PostgreSQL, or MySQL database\n- Python 3.12 or newer when installing without `uvx`\n\nSQLite support uses Python's built-in driver. PostgreSQL and MySQL drivers are included. Other SQLAlchemy dialects are not tested or bundled in v1.\n\n## Configure your IDE\n\nThe recommended setup uses [`uvx`](https://docs.astral.sh/uv/guides/tools/) to download and run the published Python package in an isolated environment. You do not need to clone this repository or start the server separately. Your IDE launches it over stdio when needed.\n\n### Cursor\n\nAdd this server to your Cursor MCP configuration:\n\n```json\n{\n  \"mcpServers\": {\n    \"secure-schema\": {\n      \"command\": \"uvx\",\n      \"args\": [\"mcp-secure-schema\"],\n      \"env\": {\n        \"DATABASE_URL\": \"postgresql+psycopg2://schema_reader:password@localhost:5432/appdb\",\n        \"DATABASE_SCHEMA\": \"public\",\n        \"ALLOWED_TABLES\": \"users,orders,products\",\n        \"SECURE_SCHEMA_ENV\": \"production\",\n        \"FASTMCP_CHECK_FOR_UPDATES\": \"off\",\n        \"FASTMCP_SHOW_SERVER_BANNER\": \"false\"\n      }\n    }\n  }\n}\n```\n\nRestart or reload Cursor after changing its MCP configuration.\n\n### Codex\n\nAdd this to `~/.codex/config.toml` or a trusted project's `.codex/config.toml`:\n\n```toml\n[mcp_servers.secure-schema]\ncommand = \"uvx\"\nargs = [\"mcp-secure-schema\"]\nenabled_tools = [\"schema_overview\", \"list_tables\", \"inspect_table\"]\nstartup_timeout_sec = 30\ntool_timeout_sec = 30\n\n[mcp_servers.secure-schema.env]\nDATABASE_URL = \"postgresql+psycopg2://schema_reader:password@localhost:5432/appdb\"\nDATABASE_SCHEMA = \"public\"\nALLOWED_TABLES = \"users,orders,products\"\nSECURE_SCHEMA_ENV = \"production\"\nFASTMCP_CHECK_FOR_UPDATES = \"off\"\nFASTMCP_SHOW_SERVER_BANNER = \"false\"\n```\n\n### Install once instead\n\nIf you prefer a persistent installation:\n\n```bash\npipx install mcp-secure-schema\n```\n\nThen use `\"command\": \"mcp-secure-schema\"` with an empty `args` list in the IDE configuration.\n\n## Database URLs\n\nSecure Schema MCP accepts SQLAlchemy connection URLs:\n\n```text\n# SQLite (absolute path)\nsqlite:////Users/me/project/app.db\n\n# PostgreSQL\npostgresql+psycopg2://user:password@localhost:5432/appdb\n\n# Remote PostgreSQL with certificate verification\npostgresql+psycopg2://user:password@db.example.com:5432/appdb?sslmode=verify-full&sslrootcert=/path/to/ca.pem\n\n# MySQL\nmysql+pymysql://user:password@localhost:3306/appdb\n```\n\nPercent-encode special characters in URL usernames and passwords. For example, `@` in a password becomes `%40`.\n\nLocal and remote databases use the same MCP configuration. For remote databases, the machine running the IDE must also have working DNS, network access, firewall permission, and valid TLS settings.\n\n## Configuration\n\n| Variable | Required | Description |\n|---|---|---|\n| `DATABASE_URL` | Yes | SQLAlchemy connection URL. Treated as a secret by the registry manifest. |\n| `DATABASE_SCHEMA` | No | Default schema or catalog namespace. Recommended for PostgreSQL. Locked against tool overrides in production. |\n| `ALLOWED_TABLES` | Production | Comma-separated, case-sensitive table and view allowlist. Production mode refuses to start without it. |\n| `SECURE_SCHEMA_ENV` | No | Set to `production` or `prod` for strict startup validation. Defaults to `development`. |\n| `FASTMCP_CHECK_FOR_UPDATES` | No | Set to `off` for predictable stdio startup. |\n| `FASTMCP_SHOW_SERVER_BANNER` | No | Set to `false` to suppress the startup banner. |\n\n### Multiple schemas\n\n`DATABASE_SCHEMA` selects the default namespace. Resolution works as follows:\n\n- In production, a configured `DATABASE_SCHEMA` is a security boundary and tool arguments cannot override it.\n- Outside production, an explicit tool `schema` argument overrides `DATABASE_SCHEMA`.\n- Without either value, the database driver's default schema is used.\n\nFor strict production access to multiple schemas, run one MCP server entry per schema with its own `DATABASE_SCHEMA` and `ALLOWED_TABLES` values. The table allowlist contains unqualified names, not `schema.table` values.\n\n## Tools\n\n- `schema_overview`: compact map of permitted tables, views, primary keys, and foreign-key relationships\n- `list_tables`: permitted table and view inventory\n- `inspect_table`: columns, SQL types, nullability, primary keys, unique constraints, and foreign keys for one entity\n\nEvery tool defaults to `format=\"compact\"` for lower token usage:\n\n```text\ntables:orders,users | pk:orders(order_id);users(user_id) | fk:orders.user_id->users.user_id\n```\n\nPass `format=\"markdown\"` when a human-readable table is more useful.\n\n## Security notes\n\n- The server exposes only SQLAlchemy inspection operations; it provides no row-query or write tool.\n- Missing and disallowed table names return the same message when an allowlist is active, avoiding an existence leak.\n- Client-facing errors are sanitized. Operational details are written to server stderr.\n- The IDE launches the MCP process and supplies its environment, so treat the IDE and its configuration as trusted.\n- Do not commit configurations containing credentials. For stronger isolation, launch through a wrapper that obtains `DATABASE_URL` from an OS keychain or secret manager.\n- Use a dedicated least-privilege database account and TLS certificate verification for remote connections.\n\nExample PostgreSQL role:\n\n```sql\nCREATE ROLE schema_reader LOGIN PASSWORD 'use-a-secret-manager';\nGRANT CONNECT ON DATABASE appdb TO schema_reader;\nGRANT USAGE ON SCHEMA public TO schema_reader;\n```\n\nMetadata visibility varies by PostgreSQL provider and database policy. Grant only the additional catalog or object privileges required for inspection; avoid granting row `SELECT` unless your environment requires it.\n\n## Troubleshooting\n\n**The server exits immediately**\n\nCheck the IDE's MCP logs. `DATABASE_URL` is mandatory, and production mode also requires a non-empty `ALLOWED_TABLES` value.\n\n**No tables or views are discovered**\n\nConfirm `DATABASE_SCHEMA`, exact table-name casing, database permissions, and whether the allowlist contains the expected names.\n\n**The connection URL fails with a valid password**\n\nPercent-encode reserved URL characters or use a secret-injection wrapper. Do not paste real credentials into issues or logs.\n\n**`uvx` is not found**\n\nInstall `uv` using its official instructions, or install the package with `pipx` and use `mcp-secure-schema` as the command.\n\n**Starting the command appears to hang**\n\nThat is normal for a stdio MCP server. It waits for an MCP client on standard input and is normally started by the IDE.\n\n## Development\n\nClone the repository only when developing or testing the server:\n\n```bash\ngit clone https://github.com/Siddharth-coder13/secure_schema_mcp.git\ncd secure_schema_mcp\nuv sync --extra dev\nuv run python tests/demo_database.py\nDATABASE_URL=\"sqlite:///$PWD/test_schema.db\" uv run mcp-secure-schema\n```\n\nRun the test suite:\n\n```bash\nuv run pytest\n```\n\nRun the opt-in PostgreSQL integration test against a disposable database. The test creates and removes a randomly named schema:\n\n```bash\nPOSTGRES_TEST_DATABASE_URL='postgresql+psycopg2://user@localhost:5432/testdb' \\\n  uv run pytest tests/test_postgres_smoke.py -v\n```\n\nThe tests verify row-data isolation, allowlist behavior, sanitized errors, compact output, relationships, schema selection, and the locked production namespace.\n\n## Release checklist\n\nMaintainers should update the matching versions in `pyproject.toml` and `server.json`, run the complete SQLite and PostgreSQL suites, build with `uv build --no-sources`, verify installation from the wheel, publish to PyPI, and only then publish `server.json` to the MCP Registry.\n\n## License\n\nLicensed under the Apache License 2.0. See `LICENSE` and `NOTICE`.\n",
  "bytes": 8544,
  "sha": "57e356ea4e0fc52c0a6a1391ee133f5ab965150e8f9b1c7a00ff05cc60fbcb82",
  "repo_slug": "siddharth-coder13/secure_schema_mcp",
  "fonte": "repo",
  "truncated": false,
  "api": "https://agentalog.com/api/listings/mcp_io_github_siddharth_coder13_secure_schem_2f5f49e1/readme"
}