GTech-Context-MCP-Server
A static, read-only MCP server that exposes a database knowledge base (schema, relationships, workflows, and reasoning patterns) so Claude Code / Copilot can reason about a database without a live connection.
README
db-kb-mcp-server
A static, read-only MCP server that exposes a database knowledge base (schema, relationships, workflows, and reasoning patterns) so Claude Code / Copilot can reason about a database it has no live connection to.
No DB connection required — the schema is assumed stable, and all content lives in kb/ as Markdown files.
Folder structure
kb/
schema/ one file per table — columns, types, PK/FK, business meaning
relationships/ FK-enforced and logical (non-enforced) relationships, grouped by subsystem
workflows/ one file per customizable workflow — intents, tables touched, invariants
patterns/ reusable reasoning recipes (e.g. reordering ordinal columns)
glossary/ domain term definitions
server/
src/ MCP server implementation (Node + TypeScript, @modelcontextprotocol/sdk)
Tools exposed
| Tool | Purpose |
|---|---|
get_context |
Call this first, once per session. Returns hard rules, doc inventory, and what to call next. |
get_context_for_query |
Preferred per-query context bundle: given the user's request, returns relevant tables + required docs (schema/workflow/relationships/patterns/glossary) and execution order in one response. |
resolve_tables_for_query |
Call this second, with the user's request verbatim. Fans out across workflows/patterns/relationships/schema and returns a ranked, reasoned list of which tables are actually relevant, plus matching docs and concrete next steps — this is what lets an agent go from "user asked X" to "these are the tables to work on" without guessing table names from general domain knowledge. |
list_kb_docs |
List all docs, optionally filtered by category |
get_table_schema |
Full schema doc for a table |
get_relationships |
FK + logical relationships, optionally filtered to a table |
get_workflow |
Workflow doc: intents, tables touched, invariants |
get_reasoning_pattern |
Reasoning recipe (e.g. reordering, choosing-column-values) |
search_kb |
Full-text search across all docs |
get_glossary_term |
Domain term lookup |
Every doc is also exposed as an MCP resource (kb://<category>/<id>).
Running locally (stdio — simplest, per-user)
npm install
npm run build
By default, the server auto-loads kb/ from the repository root (resolved relative to server/dist/index.js, not the shell's current working directory). Override with KB_ROOT only when you want to point to another KB folder.
Then add to Claude Code:
claude mcp add db-kb -- node D:/Tasks/GTech_MCPServer/server/dist/index.js
Or set KB_ROOT to point at a KB folder elsewhere:
KB_ROOT=/path/to/kb node server/dist/index.js
Integration checklist (what users need on their machine)
Local stdio integration
Required on each user machine:
- Node.js 18+ (recommended current LTS)
- A local copy of:
server/dist/index.js(or full repo + build output)kb/folder (the knowledge base content)
Typical MCP config (example .mcp.json snippet):
{
"mcpServers": {
"db-kb": {
"command": "node",
"args": ["D:\\Tasks\\GTech_MCPServer\\server\\dist\\index.js"]
}
}
}
Optional when kb/ lives elsewhere:
{
"mcpServers": {
"db-kb": {
"command": "node",
"args": ["D:\\Tasks\\GTech_MCPServer\\server\\dist\\index.js"],
"env": {
"KB_ROOT": "D:\\MyKb"
}
}
}
}
Hosted HTTP integration
Required on user machine:
- Only the MCP server URL (no local
kb/copy needed)
Client should use:
- transport:
http - URL:
https://<host>:<port>/mcp(include/mcp)
Running as a hosted server (HTTP — pluggable via URL for everyone)
MCP_TRANSPORT=http PORT=8787 npm start
Deploy this anywhere (small VM, container, internal server). Then each teammate adds the URL once:
claude mcp add --transport http db-kb https://your-host:8787/mcp
No cloning, no file sync — everyone always gets the current KB content.
The HTTP server keeps one McpServer/transport pair per MCP session (keyed by the mcp-session-id the SDK assigns on initialize), not per HTTP request — sessions span many requests, so a naive "new server per request" implementation breaks the handshake (tools/call fails with "Server not initialized" on the very next request). Verified end-to-end with a manual initialize → notifications/initialized → tools/call sequence over curl.
Updating the knowledge base
- Edit/add Markdown files under
kb/. - If running the hosted HTTP variant, redeploy/restart the server — it loads
kb/once at startup (schema is assumed static; restart to pick up doc changes). - Use
kb/schema/_TEMPLATE.mdas the starting point for new tables.
Live read-only SQL access (Oracle SQLcl MCP Server)
Alongside the static KB server, this project bundles Oracle's official SQLcl (v26.2, downloaded to tools/sqlcl/) running in MCP mode — for verifying live schema/data against the actual Oracle instance. This is a separate, more sensitive server from db-kb: it needs real DB credentials and should not be shared as broadly as the KB server.
One-time setup (per machine, not committed to the repo)
- Save a connection using SQLcl's own encrypted connection store. Run
-nologfirst, then type theconnectcommand at the interactive prompt (or pipe it via stdin) — passingconnect ...as command-line arguments gets misparsed as a script filename. Also pass-thin— on Windows, SQLcl defaults to OCI/thick mode and fails withno ocijdbc23 in java.library.pathunless a full Oracle Instant Client is on the path; thin mode needs no native client at all:
Credentials are stored locally undertools/sqlcl/bin/sql -thin -nolog SQL> connect -save mydb -savepwd myuser/mypassword@myhost:1521/myservice~/.dbtools(SQLcl's own encrypted store) — never commit this directory or put credentials in.mcp.json. - Use a read-only DB account for
myuser— grant onlySELECTon the relevant schemas. This is the real enforcement boundary; SQLcl's own restrict levels are a second layer, not a substitute for DB-level permissions. - Verify the saved connection actually works:
connect -name mydbthenselect 1 from dual;.
Already wired into .mcp.json
"oracle-sqlcl": { "command": "tools/sqlcl/bin/sql", "args": ["-thin", "-mcp"] }
MCP mode defaults to restrict level 4 (most restrictive) unless overridden with -R. It exposes 5 core tools: list-connections, connect, disconnect, run-sql, run-sqlcl. The connect tool only accepts a saved connection name (from step 1 above) — it never accepts raw credentials over MCP, so nothing sensitive passes through the AI session itself.
Auditing
Every session is logged: V$SESSION.MODULE records the MCP client, V$SESSION.ACTION records the calling LLM, and SQLcl creates a DBTOOLS$MCP_LOG table recording every interaction/SQL statement executed — useful for reviewing what was actually run against the live DB.
Division of responsibility with the KB server
db-kb(this repo'sserver/) — static schema/workflow knowledge, safe to share broadly, no DB connection.oracle-sqlcl— live queries against the real instance, needs a read-only DB account, keep access scoped to people authorized to query production/test data.
Adding a new workflow doc
Copy the structure in kb/workflows/approval-chain-workflow.md:
- List common user intents mapped to concrete table/column changes.
- List invariants that must hold after any change.
- Link to relevant schema docs and reasoning patterns with
[[slug]](informal — for human navigation; the tools don't resolve these automatically yet).
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。