CoreMCP
以下摘录自该仓库的 README(片段) · 在 GitHub 读完整 README →
A Model Context Protocol (MCP) server, written in Go, that exposes SQL databases as MCP tools and prompts. It runs as a single static binary, embeds its drivers, and talks either stdio (for local MCP clients like Claude Desktop) or an outbound WebSocket (for remote operation behind NAT).
Currently ships with MSSQL (SQL Server 2000+, Turkish_CI_AS collation aware) and PostgreSQL adapters. Firebird is in progress; MySQL is on the roadmap.
Status
- **Stable:** MSSQL adapter, PostgreSQL adapter, stdio transport, schema discovery, custom tools, NOLOCK / Turkish normalization middleware, WebSocket connect mode.
- **In progress:** Firebird adapter (factory currently returns a placeholder error).
- **Roadmap:** MySQL, HTTP transport, audit log, query result cache.
Defaults
CoreMCP is read-only by default. Omitting readonly in a source config leaves SELECT-only mode active; you have to set readonly: false to enable execute_procedure. Even so, the recommended posture is a dedicated DB user with SELECT (and EXECUTE only on the procedures you intend to expose) — defense in depth rather than relying solely on the server-side guard.
Install
Binary
Download from the Releases page — linux/amd64, linux/arm64, darwin/{amd64,arm64}, windows/amd64.
One-line installer (Linux/macOS):
Docker
Multi-arch image (linux/amd64, linux/arm64).
From source
Requires Go 1.23+.
Configuration
coremcp.yaml in the working directory:
See coremcp.example.yaml for a fuller example.
DSN format
MSSQL:
PostgreSQL:
Dummy adapter (for testing without a real DB):
Source options
| Option | Type | Default | Description |
|--------|------|---------|-------------|
| name | string | — | Unique source identifier |
| type | string | — | Adapter type: mssql, postgres (or postgresql), rest, graphql, dummy |
| dsn | string | — | Connection string |
| readonly | bool | true | SELECT-only at the config level. Set false explicitly to allow execute_procedure. |
| no_lock | bool | false | **(MSSQL only)** Run SELECTs under READ UNCOMMITTED. Equivalent to WITH (NOLOCK) on every table reference. Eliminates shared lock acquisition on busy OLTP. **Trade-off:** dirty reads possible. |
| normalize_turkish | bool | false | **(MSSQL only)** Two-way middleware. Outgoing: Turkish characters inside SQL string literals are folded to ASCII uppercase before the query is sent ('Hüseyin' → 'HUSEYIN'). Incoming: Windows-1254 / Windows-1252 mojibake in result strings is auto-corrected. Intended for legacy Turkish ERP databases on Turkish_CI_AS. |
Example: MSSQL with NOLOCK
Example: legacy Turkish ERP
How the Turkish middleware behaves:
| Model emits | Sent to DB | Why |
|-------------|------------|-----|
| WHERE ADI = 'Hüseyin' | WHERE ADI = 'HUSEYIN' | ERP stores names as uppercase ASCII |
| WHERE SEHIR LIKE '%şeker%' | WHERE SEHIR LIKE '%SEKER%' | Ş → S |
| WHERE SEHIR = 'İstanbul' | WHERE SEHIR = 'ISTANBUL' | İ → I |
Mojibake correction on inbound rows:
| DB returns | Fixed | Cause |
|------------|-------|-------|
| GÐKHAN | GĞKHAN | Win-1254 byte 0xD0 read as Win-1252 |
| ÝSTANBUL | İSTANBUL | Win-1254 byte 0xDD read as Win-1252 |
| ÞEHİR | ŞEHİR | Win-1254 byte 0xDE read as Win-1252 |
Security configuration
What this enables:
- **T-SQL aware lexer.** Fail-closed custom tokeniser strips comments and string literals, then classifies the statement — only SELECT and WITH pass. DROP, ALTER, UPDATE, DELETE, TRUNCATE, EXEC, OPENROWSET, SELECT…INTO and similar are rejected before reaching the DB. Multi-statement payloads (any ; outside strings/comments) are fatal — stacked-query attacks blocked dialect-independently. Chosen over third-party Go SQL parsers (xwb1989/sqlparser, vitess, cockroachdb) because they fail-closed on T-SQL hints and any "fall through to regex" relaxation is bypassable via EX/**/EC and similar tricks. Treat as one layer, not the only layer — pair with a least-privilege DB role.