sn-mcp
Enables LLMs to securely query and optionally write to ServiceNow instances with strict allowlist/denylist safety controls.
README
sn-mcp
A Model Context Protocol server that lets an LLM talk to a ServiceNow instance — query records, and (only when you turn it on) write them — without handing the model the keys to the kingdom.
Built for a healthcare context. The bar is: a CISO can read this page and know what the model can and cannot touch.
The problem
LLMs are useful against ServiceNow. They are also one bad prompt away from reading sys_user, dumping a table, or following instructions hidden in a work note.
Most MCP wrappers solve “can the model call the API?” They skip “what happens when it tries something it shouldn’t?”
Why this exists
The day job is regulated healthcare. I needed an agent that could look at a live instance while I was building — and I would not point a raw API token at that instance.
So the product is not “nine ServiceNow tools.” The product is the safety kernel those tools cannot bypass.
How a call works
LLM
│ stdio (no network, no ports)
▼
sn-mcp
│ 1. Zod validation
│ 2. Table + field allowlist ← default deny
│ 3. Query denylist ← no identity enumeration
│ 4. HTTPS to ServiceNow (10s cap)
│ 5. Error sanitization ← LLM never sees stack traces
│ 6. PHI redaction
│ 7. Response wrapper ← retrieved data is untrusted input
│ 8. Audit log + rate limit
▼
ServiceNow
Read tools always go through that path. Write tools add one more gate: BUILDER_MODE is off unless you set it. Idle sessions cannot create, update, delete, or run scripts.
Design decisions
These are the ones a stranger needs. The rest, including what was rejected, live in DECISIONS.md.
| Decision | Choice | Why |
|---|---|---|
| Default deny | Only listed tables and fields come back | A miss is a closed door, not an open one |
| Writes are opt-in | BUILDER_MODE=true or the write tools refuse |
An idle chat cannot change the instance |
| Errors fail safe | Unknown error category = no hint to the model | Better a confused model than a leaked schema |
| PHI regex is not the primary control | Allowlist is primary; redaction is defense in depth | Regex will miss things. We say that out loud. |
| Retrieved data is untrusted | Every SN payload is wrapped and tagged | Stops a work note from becoming an instruction |
| Identity fields are denied everywhere | One SYSTEM_IDENTITY_FIELDS list, every table |
Closing caller_id and leaving sys_created_by is not a lock |
What this is not: a production connector for a hospital instance. It is built and tested against a developer instance, with Basic auth. OAuth is the gating requirement before it ever sees real PHI.
What it can do
Always on (still subject to the kernel):
| Tool | Purpose |
|---|---|
query_table |
Query an allowlisted table |
get_record |
Fetch one record by sys_id |
search_kb |
Search published knowledge articles |
count_table |
Return a count — no rows cross the boundary |
health_check |
Is ServiceNow up, and can we write the audit log? |
Off until you opt in:
| Tool | Purpose |
|---|---|
create_record / update_record / delete_record |
Write to the instance |
execute_script |
Run server-side JavaScript. Treat it as admin. |
Default allowlist: incident, change_request, problem, sc_request, sc_task, kb_knowledge, alm_hardware, wm_order. Clinical tables, users, scripts, attachments, and email are denied by name.
Run it
git clone https://github.com/dadshorts/sn-mcp.git
cd sn-mcp
npm install
cp .env.example .env # set SN_INSTANCE, SN_USERNAME, SN_PASSWORD
npm test # regression suite against the safety kernel
node src/index.mjs # listens on stdio
Point your MCP client at node src/index.mjs. Credentials stay in .env (gitignored). Leave BUILDER_MODE unset unless you are sitting down to write.
What's verified
- Safety kernel + write gate exercised on a live developer instance
- Regression suite for allowlist, denylist, wrapping, PHI false-positives, and builder-mode refusals
- Audit log written for every tool call, including refusals
- Months of local operation while building ServiceNow work
This repo is the server. It does not include instance credentials, audit logs, or production data.
推荐服务器
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 模型以安全和受控的方式获取实时的网络信息。