SchemaCrawler MCP Server: SQL, Column Prefix Analysis
Analyze relational databases with the MCP server to generate valid SQL and probe column prefixes to uncover schema meaning and context.
npx -y @schemacrawler/SchemaCrawler-MCP-Server-UsageOverview
SchemaCrawler MCP Server is a small HTTP service that integrates the Model Context Protocol (MCP) with relational schema inspection. It helps developers and data engineers automatically produce syntactically correct SQL for a target database and probe column-name prefixes (or abbreviations) to infer meaning and context. The server is particularly useful when working with legacy schemas, data catalogs, or when automating query generation for web-scraping, analytics, or migration tasks.
By combining introspection of the live database schema with lightweight ML-driven contextual prompts, the MCP server reduces guesswork: it can generate queries that match the target SQL dialect and discover likely expansions for cryptic column prefixes (for example, turning cust_id into customer_id). This saves time during ETL development, reverse engineering, and when onboarding new engineers to unfamiliar databases.
Features
- Automatic SQL generation tailored to the database dialect
- Column prefix analysis to infer semantic expansions of abbreviations
- Database schema-aware: inspects tables, columns, types, and constraints
- HTTP API for easy integration with tools, scrapers, and automation scripts
- Configurable connection settings and authentication
- Lightweight deployment: run locally, in containers, or as part of CI
Installation / Configuration
Clone the repository and build, or use the provided Docker image. Replace environment values with your own connection credentials.
Clone and build (Maven or Gradle):
# Build with Maven
# or with Gradle
Run with Java (assuming target JAR produced):
Docker example:
Common configuration variables:
- DB_URL / db.url — JDBC connection string
- DB_USER / db.user — database username
- DB_PASSWORD / db.password — database password
- SERVER_PORT / server.port — HTTP port
- LOG_LEVEL / log.level — debug/info/warn
If you compile locally, the actual CLI flags may differ; check the repository README or bundled docs for exact options.
Available Tools / Resources
- HTTP API (endpoints examples below)
- Schema introspection via SchemaCrawler integration (table/column metadata)
- Simple JSON request/response model for integration with scraping or orchestration processes
- GitHub repository and issues tracker: https://github.com/schemacrawler/SchemaCrawler-MCP-Server-Usage
API Endpoint quick reference
| Endpoint | Purpose |
|---|---|
| POST /sql | Generate valid SQL for the target DB given a prompt or context |
| POST /column-prefix | Probe and score possible expansions for a column prefix |
Note: Exact endpoint paths may be confirmed in the deployed server’s OpenAPI spec or project README.
Example API Usage
Generate SQL for a table (curl):
Possible simplified response:
Probe column prefix analysis:
Possible simplified response:
Use Cases
- Reverse engineering: Quickly generate queries to sample data from unfamiliar schemas and establish column semantics before building ETL jobs.
- Data catalog enrichment: Automatically suggest human-friendly expansions for short or encoded column names to improve documentation.
- Web scraping + enrichment: Combine scraped data with schema-aware queries to validate or augment records using authoritative DB fields.
- Migrations and refactoring: Generate migration queries in the correct dialect and identify columns whose prefixes should be expanded or standardized.
- Onboarding: Provide new developers with runnable example queries and inferred column meanings to shorten ramp-up time.
Tips for Developers
- Always run generation against a representative schema snapshot (dev or staging) rather than production when iterating.
- Use the column-prefix endpoint to seed renaming or mapping tables before running wide-scale migrations.
- Combine the API with your CI pipelines to enforce schema naming conventions and produce documentation artifacts automatically.
For exact API schemas, build flags, and advanced usage, consult the project repository on GitHub: https://github.com/schemacrawler/SchemaCrawler-MCP-Server-Usage