Skip to main content
Glama
matheuscalma

servicenow-mcp

by matheuscalma

servicenow-mcp

AIエージェントがTable APIを通じてServiceNowのインシデントを作成、検索、更新できる小さなMCPサーバーです。公式のPython mcp パッケージ(FastMCPスタイルのデコレータ)、httpxpython-dotenvを使用して構築されています。stdio上で動作します。

すべては単一のファイルに収められています: server.py

Setup

Python 3.12以上とuvが必要です。

uv sync

server.pyの隣に.envファイルを作成し(git-ignoredされています)、インスタンスのベーシック認証情報を記述します。Personal Developer Instanceで十分です:

SNOW_INSTANCE_URL=https://devXXXXXX.service-now.com
SNOW_USERNAME=admin
SNOW_PASSWORD=your-password
# optional, default 15
SNOW_TIMEOUT_SECONDS=15

サーバーを実行します(stdin/stdout上でMCPを話すため、表示されるものはありません — MCPクライアントが起動する必要があります):

uv run server.py

Registering with an MCP client

クライアントがプロジェクトディレクトリのuvを指すように設定し、.venv.envが読み込まれるようにします:

{
  "mcpServers": {
    "servicenow": {
      "command": "uv",
      "args": ["--directory", "/absolute/path/to/servicenow-mcp", "run", "server.py"]
    }
  }
}

Claude Codeの場合: claude mcp add servicenow -- uv --directory /absolute/path/to/servicenow-mcp run server.py

クライアントの環境で既に設定されている環境変数は.envよりも優先されます。

Related MCP server: sn-mcp-bridge

Tools

ツール

パラメータ

説明

戻り値

create_incident

short_description: str (必須) · description: str = "" · urgency: str = "3" ("1" 高, "2" 中, "3" 低)

新しいインシデントを作成します。

{number, sys_id, short_description, state, urgency}

query_incidents

query_text: str = "" · state: str = "" · limit: int = 5 (1–100)

最新のインシデントを新しい順に一覧表示します。query_textINC0010001のような形式の場合は番号を完全一致で検索します。それ以外のテキストはServiceNowのキーワード検索(123TEXTQUERY321)を実行し、見つからなければshort_description/descriptionに対するLIKE一致にフォールバックするため、作成直後のレコードも見つかります。stateはコード("1""8")または名前(NewIn ProgressOn HoldResolvedClosedCanceled)を受け付けます。

[{number, sys_id, short_description, state, state_code, urgency, created_on}, …]

update_incident

number: str (必須) · work_notes: str = "" · state: str = ""

番号でインシデントを検索し、作業メモを追加したり、状態を設定したりします。work_notes/stateの少なくとも一方は必須です。

{number, sys_id, changed: {…}, state}

すべてのツールはスタックトレースの代わりに可読性の高いツールエラーを発生させます(エージェントにはisErrorとして表示されます)。例:

  • Authentication failed (401): check SNOW_USERNAME and SNOW_PASSWORD. ServiceNow said: User is not authenticated …

  • Could not connect to https://…: [Errno 8] nodename nor servname provided … Check SNOW_INSTANCE_URL and your network connection.

  • Timed out after 15s talking to https://… The instance may be hibernating (PDI) or unreachable.

  • Incident 'INC9999999' was not found on https://….

  • Forbidden (403): the user lacks permission … or the update was rejected by a business rule. ServiceNow said: … (例:解決フィールドなしでインシデントを解決しようとした場合)。

Design notes

  • **ServiceNowClient**は単一のhttpx.AsyncClient(ベーシック認証、JSONヘッダー、タイムアウト)をラップし、create_record / query_records / get_record_by_number / update_recordを公開します。すべてのエラーは人間が読めるメッセージのServiceNowErrorに変換されます。

  • ツールはget_client()を介してクライアントを取得します。テストではset_client(fake)を呼び出して、ネットワークに触れずにモックに差し替えることができます。

  • レコードはsysparm_display_value=allで取得されるため、state/urgencyラベルはハードコードされたマップではなくインスタンス自体から取得されます(フレンドリーネームのエイリアスは入力専用です)。

  • mcp 2.xではFastMCPMCPServerに改名されました。server.pyは存在する方のモジュールをインポートするため、1.xと2.xの両方で動作します。

Smoke test

実際のインスタンスに対して実行します(1件のインシデントを作成):

uv run python -c "
import asyncio, server
async def main():
    c = await server.create_incident('MCP server smoke test', 'created by smoke test')
    print(c)
    print(await server.query_incidents(query_text='MCP server smoke test'))
    print(await server.update_incident(c['number'], work_notes='hello from MCP'))
asyncio.run(main())
"
Install Server
F
license - not found
A
quality
C
maintenance

Maintenance

Maintainers
Response time
Release cycle
Releases (12mo)
Commit activity

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Servers

  • A
    license
    A
    quality
    C
    maintenance
    An MCP server for interacting with a ServiceNow instance via its Table API, enabling CRUD operations on incident, request, and requested item tables, as well as generic operations on any table by name.
    22
    MIT

View all related MCP servers

Related MCP Connectors

  • MCP server for AI dialogue using various LLM models via AceDataCloud

  • MCP server for AI agents to plan, verify, and deploy Cloudflare-native apps.

  • Hosted MCP server connecting claude.ai, ChatGPT and other AI apps to your own computer

View all MCP Connectors

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/matheuscalma/servicenow-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server