Read-only MCP server for exposing database schema metadata without row data.
Copy the AI prompt to install this server into Claude Code, Cursor, or another agent β or use 1-click editor setup below.
π‘ Paste into ~/Library/Application Support/Claude/claude_desktop_config.json (macOS) or %APPDATA%\Claude\claude_desktop_config.json (Windows)
A 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.
| Exposed | Not exposed |
|---|---|
| Table and view names | Row values or query results |
| Column names and SQL types | Row counts or samples |
| Primary and unique keys | Database credentials |
| Foreign-key relationships | Write or query tools |
Schema 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.
uvxSQLite support uses Python's built-in driver. PostgreSQL and MySQL drivers are included. Other SQLAlchemy dialects are not tested or bundled in v1.
The recommended setup uses uvx 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.
Add this server to your Cursor MCP configuration:
Restart or reload Cursor after changing its MCP configuration.
Add this to ~/.codex/config.toml or a trusted project's .codex/config.toml:
If you prefer a persistent installation:
Then use "command": "mcp-secure-schema" with an empty args list in the IDE configuration.
Secure Schema MCP accepts SQLAlchemy connection URLs:
Percent-encode special characters in URL usernames and passwords. For example, @ in a password becomes %40.
Local 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.
| Variable | Required | Description |
|---|---|---|
DATABASE_URL | Yes | SQLAlchemy connection URL. Treated as a secret by the registry manifest. |
DATABASE_SCHEMA | No | Default schema or catalog namespace. Recommended for PostgreSQL. Locked against tool overrides in production. |
ALLOWED_TABLES | Production | Comma-separated, case-sensitive table and view allowlist. Production mode refuses to start without it. |
SECURE_SCHEMA_ENV | No | Set to production or prod for strict startup validation. Defaults to development. |
FASTMCP_CHECK_FOR_UPDATES | No | Set to off for predictable stdio startup. |
FASTMCP_SHOW_SERVER_BANNER | No | Set to false to suppress the startup banner. |
DATABASE_SCHEMA selects the default namespace. Resolution works as follows:
DATABASE_SCHEMA is a security boundary and tool arguments cannot override it.schema argument overrides DATABASE_SCHEMA.For 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.
schema_overview: compact map of permitted tables, views, primary keys, and foreign-key relationshipslist_tables: permitted table and view inventoryinspect_table: columns, SQL types, nullability, primary keys, unique constraints, and foreign keys for one entityEvery tool defaults to format="compact" for lower token usage:
Pass format="markdown" when a human-readable table is more useful.
DATABASE_URL from an OS keychain or secret manager.Example PostgreSQL role:
Metadata 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.
The server exits immediately
Check the IDE's MCP logs. DATABASE_URL is mandatory, and production mode also requires a non-empty ALLOWED_TABLES value.
No tables or views are discovered
Confirm DATABASE_SCHEMA, exact table-name casing, database permissions, and whether the allowlist contains the expected names.
The connection URL fails with a valid password
Percent-encode reserved URL characters or use a secret-injection wrapper. Do not paste real credentials into issues or logs.
uvx is not found
Install uv using its official instructions, or install the package with pipx and use mcp-secure-schema as the command.
Starting the command appears to hang
That is normal for a stdio MCP server. It waits for an MCP client on standard input and is normally started by the IDE.
Clone the repository only when developing or testing the server:
Run the test suite:
Run the opt-in PostgreSQL integration test against a disposable database. The test creates and removes a randomly named schema:
The tests verify row-data isolation, allowlist behavior, sanitized errors, compact output, relationships, schema selection, and the locked production namespace.
Maintainers 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.
Licensed under the Apache License 2.0. See LICENSE and NOTICE.
Showcase your server listing on GitHub or your project documentation. Embed this dynamic SVG badge to highlight official listing status and live engagement.
[](https://allmcps.com/mcp/secure-schema-mcp)<a href="https://allmcps.com/mcp/secure-schema-mcp"><img src="https://allmcps.com/api/badge/secure-schema-mcp?style=directory" alt="Secure Schema MCP on AllMCPs" /></a>