Table of contents

Thousands of companies trust Merge to accelerate AI from PoC to production.
Get a demo

How to connect a Slack MCP with Codex (4 steps)

Jon Gitlin
Senior Content Marketing Manager
at Merge

Engineers and PMs document requirements, bug reports, architectural decisions, and product feedback in Slack threads.

When developers create a Codex task, they describe the work from memory. The actual discussion, with all its detail and nuance, is still in Slack.

Codex writes code against the developer's summary, not against the original thread. It misses the edge cases raised halfway through the conversation, the architectural constraints someone mentioned in passing, and the decision context that explains why the spec is written the way it is.

To give Codex direct access to Slack as it works through your coding tasks, we'll show you how to connect Slack with Merge Agent Handler's Slack MCP server.

How it works

Merge Agent Handler connects Codex to the Slack 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 Slack.

Once connected, Merge handles credential storage and token rotation on your behalf, so you never embed Slack tokens in your repo or manage scope changes yourself.

Related: How to use the Slack MCP in Claude Code

Prerequisites

Before getting started, you'll need the following:

  • A Merge Agent Handler account
  • Codex access (available via the OpenAI platform)
  • pipx installed (run pipx --version to confirm, or install via pip install pipx)
  • A Slack workspace with appropriate permissions

If you want to connect Merge Agent Handler's Slack MCP with internal or customer-facing agentic products, you can follow the steps in our docs.

1. Install the Merge CLI

Install the CLI with pipx: pipx install merge-api

Verify your installation: merge --version

2. Log in to Merge

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.

3. Add Agent Handler to Codex

From the root of the project where you want Codex to have access to Slack, run:

merge setup agents-md

This writes a Merge CLI section to your project's AGENTS.md file so Codex knows to use the CLI when a task requires Slack data. The command is idempotent, safe to re-run if you need to reset the configuration.

Commit the updated AGENTS.md so every developer and CI environment that runs Codex gets the same tool configuration.

Related: A guide to integrating the Slack MCP with Cursor

4. Authenticate Slack

Create a Codex task that requires live Slack data. This can be something like: "Read the #backend-platform thread where the team discussed the new rate-limiting approach last week and scaffold the implementation based on the constraints they agreed on."

The first time Codex invokes a Slack tool, a Magic Link will appear to complete connector authentication.

Authenticating Slack

Once authenticated, Codex has access to your Slack workspace through Merge for all subsequent tasks in this project.

{{this-blog-only-cta}}

Slack MCP FAQ

In case you have more questions on setting up and using the Slack MCP with Codex, we've addressed several more commonly-asked questions below.

What can you do once the Slack MCP is connected to Codex?

With Slack connected, Codex can:

  • Read a bug report thread before writing a fix: pull the original Slack thread where the issue was reported and discussed, so the generated fix addresses the actual failure conditions and edge cases the team identified, not the developer's abbreviated summary of them
  • Pull a feature request discussion before scaffolding the implementation: retrieve the thread where product and engineering aligned on requirements, constraints, and out-of-scope items, so the scaffolded code reflects the decisions that were actually made rather than a reconstruction from a one-line task description
  • Read an incident retrospective thread to generate a post-mortem document: fetch the retro thread, including timeline posts, contributing factor analysis, and agreed-upon action items, so the generated post-mortem document captures what the team actually recorded rather than a generic template filled with assumptions
  • Pull a design discussion thread before generating implementation code: retrieve the thread where architectural options were debated and a direction was chosen, so Codex implements the accepted approach and avoids the patterns the team explicitly rejected
  • Read a data model discussion to generate accurate type definitions: pull the thread where a schema change or new entity was designed, so generated type definitions, interfaces, and validation logic match the agreed-upon field names and constraints from the source conversation

Why use Merge Agent Handler vs. a self-hosted Slack MCP server?

You can build a self-hosted Slack MCP server that calls Slack's API directly using a bot token. For a single developer working in their own workspace, that's a workable starting point: create a Slack app, grant it the scopes you need, and point Codex at the server.

The self-hosted path becomes difficult when more than one developer is involved.

Slack bot tokens carry all the scopes granted at the app level, so there's no way to give different developers or different Codex agents access to different channels or operations. Token rotation requires updating every environment that holds the token, and there's no audit record of which agent read which thread or when.

Merge Agent Handler adds a managed layer on top.

Credential storage and OAuth refresh are handled by Merge, access is scoped per agent so a Codex task can be limited to the channels it actually needs, and every tool call is logged with the agent identity, inputs, and timestamp.

For teams running Codex on production work where Slack threads contain sensitive architectural decisions or customer-specific context, that combination of scoped access and full audit logging is meaningful.

Why connect Slack to Codex?

Most engineering teams do their real planning in Slack: bug triage threads, architecture discussions, sprint kickoffs, incident retrospectives.

That context doesn't make it into tickets or docs in full. It lives in the original thread.

Codex doesn't have access to any of that unless a developer manually copies it into the task description. That copy step compresses a long discussion into a few sentences, dropping the constraints, alternatives, and decisions that shaped the final direction.

Connecting Slack gives Codex the ability to pull the source thread directly when a task requires it. The retro thread for the incident being post-mortemed, the design discussion for the feature being implemented, the bug report thread for the fix being written: Codex reads the original conversation rather than the developer's condensed version of it.

The result is code that reflects what the team actually decided, not what the developer remembered when they wrote the task.

Can I use Merge Agent Handler's Slack MCP with my employees?

Yes, Agent Handler for Employees is built to help organizations provision, secure, and govern how employees connect AI tools like Codex to operational tools like Slack.

Common patterns include:

  • Provisioning and access control via SCIM with identity providers like Okta and Microsoft Entra ID, so IT can manage which employees can access which channels and operations by role or team
  • DLP and policy enforcement on tool calls, so admins can restrict which channels a Codex task is allowed to read and block retrieval of messages from channels outside the employee's designated scope before results reach the agent's context
  • User-level audit logging so security and IT teams can review which threads were read, which channels were accessed, and which messages were retrieved, by which employee identity, and when

In practice, employees can use the Slack MCP to pull discussion threads before writing code, generate documentation grounded in actual team conversations, and scaffold implementations based on decisions recorded in Slack, while IT keeps centralized control over which channels and operations each employee's agent can reach.

Jon Gitlin
Senior Content Marketing Manager
@Merge

Jon Gitlin is the Managing Editor of Merge's blog. He has several years of experience in the integration and automation space; before Merge, he worked at Workato, an integration platform as a service (iPaaS) solution, where he also managed the company's blog. In his free time he loves to watch soccer matches, go on long runs in parks, and explore local restaurants.

Read more

Agent Handler’s Quartr connector is live! Here's how your AI can securely use it 

Company

How Merge activates institutional knowledge with Agent Handler’s Notion connector 

AI

Employee agents: overview, use cases, and implementation steps

AI

Subscribe to the Merge Blog

Get stories from Merge straight to your inbox

Subscribe

Connect Codex to thousands of tools with Merge Agent Handler

Use Merge Agent Handler’s 150+ connectors (including Slack) to power reliable, secure, and powerful agents.

Get started for free
But Merge isn’t just a Unified 
API product. Merge is an integration platform to also manage customer integrations.  gradient text
But Merge isn’t just a Unified 
API product. Merge is an integration platform to also manage customer integrations.  gradient text
But Merge isn’t just a Unified 
API product. Merge is an integration platform to also manage customer integrations.  gradient text
But Merge isn’t just a Unified 
API product. Merge is an integration platform to also manage customer integrations.  gradient text