io.github.nickzitzer/servicenow-nodejs

编码与调试

by happy-technologies-llc

支持多实例的 ServiceNow MCP 服务器,内置 40+ 工具,并提供智能 schema discovery 能力

什么是 io.github.nickzitzer/servicenow-nodejs

支持多实例的 ServiceNow MCP 服务器,内置 40+ 工具,并提供智能 schema discovery 能力

README

<p align="center"> <img src="https://happy-tech.biz/images/logo.svg" alt="Happy MCP Server" width="120" height="120"> </p> <h1 align="center">Happy MCP Server</h1> <p align="center"> <strong>Model Context Protocol Server for the ServiceNow&reg; Platform</strong></p> <p align="center"> A metadata-driven MCP server that auto-generates 480+ tools across 160+ tables, with multi-instance support, natural language search, and local script development. </p> <p align="center"> <a href="https://www.npmjs.com/package/happy-platform-mcp"><img src="https://img.shields.io/npm/v/happy-platform-mcp.svg?style=flat-square" alt="npm version"></a> <a href="https://opensource.org/licenses/Apache-2.0"><img src="https://img.shields.io/badge/License-Apache%202.0-blue.svg?style=flat-square" alt="License: Apache 2.0"></a> <a href="https://nodejs.org"><img src="https://img.shields.io/badge/node-%3E%3D18-brightgreen.svg?style=flat-square" alt="Node.js Version"></a> </p> <p align="center"> <a href="https://happy-tech.biz">Website</a> | <a href="https://github.com/Happy-Technologies-LLC/happy-platform-mcp">GitHub</a> | <a href="https://www.npmjs.com/package/happy-platform-mcp">npm</a> | <a href="#tool-overview">Tools</a> | <a href="CONTRIBUTING.md">Contributing</a> </p>

Migrating from servicenow-mcp-server? The npm package has been renamed to happy-platform-mcp and the Docker image to nczitzer/happy-platform-mcp. The old names are deprecated but will continue to work temporarily. Update your dependencies:

bash
# npm
npm uninstall servicenow-mcp-server && npm install happy-platform-mcp

# Docker
docker pull nczitzer/happy-platform-mcp:latest

Features

  • Multi-Instance Support — Connect to multiple ServiceNow® instances simultaneously with per-request routing
  • OAuth 2.0 & Basic Auth — Per-instance authentication with Resource Owner Password Credentials grant, automatic token refresh, and seamless fallback
  • Intelligent Schema Discovery — Automatically discovers table structures and relationships at runtime
  • 160+ Tables — Complete coverage including ITSM, CMDB, Service Catalog, Platform Development, and Flow Designer
  • 53 MCP Tools — Generic CRUD operations that work on any table, plus specialized convenience tools
  • Batch Operations — 43+ parallel operations tested successfully
  • Local Script Development — Sync scripts with Git, watch mode for continuous development
  • Natural Language Search — Query using plain English instead of encoded queries
  • MCP Resources — 8 read-only resource URIs for quick lookups and documentation
  • Background Script Execution — Automated server-side script execution via sys_trigger
  • Service Catalog AI-Submission — Browse, inspect, and submit Service Catalog forms programmatically
  • ServiceNow Docs Search — Optional GitHub-backed docs retrieval and local SQLite FTS search over official ServiceNowDocs markdown

Quick Start

Prerequisites

  • Node.js 18+
  • One or more ServiceNow® instances with REST API access
  • Valid credentials for each instance

Install from npm

bash
npx happy-platform-mcp

Or install globally:

bash
npm install -g happy-platform-mcp

Install from Source

bash
git clone https://github.com/Happy-Technologies-LLC/happy-platform-mcp.git
cd happy-platform-mcp
npm install

Configure Instances

Option A: Multi-Instance (Recommended)

bash
cp config/servicenow-instances.json.example config/servicenow-instances.json

Edit config/servicenow-instances.json:

json
{
  "instances": [
    {
      "name": "dev",
      "url": "https://dev123456.service-now.com",
      "username": "admin",
      "password": "your-password",
      "default": true
    },
    {
      "name": "prod",
      "url": "https://prod789012.service-now.com",
      "authType": "oauth",
      "grantType": "client_credentials",
      "clientId": "your-oauth-client-id",
      "clientSecret": "your-oauth-client-secret"
    }
  ]
}

Each instance can use "authType": "basic" (default) or "authType": "oauth". OAuth instances require clientId and clientSecret from your ServiceNow OAuth Application Registry. See Authentication for details.

Option B: Single Instance (via Environment)

bash
cp .env.example .env
# Edit .env with your credentials

Start the Server

bash
# HTTP/SSE transport
npm run dev

# Stdio transport (for Claude Desktop)
npm run stdio

Verify

bash
curl http://localhost:3000/health
curl http://localhost:3000/instances

Multi-Instance Routing

All tools accept an optional instance parameter:

javascript
// Uses default instance
SN-List-Incidents({ "limit": 10 })

// Routes to a specific instance
SN-List-Incidents({ "instance": "prod", "limit": 10 })

Tool Overview

CategoryToolsDescription
Generic CRUD7Query, Create, Get, Update on any table
Specialized ITSM8Incident, Change, Problem convenience wrappers
Convenience10Add-Comment, Add-Work-Notes, Assign, Resolve, Close
Natural Language1Query using plain English
Update Sets6Set, list, move, clone, inspect update sets
Scripts2Execute background scripts, create fix scripts
Script Sync3Sync scripts with local files, watch mode
Workflows4Create workflows, activities, transitions
Batch2Batch create/update across tables
Schema3Table schemas, field info, relationships
Service Catalog4Browse, inspect, and submit catalog forms
ServiceNow Docs5Discover, sync, search, and retrieve official ServiceNowDocs markdown
Resources8Read-only URIs for table lists, field info

Examples

javascript
// Query with filtering
SN-Query-Table({ "table_name": "incident", "query": "active=true^priority=1", "limit": 10 })

// Create a record
SN-Create-Incident({ "short_description": "Email service down", "urgency": 1 })

// Natural language search
SN-NL-Search({ "table_name": "incident", "query": "high priority incidents assigned to me" })

// Background script execution (automated via sys_trigger)
SN-Execute-Background-Script({ "script": "gs.info('Hello');" })

// Update set management
SN-Set-Update-Set({ "update_set_sys_id": "abc123..." })

// Batch operations
SN-Batch-Update({ "updates": [{ "table": "incident", "sys_id": "id1", "data": {...} }] })

// Service Catalog AI-submission workflow
SN-Catalog-Search-Items({ "keyword": "VPN access" })
SN-Catalog-Get-Item({ "sys_id": "<catalog_item_sys_id>" })
SN-Catalog-Submit({ "sys_id": "<catalog_item_sys_id>", "variables": { "requested_for": "jsmith", "justification": "Project X" } })

// ServiceNow Docs local search workflow
SN-Docs-Families({})
SN-Docs-Sync({ "family": "australia" })
SN-Docs-Search({ "query": "create a Flow Designer action", "family": "australia" })

Local Script Development

Develop scripts locally with version control and automatic sync:

javascript
// Download script to local file
SN-Sync-Script-To-Local({
  "script_sys_id": "abc123...",
  "local_path": "/scripts/business_rules/validate_incident.js"
})

// Watch for changes and auto-sync
SN-Watch-Script({
  "local_path": "/scripts/business_rules/validate_incident.js",
  "script_sys_id": "abc123..."
})

Natural Language Search

javascript
SN-NL-Search({
  "table_name": "incident",
  "query": "active high priority incidents that are unassigned"
})

Supports 15+ patterns including field comparisons, text searches, date ranges, logical operators, and ordering.

ServiceNow Docs Search

Happy MCP can retrieve official ServiceNowDocs markdown directly from GitHub and optionally localize a docs family into a SQLite FTS5 index for fast local search. Local indexing is disabled by default; enable it with docs.localIndexEnabled=true in config/servicenow-instances.json or HAPPY_DOCS_ENABLE_LOCAL_INDEX=true.

javascript
SN-Docs-Families({})
SN-Docs-Status({})
SN-Docs-Sync({ "family": "australia" })
SN-Docs-Search({ "query": "update set best practices", "family": "australia", "limit": 5 })
SN-Docs-Get({ "family": "australia", "path": "platform/example.md" })

SQLite local indexing is optional and disabled by default. Vector search is also optional; enable local indexing, set HAPPY_DOCS_ENABLE_VECTOR=true, and use HAPPY_DOCS_EMBEDDING_PROVIDER=local to build a sqlite-vec index with deterministic local embeddings. See ServiceNow Docs Search.

For docs-only deployments without ServiceNow credentials, set HAPPY_MCP_DOCS_ONLY=true. If no config file or ServiceNow environment credentials are present, the stdio server falls back to docs-only mode automatically.

Claude Desktop Integration

Add to ~/Library/Application Support/Claude/claude_desktop_config.json:

Basic Auth:

json
{
  "mcpServers": {
    "happy-mcp-server": {
      "command": "npx",
      "args": ["-y", "happy-platform-mcp"],
      "env": {
        "SERVICENOW_INSTANCE_URL": "https://your-instance.service-now.com",
        "SERVICENOW_USERNAME": "your-username",
        "SERVICENOW_PASSWORD": "your-password"
      }
    }
  }
}

OAuth:

json
{
  "mcpServers": {
    "happy-mcp-server": {
      "command": "npx",
      "args": ["-y", "happy-platform-mcp"],
      "env": {
        "SERVICENOW_INSTANCE_URL": "https://your-instance.service-now.com",
        "SERVICENOW_USERNAME": "your-username",
        "SERVICENOW_PASSWORD": "your-password",
        "SERVICENOW_AUTH_TYPE": "oauth",
        "SERVICENOW_CLIENT_ID": "your-client-id",
        "SERVICENOW_CLIENT_SECRET": "your-client-secret"
      }
    }
  }
}

Or if installed from source, use "command": "node" with "args": ["/path/to/happy-platform-mcp/src/stdio-server.js"] and "cwd": "/path/to/happy-platform-mcp".

For multi-instance configurations, use config/servicenow-instances.json instead of environment variables. See Configure Instances.

Restart Claude Desktop after editing the config.

Authentication

Happy MCP Server supports two authentication methods per instance. Both can coexist — instance A can use basic auth while instance B uses OAuth.

Basic Auth (Default)

No extra configuration needed. Provide username and password:

json
{
  "name": "dev",
  "url": "https://dev123456.service-now.com",
  "username": "admin",
  "password": "your-password",
  "default": true
}

OAuth 2.0

Supports both Client Credentials (recommended) and Resource Owner Password Credentials grant types. Tokens are automatically requested, cached, and refreshed.

Client Credentials (recommended) — no user credentials needed, ideal for service-to-service integrations and federated identity environments:

json
{
  "name": "prod",
  "url": "https://prod789012.service-now.com",
  "authType": "oauth",
  "grantType": "client_credentials",
  "clientId": "your-oauth-client-id",
  "clientSecret": "your-oauth-client-secret"
}

Resource Owner Password Credentials — for cases where user context is required:

json
{
  "name": "staging",
  "url": "https://staging.service-now.com",
  "authType": "oauth",
  "grantType": "password",
  "clientId": "your-oauth-client-id",
  "clientSecret": "your-oauth-client-secret",
  "username": "integration_user",
  "password": "your-password"
}

If grantType is omitted, it defaults to client_credentials when no username is provided, or password when username is present.

ServiceNow setup:

  1. Navigate to System OAuth > Application Registry
  2. Click New and select Create an OAuth API endpoint for external clients
  3. Set a name (e.g., "MCP Server") and note the generated Client ID and Client Secret
  4. Add those values to your instance configuration

How it works:

  • On first API call, requests an access token from /oauth_token.do
  • Caches the token and automatically refreshes it before expiry (30-second buffer)
  • On 401 responses, transparently refreshes the token and retries the request once
  • Falls back to a fresh token grant if the refresh token is expired

The scope field is optional and defaults to ServiceNow's standard scope.

Architecture

code
src/
├── server.js                     # Express HTTP server (SSE transport)
├── stdio-server.js               # Stdio transport (Claude Desktop)
├── mcp-server-consolidated.js    # MCP tool registration & routing
├── servicenow-client.js          # REST API client
└── config-manager.js             # Multi-instance configuration

config/
└── servicenow-instances.json     # Instance configuration

docs/
├── API_REFERENCE.md              # Complete tool reference
├── SETUP_GUIDE.md                # Detailed setup instructions
└── research/                     # Technical research & discoveries

Testing

bash
# Run tests
npm test

# Watch mode
npm run test:watch

# Coverage
npm run test:coverage

# MCP Inspector
npm run inspector

Troubleshooting

Connection Issues

bash
# Test connectivity to your ServiceNow instance
curl -u username:password https://your-instance.service-now.com/api/now/table/incident?sysparm_limit=1

# Check server health
curl http://localhost:3000/health

Common Problems

  • Multi-instance not working: Verify config/servicenow-instances.json is valid JSON with one "default": true instance. Restart after changes.
  • Tools not appearing: Check MCP Inspector connection and server logs.
  • Auth failures: Test credentials in browser first. Ensure the user has required roles.
  • SSE disconnects in Docker: Enable keepalive (default 15s). See docs/SSE_SETUP_GUIDE.md.

Debug Mode

bash
DEBUG=true npm run dev

Known Limitations

  • Flow Designer logic blocks cannot be created via REST API (use the UI)
  • Flow compilation/validation must be done in the UI
  • UI Policy Actions linking requires a background script workaround

See docs/MCP_Tool_Limitations.md for details.

Acknowledgments

This project was inspired by the Echelon AI Labs ServiceNow MCP Server. We are grateful for their pioneering work in bringing MCP capabilities to the ServiceNow® platform.

Contributing

See CONTRIBUTING.md for guidelines. All contributors must sign a CLA.

Security

To report a vulnerability, see SECURITY.md. Do not open public issues for security concerns.

License

Licensed under the Apache License 2.0.

Copyright 2025 Happy Technologies LLC


Trademark Notice

ServiceNow® is a registered trademark of ServiceNow, Inc. "Now" is a registered trademark of ServiceNow, Inc. All ServiceNow® product names, logos, and brands are property of ServiceNow, Inc.

Model Context Protocol (MCP) is an open standard created by Anthropic, PBC. "Claude" is a trademark of Anthropic, PBC.

Happy MCP Server is an independent, community-driven project. It is not affiliated with, endorsed by, or sponsored by ServiceNow, Inc. or Anthropic, PBC. This project provides tooling that connects to ServiceNow® instances via their published REST APIs, and implements the open MCP specification. It is not a competitor to any ServiceNow® product or service.

All other trademarks are the property of their respective owners. See NOTICE for full attribution.

常见问题

io.github.nickzitzer/servicenow-nodejs 是什么?

支持多实例的 ServiceNow MCP 服务器,内置 40+ 工具,并提供智能 schema discovery 能力

相关 Skills

前端设计

by anthropics

Universal
热门

面向组件、页面、海报和 Web 应用开发,按鲜明视觉方向生成可直接落地的前端代码与高质感 UI,适合做 landing page、Dashboard 或美化现有界面,避开千篇一律的 AI 审美。

想把页面做得既能上线又有设计感,就用前端设计:组件到整站都能产出,难得的是能避开千篇一律的 AI 味。

编码与调试
未扫描152.6k

网页应用测试

by anthropics

Universal
热门

用 Playwright 为本地 Web 应用编写自动化测试,支持启动开发服务器、校验前端交互、排查 UI 异常、抓取截图与浏览器日志,适合调试动态页面和回归验证。

借助 Playwright 一站式验证本地 Web 应用前端功能,调 UI 时还能同步查看日志和截图,定位问题更快。

编码与调试
未扫描152.6k

网页构建器

by anthropics

Universal
热门

面向复杂 claude.ai HTML artifact 开发,快速初始化 React + Tailwind CSS + shadcn/ui 项目并打包为单文件 HTML,适合需要状态管理、路由或多组件交互的页面。

在 claude.ai 里做复杂网页 Artifact 很省心,多组件、状态和路由都能顺手搭起来,React、Tailwind 与 shadcn/ui 组合效率高、成品也更精致。

编码与调试
未扫描152.6k

相关 MCP Server

GitHub

编辑精选

by GitHub

热门

GitHub 是 MCP 官方参考服务器,让 Claude 直接读写你的代码仓库和 Issues。

这个参考服务器解决了开发者想让 AI 安全访问 GitHub 数据的问题,适合需要自动化代码审查或 Issue 管理的团队。但注意它只是参考实现,生产环境得自己加固安全。

编码与调试
87.4k

by Context7

热门

Context7 是实时拉取最新文档和代码示例的智能助手,让你告别过时资料。

它能解决开发者查找文档时信息滞后的问题,特别适合快速上手新库或跟进更新。不过,依赖外部源可能导致偶尔的数据延迟,建议结合官方文档使用。

编码与调试
57.7k

by tldraw

热门

tldraw 是让 AI 助手直接在无限画布上绘图和协作的 MCP 服务器。

这解决了 AI 只能输出文本、无法视觉化协作的痛点——想象让 Claude 帮你画流程图或白板讨论。最适合需要快速原型设计或头脑风暴的开发者。不过,目前它只是个基础连接器,你得自己搭建画布应用才能发挥全部潜力。

编码与调试
48.0k

评论