ServiceNow MCP Server
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@ServiceNow MCP Serversearch for available laptops in the service catalog"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
ServiceNow MCP Server
A stateless Model Context Protocol server for ServiceNow Service Catalog, hosted on Azure Functions. It connects Microsoft Copilot Studio to ServiceNow so users can search catalog items, fill order forms rendered as Adaptive Cards, and place orders from within a Copilot Studio agent.
MCP tools provided:
Tool | Description |
| Full-text catalog search with Adaptive Card item picker |
| Returns an Adaptive Card form for the selected item |
| Submits the order and returns a confirmation Adaptive Card |
| Lists the caller's open (non-closed) catalog orders, enriched with their request items |
| Updates a small allowlist of requestor-mutable fields on the caller's order ( |
| Validates OAuth and catalog API access end-to-end |
Related documentation:
Copilot Studio Setup -- add MCP tool and configure ordering topic
Copilot Studio reference agents -- how this MCP server fits the ESS IT / ESS ServiceNow Catalog agent architecture
Why not the MCP wizard? Use a custom connector for SSO/OBO -- why the auto-provisioned MCP connector cannot do silent SSO, and what to do instead (Teams + M365 Copilot)
Custom MCP Connector with OBO / SSO -- hand-author a custom MCP connector so users get true silent SSO instead of the per-user "Open connection manager" prompt
Cost Estimation -- Azure infrastructure + Copilot Studio message consumption cost model, per-operation pricing, and worked examples for pilot / SMB / enterprise scenarios
Agent 365 BYO MCP -- register this server in the Microsoft 365 admin center for tenant-wide governance
ServiceNow Setup -- OAuth app, integration user, and permissions
Action Contracts -- tool schemas for Copilot Studio topic authors
Optional Container Deployment -- run as one Docker container in Azure Container Apps
Security Guidelines -- what to never commit
Prerequisites
Requirement | Notes |
Azure subscription | Permission to create resource groups and Entra app registrations |
Azure CLI (az) | |
Azure Developer CLI (azd) | |
Node.js 20+ | To build the project locally |
ServiceNow instance | Admin access to create OAuth apps and users |
Microsoft Entra ID | Permission to register an app |
Copilot Studio agent model | GPT-5 or newer, or Claude Sonnet. GPT-4.1 is not supported because it does not render the MCP Adaptive Cards. See COPILOT_STUDIO_SETUP.md. |
Related MCP server: ServiceNow MCP Server
Quick Start
Step 1 -- Set up ServiceNow
See docs/SERVICENOW_SETUP.md for the complete guide, or run the automation script:
pwsh -File scripts/setup-servicenow.ps1 \
-InstanceUrl https://<instance>.service-now.com \
-AdminUser <admin-username> \
-AdminPassword <admin-password>What you need from ServiceNow:
Client ID and Client Secret from the OAuth App Registry entry
Integration user username and password (with
catalogrole)
Step 2 -- Register an Entra ID Application
This enables per-user OAuth 2.0 authentication in Copilot Studio.
Azure Portal > Entra ID > App registrations > New registration
Name:
ServiceNow MCP ServerSupported account types:
Accounts in this organizational directory onlyClick Register
Note Application (client) ID =
ENTRA_CLIENT_IDNote Directory (tenant) ID =
ENTRA_TENANT_ID
Certificates & secrets > New client secret -- copy the value immediately =
ENTRA_CLIENT_SECRETExpose an API > Set Application ID URI -- accept default
api://<ENTRA_CLIENT_ID>Add a scope: name
access_as_user, consent: Admins and users
Authentication > Add a platform > Web -- add redirect URIs:
https://oauth.botframework.com/callback https://global.consent.azure-apim.net/redirect https://copilotstudio.preview.microsoft.com/connection/oauth/redirectEnable Access tokens and ID tokens > Save
(Recommended) API permissions > Add > My APIs > ServiceNow MCP Server >
access_as_user> Grant admin consent This lets all tenant users use the agent without individual consent prompts.
Step 3 -- Deploy to Azure
Interactive (recommended for first deployment):
npm run deploy:azureThe script prompts for all values, provisions Azure resources (Function App, Key Vault, Application Insights), deploys the function, and prints Copilot Studio setup instructions.
Non-interactive (CI/CD):
pwsh -File scripts/deploy-azure.ps1 \
-EnvironmentName prod \
-Location westeurope \
-SubscriptionId <subscription-id> \
-ServiceNowInstanceUrl https://<instance>.service-now.com \
-ServiceNowClientId <sn-client-id> \
-ServiceNowClientSecret <sn-client-secret> \
-ServiceNowUsername <integration-user> \
-ServiceNowPassword <integration-user-password> \
-EntraTenantId <entra-tenant-id> \
-EntraClientId <entra-client-id> \
-EntraClientSecret <entra-client-secret>Manual azd:
az login && azd auth login
azd env new <env-name>
azd env set SERVICENOW_INSTANCE_URL "https://<instance>.service-now.com"
azd env set SERVICENOW_CLIENT_ID "<sn-client-id>"
azd env set SERVICENOW_CLIENT_SECRET "<sn-client-secret>"
azd env set SERVICENOW_USERNAME "<integration-user>"
azd env set SERVICENOW_PASSWORD "<integration-user-password>"
azd env set ENTRA_TENANT_ID "<entra-tenant-id>"
azd env set ENTRA_CLIENT_ID "<entra-client-id>"
azd env set ENTRA_CLIENT_SECRET "<entra-client-secret>"
azd upGet the deployed MCP endpoint URL:
azd env get-values | findstr MCP_ENDPOINT_URLOptional: Deploy as One Container (Azure Container Apps)
If you prefer a single container deployment instead of Azure Functions, use the Docker + Container Apps path documented in docs/DEPLOY_CONTAINER_AZURE.md.
This path builds this repo as a single Node.js container and exposes the same MCP endpoint shape at /mcp.
Step 4 -- Add to Microsoft Copilot Studio
See COPILOT_STUDIO_SETUP.md for the full guide.
Copilot Studio > your agent > Tools > Add a tool > Model Context Protocol
Fill in:
Field
Value
Server name
ServiceNow MCPServer URL
https://<your-function-app>.azurewebsites.net/mcpAuthentication
OAuth 2.0Type
Dynamic discoveryClick Create > sign in when prompted > verify all 4 tools appear.
Import the ordering topic from
copilot-studio/topics/into your agent.
Step 5 -- (Optional) Register with Microsoft Agent 365 (BYO MCP)
To make this MCP server tenant-governed (visible in Microsoft 365 admin center > Agents > Tools > Registry, monitored in Defender XDR, and discoverable from Copilot Studio, VS Code, Claude Code, and GitHub Copilot CLI), register it as a Bring-Your-Own MCP server with Microsoft Agent 365.
The server already speaks EntraOAuth end-to-end, so no code changes are required. Use the helper script:
pwsh -File scripts/register-agent365-mcp.ps1 `
-ServerName "ext_ServiceNowMCP" `
-PublisherName "<your-org>" `
-McpEndpointUrl "https://<funcapp>.azurewebsites.net/mcp" `
-EntraClientId "<ENTRA_CLIENT_ID>" `
-TenantId "<ENTRA_TENANT_ID>"The CLI requires the server name to start with
ext_and be ≤ 20 characters.
A tenant admin (Global admin or AI admin) then approves the request in the Microsoft 365 admin center. Full step-by-step guide, troubleshooting, and Defender hunting query: docs/AGENT_365_BYO_MCP.md.
Architecture
Runtime: Azure Functions v4, Node.js 20, Flex Consumption (FC1)
Transport: Streamable HTTP, stateless MCP
MCP auth: OAuth 2.0 via Microsoft Entra ID (per-user sign-in)
ServiceNow auth: OAuth 2.0 password grant with a shared integration user
Secrets: All secrets in Azure Key Vault; Function App reads via managed identity
Monitoring: Application Insights
HTTP surfaces and authentication
The deployed Function App exposes the routes below. Auth requirements are fixed in code; no extra Function-level keys, network ACLs, or RBAC are applied beyond what's documented here.
Method · Route | Purpose | Auth |
| MCP Streamable HTTP — | Entra Bearer required (validated by src/utils/entraAuthMiddleware.ts) |
| SSE readiness probe (Streamable HTTP transport) | Anonymous |
| Session cleanup (stateless mode no-op) | Anonymous |
| CORS preflight | Anonymous |
| Deterministic REST surface for Copilot Studio topics | Entra Bearer required |
| CORS preflight | Anonymous |
| Liveness/readiness probe — returns | Anonymous |
| OIDC discovery and RFC 8414/9728 metadata | Anonymous |
| RFC 7591 Dynamic Client Registration | Gated — see below |
| Lightweight capability doc for clients that probe before POST | Anonymous |
POST /oauth/register is closed by default: when no ENTRA_DCR_REGISTRATION_TOKEN is set and ENTRA_DCR_ALLOW_UNAUTHENTICATED is not "true", the endpoint returns 403. With a registration token configured the request must include Authorization: Bearer <token> (constant-time comparison); set ENTRA_DCR_ALLOW_UNAUTHENTICATED=true to opt in to anonymous DCR.
When ENTRA_AUTH_DISABLED=true (intended for local dev only), Bearer validation is bypassed on POST /mcp and /api/catalog/*. The startup log emits a WARN line stating the effective tenant policy at every cold start so this is visible in App Insights.
Delegated Identity Flow
Each order is correctly attributed to the Copilot Studio user who placed it:
Copilot Studio sends the user's Entra Bearer token to the MCP server.
The MCP server validates the token and extracts the caller's UPN/email.
The server obtains a ServiceNow token for the integration user (password grant).
The caller's email is looked up in
sys_userto find their ServiceNowsys_id.The order is placed, then immediately PATCHed to set
requested_forto the resolved user.
Integration user permissions needed: read on
sys_user, read+write onsc_request, pluscatalogand/oritilroles.
Local Development
npm install
cp local.settings.sample.json local.settings.json
# Edit local.settings.json -- ENTRA_AUTH_DISABLED is true by default for local use
npm run start:devMCP endpoint: http://localhost:7071/mcp
# Smoke test against local
set MCP_ENDPOINT_URL=http://localhost:7071/mcp
npm run smoke:testEnvironment Variables Reference
Required
Variable | Description |
| ServiceNow base URL ( |
| OAuth App Registry client ID |
| OAuth App Registry client secret |
| Integration user login |
| Integration user password |
Entra ID (required for Copilot Studio OAuth)
Variable | Description |
| Entra directory (tenant) ID |
| App registration client ID |
| App registration client secret (for Dynamic Client Registration) |
| Expected |
Optional
Variable | Default | Description |
|
| Skip Bearer validation -- local dev only, never in production |
|
| Scopes advertised in OIDC discovery |
| (empty) | Accepted remote tenant IDs (multi-tenant scenarios) |
|
| Accept any Microsoft tenant token |
| (unset) | Bearer token required on |
|
| Allow open Dynamic Client Registration when no token is configured |
| (empty) | Comma-separated extra |
| (empty) | Comma-separated browser origins for CORS-enabled endpoints |
|
| ServiceNow token endpoint path |
|
| Override grant type: |
|
| OAuth client auth style: |
|
| When |
|
|
|
|
| Entra token claims to use as identity source |
|
| Fall back to UPN if no |
|
| Include requested_for diagnostics in tool/API responses |
|
| Include raw caller identifiers in diagnostics (for short-lived troubleshooting only) |
|
| Minimum log level emitted to stdout: |
|
| Attach caller |
|
| Include error stack traces in error log entries |
Local Testing Against ServiceNow
Two ways to verify ServiceNow responses without going through Copilot Studio:
Option A — Run the full MCP server locally and call it via JSON-RPC
# 1. Copy the sample settings file and fill in your ServiceNow credentials.
Copy-Item local.settings.sample.json local.settings.json
# Set SERVICENOW_INSTANCE_URL / SERVICENOW_CLIENT_ID / SERVICENOW_CLIENT_SECRET
# (and SERVICENOW_USERNAME / SERVICENOW_PASSWORD for the password grant).
# ENTRA_AUTH_DISABLED=true is the default in the sample so no Bearer token is needed.
# 2. Start the function locally on http://localhost:7071/mcp
npm run start:dev
# 3. In a second terminal, run the MCP smoke test against localhost.
$env:MCP_ENDPOINT_URL = "http://localhost:7071/mcp"
$env:SEARCH_QUERY = "laptop"
npm run smoke:testThis exercises the full request pipeline (Express, MCP SDK, Streamable HTTP transport, ServiceNowClient).
Option B — Direct ServiceNow probe (no MCP, no Functions runtime)
For faster iteration when you only care about ServiceNow responses, the
scripts/dev/test-servicenow-local.mjs runner loads local.settings.json
and calls the ServiceNowClient methods directly:
npm run sn:local -- validate
npm run sn:local -- search "vpn access" 5
npm run sn:local -- form 04b7e94b4f7b4200086eeed18110c7fd
npm run sn:local -- orders --upn=alice@contoso.com
npm run sn:local -- order <itemSysId> '{"justification":"test"}' --confirm --upn=alice@contoso.comUseful flags:
--upn=<user@domain>simulates the caller identity that the Express middleware would inject from a real Entra token. Required forordersand for testingrequested_forresolution onorder.--confirmis mandatory onorderbecause it creates a real ServiceNow request.Existing
process.envvalues win overlocal.settings.json, so you can override individual settings on the command line.
Output is raw JSON — pipe through ConvertFrom-Json or jq to inspect specific fields.
Smoke Testing Deployed Endpoint
Quick liveness check (no token required):
curl https://<function-app>.azurewebsites.net/health
# → {"status":"ok","server":"servicenow-mcp"}Full MCP smoke test (Entra Bearer required):
set MCP_ENDPOINT_URL=https://<function-app>.azurewebsites.net/mcp
set ENTRA_BEARER_TOKEN=<access-token>
npm run smoke:testGet a token:
az account get-access-token --resource api://<ENTRA_CLIENT_ID> --query accessToken -o tsvTroubleshooting
401 on MCP endpoint -- Entra auth is active and no valid Bearer token was sent. Check the Copilot Studio connection (user must have signed in). For local testing, set ENTRA_AUTH_DISABLED=true.
Orders created but requested_for is wrong -- The post-order PATCH failed. Verify:
Integration user has write on
sc_requestin ServiceNow.Caller's Entra email matches
sys_user.emailorsys_user.user_name.Application Insights traces for
[ServiceNowClient.placeOrder.requestedForPatchFailed].
Dynamic discovery fails in Copilot Studio -- Verify ENTRA_TENANT_ID and ENTRA_CLIENT_ID are set. Confirm the OIDC endpoint returns 200. If you changed OAuth settings after the MCP tool was added, delete and re-add the connection -- Power Platform caches OIDC metadata on first connect.
validate_servicenow_config errors -- Run with probeOrderNow: false first to isolate auth vs. catalog access issues.
Security
All secrets are stored in Azure Key Vault. The Function App reads them via managed identity. No credentials appear in app settings in plaintext.
local.settings.jsonis excluded by.gitignore-- never commit it.Never deploy with
ENTRA_AUTH_DISABLED=true.Keep
/oauth/registerprotected withENTRA_DCR_REGISTRATION_TOKEN(recommended).Keep
ENTRA_DCR_ALLOW_UNAUTHENTICATED=falsein enterprise environments.Keep
SERVICENOW_REQUESTED_FOR_DIAGNOSTICS_INCLUDE_PII=falseunless you are actively debugging and have an approved retention path.Prefer
SERVICENOW_REQUIRE_CALLER_ACCESS_TOKEN=truewhen enterprise policy requires per-user ServiceNow ACL enforcement.
See SECURITY.md for full guidelines.
Engineering Guardrails
Apply these rules for every new feature, bug fix, refactor, or deployment-related change in this repository.
Local Development Files
Treat
local.settings.jsonas developer-local configuration.Do not sanitize, template, overwrite, or reformat
local.settings.jsonunless the user explicitly asks for that file to be changed.Apply security improvements in committed source files, scripts, infrastructure, and docs instead of rewriting local developer secrets files.
Logging And Diagnostics
Route new operational logs through the structured logger in
src/utils/logger.ts.Never log secrets, bearer tokens, passwords, client secrets, function keys, cookies, or raw authorization headers.
Do not log caller PII by default. Any diagnostics that may expose user identity must be opt-in and disabled by default.
Keep error output sanitized. Avoid returning or logging full upstream payloads when they may contain tokens, identifiers, or request content.
Identity And Access
Prefer least privilege for both ServiceNow and Entra configuration.
Avoid broad ServiceNow roles when narrower ACLs or scoped access can satisfy the requirement.
Prefer delegated/per-user enforcement when enterprise requirements demand user-level authorization boundaries.
Do not add Microsoft Graph or unrelated Entra permissions unless they are strictly required by the implemented feature.
API And OAuth Surface
Use explicit CORS allowlists for browser-facing endpoints. Avoid wildcard origins for enterprise-exposed APIs.
Keep Dynamic Client Registration secure by default. Require a registration token unless open registration is an intentional, reviewed choice.
Preserve MCP protocol compatibility when changing transport, discovery, or tool metadata behavior.
Documentation Expectations
Update repo documentation whenever behavior, configuration, permissions, or security posture changes.
Add concise function-level comments when behavior is non-obvious, especially in auth, logging, transport, or security-sensitive code paths.
Document new environment variables, defaults, and security implications in the repo.
Review Standard
Before considering a change complete, verify:
No secrets or PII were added to logs, responses, docs, or tracked files.
local.settings.jsonwas left untouched unless explicitly requested.New permissions are justified and minimized.
User-facing and operator-facing documentation matches the implementation.
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
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/pavecer/mcp-server-servicenow'
If you have feedback or need assistance with the MCP directory API, please join our Discord server