servicenow-mcp
servicenow-mcp
一个通过 Table API 管理 ServiceNow 事件的 MCP 服务器。提供了创建、读取、更新、搜索、评论和解决事件的工具。
设置
安装依赖:
uv sync将
.env.example复制为.env并填写您的凭据:cp .env.example .envSERVICENOW_INSTANCE:仅实例名称(例如dev12345对应于dev12345.service-now.com)SERVICENOW_USERNAME/SERVICENOW_PASSWORD:拥有对incident表(通过 Table API 进行读写访问权限)的用户的 basic auth 凭据
直接运行服务器以快速检查其是否能正常启动:
uv run servicenow-mcp
Related MCP server: servicenow-api
与 Claude Desktop / Claude Code 一起使用
有两种连接方式,具体取决于您是希望所有使用该服务器的用户共享一个 ServiceNow 服务账户,还是每个人都使用自己的身份进行身份验证。完整说明请参见下面的身份验证。
选项 A — stdio,共享服务账户
客户端将服务器本身作为子进程启动;每次工具调用都使用通过 env 传入的 SERVICENOW_USERNAME / SERVICENOW_PASSWORD。
{
"mcpServers": {
"servicenow": {
"command": "uv",
"args": ["--directory", "/absolute/path/to/servicenow-mcp", "run", "servicenow-mcp"],
"env": {
"SERVICENOW_INSTANCE": "your-instance",
"SERVICENOW_USERNAME": "your-username",
"SERVICENOW_PASSWORD": "your-password"
}
}
}
}选项 B — HTTP,每个客户端凭据
将服务器启动一次作为长时间运行的 HTTP 进程(它只需要 SERVICENOW_INSTANCE,加上 SERVICENOW_USERNAME/PASSWORD 作为没有认证头请求的回退):
uv run servicenow-mcp --transport streamable-http --host 127.0.0.1 --port 8003然后将 .mcp.json 指向它,并发送您自己的 ServiceNow 登录信息作为 HTTP Basic Auth 头——这使连接成为“客户端级别”:凭据存在于您的客户端配置中,而不是服务器中:
{
"mcpServers": {
"servicenow": {
"type": "http",
"url": "http://127.0.0.1:8003/mcp",
"headers": {
"Authorization": "Basic <base64 of your-username:your-password>"
}
}
}
}在终端中生成 base64 值(注意前导空格,这是 echo 的 -n 选项避免的):
echo -n "your-username:your-password" | base64.mcp.json 不像 .env 那样受 .gitignore 覆盖——如果此目录将来成为共享/git 仓库,不要将真实凭据提交到其中。
工具
create_incident— 创建新事件get_incident— 按编号(例如INC0010023)或 sys_id 获取update_incident— 更新任意字段search_incidents— 使用 ServiceNow 编码查询(sysparm_query)进行搜索add_comment— 添加客户可见评论或内部工作备注resolve_incident— 将状态设置为已解决,并附带关闭备注/代码
身份验证
身份验证是 basic auth(用户名/密码)。这些凭据的来源取决于传输方式:
stdio:始终使用来自
.env的共享SERVICENOW_USERNAME/SERVICENOW_PASSWORD。HTTP(
sse/streamable-http):每个请求可以通过发送标准 HTTP Basic Auth 头使用其自己的 ServiceNow 用户进行身份验证:Authorization: Basic base64(username:password)SERVICENOW_INSTANCE保留在服务器端(对所有客户端来说是一个实例),但用户名/密码是每个客户端的——因此search_incidents结果、caller_id解析等会反映该个别用户的 ServiceNow 权限,而不是一个共享服务账户。如果请求没有Authorization头,它将回退到来自.env的共享SERVICENOW_USERNAME/SERVICENOW_PASSWORD。
如果您以后需要 OAuth 2.0,请将 src/servicenow_mcp/client.py 中的 requests.Session.auth 设置替换为基于令牌的流程——客户端的其余部分与认证无关。
备注
事件表的
state字段是数字(例如6= 已解决,7= 已关闭);如果您的实例自定义了事件状态,值可能不同。
Available Tools
6 toolsadd_commentA
Add a customer-visible comment or an internal work note to an incident.
Args: number_or_sys_id: Incident number or sys_id. comment: Text to add. work_note: If True, adds as an internal work note instead of a customer-visible comment.
| Name | Required | Description | Default |
|---|---|---|---|
| comment | Yes | ||
| work_note | No | ||
| number_or_sys_id | Yes |
Output Schema
| Name | Required | Description |
|---|---|---|
No output parameters | ||
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
The description clearly states the tool mutates an incident by adding text, and distinguishes visibility based on the work_note flag. With no annotations provided, this description carries the full burden and does an adequate job, though it doesn't mention authentication requirements or that the tool assumes an existing incident.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is brief and structured with a docstring-style Args section, making it easy to parse. It is not overly verbose, though the Args section partially repeats schema field names without adding new info for number_or_sys_id.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the simple tool (3 params, no nested types, no enums), the description adequately covers the purpose and key behavioral differences. An output schema exists, so return value details are not needed. It does not explain prerequisites like 'incident must exist' or what happens if the incident is already resolved, but for a straightforward comment tool, this is sufficient.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The description adds significant meaning beyond the schema: it explains that comment is customer-visible by default and that work_note makes it internal. Since schema coverage is 0% and there are 3 parameters, the description compensates well, though it could clarify that number_or_sys_id uniquely targets an incident.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states it adds either a customer-visible comment or an internal work note to an incident, using specific verbs and resources. It distinguishes from sibling tools like create_incident or update_incident by focusing on commentary, not incident creation or field modification.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description explains the core use case (adding a comment vs work_note) but does not explicitly state when not to use this tool or mention alternatives. Given the sibling tools, an agent might infer that for broader updates they should use update_incident instead, but no direct guidance is offered.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
create_incidentA
Create a new ServiceNow incident.
Args: short_description: Brief summary of the incident (required). description: Full description of the issue. urgency: "1" (High), "2" (Medium), or "3" (Low). impact: "1" (High), "2" (Medium), or "3" (Low). category: Incident category, e.g. "software", "hardware", "network". assignment_group: Name or sys_id of the assignment group. caller_id: Name or sys_id of the user reporting the incident.
| Name | Required | Description | Default |
|---|---|---|---|
| impact | No | ||
| urgency | No | ||
| category | No | ||
| caller_id | No | ||
| description | No | ||
| assignment_group | No | ||
| short_description | Yes |
Output Schema
| Name | Required | Description |
|---|---|---|
No output parameters | ||
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations are provided, so the description carries the full burden of behavioral disclosure. It does not mention side effects (e.g., whether a record is stored immediately, if it triggers notifications, or if any validation occurs). The output schema exists but is not described, leaving the agent to infer what the tool returns.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is concise and well-structured, with a clear introductory sentence followed by a bullet-like list of parameters. Each line is informative and earns its place. No unnecessary words or repetition.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the tool has 7 parameters (1 required) and a high-complexity domain (incident creation in ServiceNow), the description covers parameter semantics but lacks guidance on return values (despite having an output schema) and behavioral details (e.g., whether the incident is immediately persisted, if any side effects occur). It is adequate for basic creation but leaves gaps for a thorough agent.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 0%, so the description must compensate, and it does reasonably well. It explains 'urgency' values as '1 (High), 2 (Medium), 3 (Low)', and 'impact' similarly, and provides example categories like 'software', 'hardware', 'network'. This adds meaning beyond the bare schema titles. However, it could clarify the format for 'assignment_group' and 'caller_id' (e.g., 'sys_id preferred') for even better clarity.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states 'Create a new ServiceNow incident', using a specific verb ('Create') and resource ('ServiceNow incident'). The parameter descriptions further clarify the fields involved, and the tool name 'create_incident' is distinct from siblings like 'get_incident' or 'update_incident', so no confusion arises.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description lists parameters and their meanings, which guides basic usage, but it does not explicitly say when to use this tool versus siblings. For example, when to create an incident versus update one via 'update_incident' is left implied. There is no 'when not to use' or alternative guidance provided.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
get_incidentA
Fetch a ServiceNow incident by its number (e.g. INC0010023) or sys_id.
| Name | Required | Description | Default |
|---|---|---|---|
| number_or_sys_id | Yes |
Output Schema
| Name | Required | Description |
|---|---|---|
No output parameters | ||
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations are provided, so the description carries full burden. It correctly indicates a read-only operation ('Fetch'), but does not disclose what happens on missing identifiers, authentication needs, or response structure (though output schema partially compensates). The description adds minimal behavioral context beyond the obvious.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is a single sentence with no wasted words. It front-loads the action and provides an immediate example. Every word earns its place.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the tool's simplicity (single parameter, no nested objects) and the presence of an output schema, the description is almost sufficient. It covers the core functionality and parameter semantics. The only gap is missing error behavior or success indication, but for a straightforward fetch this is acceptable.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 0%, so the description must compensate. It explains that the parameter accepts either an incident number (with example) or a sys_id, which adds significant meaning beyond the raw 'string' type. However, it could be more precise about sys_id format (e.g., GUID).
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the action ('Fetch'), the resource ('ServiceNow incident'), and provides a concrete example of the identifier format ('number (e.g. INC0010023) or sys_id'). This distinguishes it from sibling tools like search_incidents (which searches by other criteria) and mutation tools.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description implies use when you have the exact identifier, but provides no explicit guidance on when to use this tool versus siblings, nor when not to use it. For example, it does not mention that search_incidents should be used if the identifier is unknown.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
resolve_incidentB
Resolve an incident by setting its state to Resolved.
Args: number_or_sys_id: Incident number or sys_id. close_notes: Notes describing the resolution. close_code: Resolution code, e.g. "Solved (Permanently)", "Solved (Workaround)".
| Name | Required | Description | Default |
|---|---|---|---|
| close_code | No | Solved (Permanently) | |
| close_notes | Yes | ||
| number_or_sys_id | Yes |
Output Schema
| Name | Required | Description |
|---|---|---|
No output parameters | ||
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations, the description bears full responsibility for behavioral disclosure. It states that the tool sets the state to 'Resolved', which implies a write operation, but omits critical details: required permissions (e.g., can_edit_incident), side effects (e.g., notifications, closing timers), idempotency, or reversibility. The output schema exists but is not referenced.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is short (two sentences) and front-loaded with the main purpose, followed by a clear, bullet-like argument list. Every sentence contributes meaning without redundancy.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the presence of an output schema (unmentioned), three parameters, and no annotations, the description is incomplete. It lacks usage context, behavioral warnings, and does not describe the return value. An agent cannot fully assess when to invoke this tool or what to expect beyond the primary state change.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The description adds meaningful information beyond the bare schema. For 'number_or_sys_id' it clarifies acceptance of either number or system ID. 'close_notes' gets a contextual explanation. 'close_code' provides concrete examples ('Solved (Permanently)', 'Solved (Workaround)'). With 0% schema coverage, this compensation is valuable, though the required/non-required distinction is left to the schema.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly identifies the action ('Resolve'), the resource ('incident'), and the specific outcome ('by setting its state to Resolved'). This verb+resource combination distinguishes it from sibling tools like update_incident and search_incidents, as resolve is a distinct operation.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description provides no guidance on when to use this tool versus alternatives such as update_incident or add_comment. It does not mention prerequisites (e.g., incident must be open), excluded scenarios (e.g., already resolved), or compare with sibling tools.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
search_incidentsA
Search incidents using a ServiceNow encoded query.
Args: query: ServiceNow encoded query string (sysparm_query), e.g. "active=true^priority=1" or "assigned_to.nameLIKEJohn". Leave empty to list the most recent incidents. limit: Max number of records to return (default 10). offset: Number of records to skip, for pagination.
| Name | Required | Description | Default |
|---|---|---|---|
| limit | No | ||
| query | No | ||
| offset | No |
Output Schema
| Name | Required | Description |
|---|---|---|
| result | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations provided, so description must carry full disclosure. It explains pagination but omits critical behavioral traits: it's a read-only operation, no side effects, no rate limits or authorization hints. The output schema exists but description doesn't confirm that results are returned.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
Structured as a compact docstring with Args section. Every sentence is informative and necessary. No wasted words.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Covers the core usage of all three parameters, defaults, and pagination. Output schema is present, so return details are provided structurally. Could mention that the tool returns a list of incidents matching the query.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema coverage is 0%, yet description adds rich meaning: query is a ServiceNow encoded string with examples, limit default 10, offset for pagination. This fully compensates for the lack of schema descriptions.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states 'Search incidents using a ServiceNow encoded query' with a specific verb and resource. It distinguishes from sibling tools like get_incident (single record) and mutation tools.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
Describes when to use the encoded query, including examples and the behavior when query is empty. Provides pagination guidance via limit and offset. Lacks explicit contrast with siblings or exclusion scenarios.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
update_incidentA
Update fields on an existing incident.
Args: number_or_sys_id: Incident number (e.g. INC0010023) or sys_id. fields: Field name -> new value, e.g. {"state": "2", "priority": "1"}.
| Name | Required | Description | Default |
|---|---|---|---|
| fields | Yes | ||
| number_or_sys_id | Yes |
Output Schema
| Name | Required | Description |
|---|---|---|
No output parameters | ||
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations are provided, so the description carries the full burden of behavioral transparency. It discloses the tool is a mutation (update) on an existing incident, which implies write side effects. However, it does not mention whether partial updates are allowed, whether all fields are updatable, what happens on failure (e.g., incident not found), or authentication/permission requirements. This is adequate but not comprehensive for a mutation tool.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is concise, consisting of a one-liner summary and a docstring-style Args block. The key info is front-loaded. However, the Args section uses a format that may be less readable in some plain-text contexts, and it could be slightly more structured with bullet points.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given that no annotations exist, the description must cover behavioral aspects. It informs about update semantics, but lacks details on return values (despite an output schema existing), error handling, rate limits, or field validation. For a tool with two parameters and a nested object, it is adequate but not fully complete.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 0%, so the description fully bears the responsibility. It explains the first parameter (number_or_sys_id) with a concrete example (INC0010023) and indicates it can also accept a sys_id. For the fields parameter, it provides a usage example format. This adds significant semantic value beyond the bare schema, which only states type and title. However, it does not document all possible field names or values, leaving some ambiguity.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the tool updates fields on an existing incident, specifying the resource (incident) and action (update). The sibling tools include create_incident and resolve_incident, so this description effectively distinguishes itself as a general-purpose field update tool.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description implicitly indicates usage when updating existing incidents, but it does not explicitly state when not to use it or mention alternatives. For example, it does not clarify that resolving an incident should use resolve_incident instead, or that updating status to '6' (resolved) might trigger different side effects. The usage is clear for common cases but lacks explicit guidance.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
6 tool updates
v0.1.0- First observed
add_comment - First observed
create_incident - First observed
get_incident - First observed
resolve_incident - First observed
search_incidents - First observed
update_incident
TDQS
Scored across 6 tools
Each tool has a clear, distinct purpose covering the full incident lifecycle: get, create, update, search, add comment, and resolve. There is no overlap or ambiguity between them.
Tools follow a verb_noun pattern (e.g., get_incident, create_incident). The only minor deviation is 'add_comment' which is still verb_noun but lacks the 'incident' suffix, though it is clearly contextual.
Six tools is an ideal size for an incident management MCP server. Each tool serves a necessary operation without being too many or too few, keeping the surface focused and manageable.
Core incident operations are covered: create, read, update, search, comment, and resolve. Missing an explicit delete tool, but ServiceNow incidents are typically not deleted; update can handle assignment. Minor gap but still robust.
Maintenance
Related MCP Connectors
- mttrlyOAuthcom.mttrly
AI-powered incident management and server monitoring via MCP.
- mcpOAuthcom.gibsonai
GibsonAI MCP server: manage your databases with natural language
An MCP server that provides an API to LLMs to manage their JumpCloud resources.
MCP server for generating rough-draft project plans from natural-language prompts.
Related MCP Servers
- AlicenseAqualityAmaintenanceAn MCP server that enables AI assistants to interact with ServiceNow instances, allowing script execution, data querying, ATF tests, and log tailing through natural language commands.8935 npm16MIT
- AlicenseNot gradedqualityCmaintenanceMCP server enabling interaction with ServiceNow API for managing incidents, CMDB, change management, and other ServiceNow operations via natural language.20MIT
- FlicenseAqualityDmaintenanceA production-ready MCP server that turns any MCP-compatible AI assistant into an AI-powered ServiceNow Incident Management Assistant, exposing incidents, users, CMDB records, and knowledge articles through validated tools.12-
- AlicenseNot gradedqualityDmaintenanceMCP server to interact with ServiceNow instances, enabling ITSM, CMDB, workflow, and knowledge search operations.MIT