servicenow-docs
MCP server for searching and reading ServiceNow documentation from a local clone, enabling keyword/regex queries and full doc retrieval without external APIs.
README
servicenow-docs-mcp
MCP server that searches a local clone of ServiceNow/ServiceNowDocs via two tools:
search_docs(query, max_results?)— keyword/regex search across all docs, returns file + line + snippet.read_doc(path)— reads the full content of a doc by the relative path returned fromsearch_docs.
No vector DB, no API keys. Search runs against a flat pre-built text index using grep, so it works fully offline.
See ARCHITECTURE.md for how it works, why grep over a vector DB, measured benchmarks, and known limitations.
Prerequisites
- Node.js 18+
grep(preinstalled on macOS/Linux)- A local clone of the docs repo
Setup
# 1. Clone the docs repo, as a sibling of this project's parent dir
# (default DOCS_ROOT expects ../ServiceNowDocs/markdown relative to this folder)
git clone --depth 1 https://github.com/ServiceNow/ServiceNowDocs.git
# 2. Install dependencies
cd servicenow-docs-mcp
npm install
# 3. Build the search index (one-time; re-run after pulling doc updates)
node build-index.mjs
Directory layout expected:
ServiceNowKB/
├── ServiceNowDocs/ # cloned docs repo
│ └── markdown/ # DOCS_ROOT
└── servicenow-docs-mcp/ # this project
├── index.js
├── build-index.mjs
└── index.txt # generated by build-index.mjs
To point at docs cloned elsewhere, set DOCS_ROOT when running the server or the index builder:
DOCS_ROOT=/path/to/ServiceNowDocs/markdown node build-index.mjs
Why the index build step
search_docs doesn't grep the 49k individual markdown files directly — walking that many small files takes minutes. build-index.mjs flattens every file into one index.txt (path:line:content per line), so a query becomes a single-file grep (~1-5s). Rebuild it whenever the docs repo is updated:
cd ServiceNowDocs && git pull
cd ../servicenow-docs-mcp && node build-index.mjs
Register with a Claude environment
Claude Code (any project)
Add to that project's .mcp.json (create it if missing) — path is relative to wherever you run Claude Code, adjust as needed:
{
"mcpServers": {
"servicenow-docs": {
"command": "node",
"args": ["/absolute/path/to/servicenow-docs-mcp/index.js"]
}
}
}
Restart the Claude Code session in that directory to load it — MCP servers are only picked up at session start.
Claude Desktop
Edit ~/Library/Application Support/Claude/claude_desktop_config.json (macOS) or %APPDATA%\Claude\claude_desktop_config.json (Windows):
{
"mcpServers": {
"servicenow-docs": {
"command": "node",
"args": ["/absolute/path/to/servicenow-docs-mcp/index.js"]
}
}
}
Restart Claude Desktop to load it.
Usage
Once loaded, just ask questions naturally — Claude calls search_docs / read_doc on its own. Example:
"Is there a system property to debug OAuth issues?"
To search directly yourself, call the tool with a keyword or grep-style regex:
search_docs(query: "oauth.*debug", max_results: 15)
Regex special characters are passed through to grep -i, so patterns like glide\.oauth\..* work.
Token usage per query
Measured directly from index.txt (per-file content size, single pass over all 48,975 indexed files — not sampled), converted at ~4 characters/token.
File size distribution (this corpus):
| Percentile | Size | Approx tokens |
|---|---|---|
| min | 348 B | ~90 |
| median | 3.3 KB | ~825 |
| average | 5.4 KB | ~1,360 |
| p90 | 8.9 KB | ~2,215 |
| p99 | 31.4 KB | ~7,850 |
| max (outlier) | 2.2 MB | ~557,000 |
Per-call cost:
| Call | What's returned | Approx tokens |
|---|---|---|
search_docs, small (5 results) |
5× {file, line, snippet≤300 chars} JSON |
~500 |
search_docs, default (20 results) |
20× same | ~1,900 |
search_docs, max (50 results) |
50× same | ~4,800 |
read_doc, median file (3.3 KB) |
full markdown file | ~825 |
read_doc, p90 file (8.9 KB) |
full markdown file | ~2,215 |
read_doc, p99 file (31 KB) |
full markdown file | ~7,850 |
A typical question costs one search_docs call plus one or two read_doc calls — so roughly 1,500-10,000 tokens for most docs, more if it lands on a p99+ outlier page. Lower max_results or read fewer docs to cut cost; the server has no chunking/summarization, so read_doc always returns the entire file.
Response token usage with caveman mode
This session ran with the caveman skill active (terse, no filler). Measured on an actual response from this session (the "how this works / best practices" answer above) against a normal-verbosity rewrite of the same content:
| Version | Characters | Approx tokens |
|---|---|---|
| Normal mode (rewritten, same content) | 5,223 | ~1,306 |
| Caveman mode (actual) | 1,762 | ~441 |
| Savings | 66% | 66% |
Matches caveman's own documented ~65% output-token reduction. Applies to Claude's response text only — doesn't change search_docs/read_doc tool-result token cost above, which is fixed by doc size regardless of response style.
Troubleshooting
- No results for an obvious term: rebuild the index — it may predate a
git pull. Search index missingerror: runnode build-index.mjs(step 3 above).- Server doesn't appear after editing
.mcp.json/ Desktop config: restart the Claude session — config is only read at startup, not hot-reloaded.
推荐服务器
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 模型以安全和受控的方式获取实时的网络信息。