Table of contents

When developers create a Codex task to automate an operational process, they describe that process from memory. But the actual procedure—the runbook, the change plan, the resolution steps, etc.—lives in ServiceNow, not in what the developer wrote.
Codex generates code against the developer's summary, which means it misses the specific steps, edge cases, and conditional logic that the original record actually contains.
Connecting ServiceNow gives Codex direct access to the source. When a task requires a runbook before generating automation code, or a change request's implementation plan before scaffolding the corresponding script, Codex reads the record itself rather than whatever the developer remembered about it.
To give Codex direct access to ServiceNow as it works through your coding tasks, we'll show you how to connect ServiceNow with Merge Agent Handler's ServiceNow MCP server.
Merge Agent Handler connects Codex to the ServiceNow API through the Merge CLI. You install the CLI, authenticate once, and run a single setup command from your project root.
That command writes a Merge CLI section to your project's AGENTS.md file, which tells Codex when to call merge search-tools and merge execute-tool to reach ServiceNow.
Once connected, Merge handles credential storage and token rotation on your behalf, so you never embed ServiceNow credentials in your repo or manage them per developer.
Related: How to use the ServiceNow MCP in Claude Code
Before getting started, you'll need the following:
pipx --version to confirm, or install via pip install pipx)If you want to connect Merge Agent Handler's ServiceNow MCP with internal or customer-facing agentic products, you can follow the steps in our docs.
Run the following to install the Merge CLI: pipx install merge-api
Verify your installation: merge --version
Authenticate the CLI with your Merge Agent Handler account: merge login
This links the CLI to your Merge account and stores your session credentials locally.
From the root of the project where you want Codex to have access to ServiceNow, run:
This writes a Merge CLI section to your project's AGENTS.md file so Codex knows to use the CLI when a task requires ServiceNow data. The command is idempotent — safe to re-run if you need to reset the configuration.
Commit the updated AGENTS.md so the configuration travels with the repo.
Related: A guide to integrating the ServiceNow MCP with Cursor
Create a Codex task that requires live ServiceNow data.
This can be something like: "Read the runbook for the database failover procedure from ServiceNow's knowledge base and generate a Python automation script that executes each step in sequence, with error handling for each stage."
The first time Codex invokes a ServiceNow tool, a Magic Link will appear to complete connector authentication.

Once authenticated, Codex has access to your ServiceNow instance through Merge for all subsequent tasks in this project.
{{this-blog-only-cta}}
In case you have more questions on setting up and using the ServiceNow MCP with Codex, we've addressed several more commonly-asked questions below.
With ServiceNow connected, Codex can:
You can set up a ServiceNow MCP server yourself. That means configuring OAuth or basic auth against your ServiceNow instance, standing up an MCP process, and pointing Codex at it.
Where that breaks down is when the team grows. Each developer needs their own auth setup, or you share a service account with credentials that can't be attributed to a specific user and are painful to rotate.
There's also no per-user access control in a self-hosted setup. If the service account can read a change request, every Codex task using that integration can read any change request.
Merge Agent Handler handles credential storage and rotation for you, enforces per-user scoping so each developer authenticates with their own identity, and logs every tool call with full attribution.
For teams running Codex against production operational data, knowing which task reads which record and when is a meaningful audit capability to have.
ServiceNow holds the operational knowledge that should inform automation code: runbooks, change implementation plans, incident resolution steps, problem analyses, and CMDB dependency data. Codex doesn't have access to any of that unless a developer copies it into the task description first.
That copy step degrades the source material. Developers paraphrase steps, leave out conditionals, and forget edge cases. Codex generates code that's structurally close but wrong in the specifics that determine whether the automation actually works in production.
Connecting ServiceNow gives Codex the ability to pull the source records directly. A task to automate a failover procedure reads the actual runbook. A task to generate a post-incident review reads the actual resolution notes, and so on. This means the output reflects what the records say, not what the developer remembered about them.
Yes, Merge for Workforce is built to help engineering organizations provision, secure, and govern how employees connect AI tools like Codex to operational systems like ServiceNow.
Common patterns include:
In practice, employees can use the ServiceNow MCP to generate automation from runbooks, scaffold scripts from change plans, and build tooling grounded in live CMDB data, while IT keeps centralized control over which record types and tables each developer's agent can reach.
Use Merge Agent Handler’s 150+ connectors (including ServiceNow) to power reliable, secure, and powerful agents.