Connect a Slack bot to Sentry

Verified August 11, 2026

This gives a Slack bot access to Sentry. Ask it a question in a channel and it will look up errors, stack traces, and releases in your Sentry org and answer in the thread.

What you need

  • A Slack workspace where you can install apps
  • A Sentry account
  • An OpenRouter account

Install the CLI

npm i -g @substructure.ai/cli

Write the config

Save this as substructure.toml.

substructure.toml
name = "oncall-bot"

[llm.openrouter]
type = "openrouter"

[mcp.sentry]
url = "https://mcp.sentry.dev/mcp"

[agent.oncall]
llm = "openrouter"
model = "z-ai/glm-5.2"
system = "You are the on-call assistant. Look up errors in Sentry and explain what broke."
mcp = [{ id = "sentry", tools = { read_only = true } }]

[slack]
dm = "oncall"
mentions = "oncall"

[remote]
url = "https://api.substructure.ai"

[agent.oncall] declares the agent: its model, its prompt, and the connections it can reach. The Slack bot is how you talk to it.

The file holds the server URL and the agent that uses it. It holds no tokens.

[remote] is the deployment the CLI talks to. subs apply writes the org and the project back under it.

Create the project

subs apply

This creates the project from the file and writes the project id back into it. If you are not signed in yet, the command opens your browser first. Run subs apply again after any edit to the file.

Add your LLM key

subs llm set-key openrouter

The agent's model runs through OpenRouter, so it needs an OpenRouter API key. Create one at openrouter.ai/keys if you do not have one. The command stores the key with your deployment. It never goes in the config file.

Authorize Sentry

subs mcp login sentry

This opens Sentry's consent page. Approve it and the credential goes to your deployment.

Run subs mcp list to check the connection is authorized.

Connect Slack

subs slack connect

Pick your workspace and approve. The bot is live once the command prints the workspace name.

Ask it something

Invite the bot to a channel and mention it.

  • "what is breaking in production right now?"
  • "show me the stack trace for the last checkout error"

Each tool call shows in the thread as a task card. Open a card to see the arguments and the result.

Why the tool filter

The bot answers questions and never changes anything in Sentry.

A model picks worse as the tool list grows, and worst between tools that look alike. The filter belongs to the agent, so two agents can share one connection and see different tools.

substructure.toml
[agent.oncall]
mcp = [{ id = "sentry", tools = { read_only = true } }]

If it does not answer

  • Connection not authorized. Run subs mcp list. A declared connection with no credential reaches nothing.
  • No [slack] section. A connected workspace with no [slack] never replies.
  • Bot not invited. Invite it to the channel before you mention it.
  • Tools missing. The engine fetches the tool list once per session. Start a new thread after you change the filter.
  • Anything else. Run subs doctor.

Add another server

Declare it and name it on the agent.

substructure.toml
[mcp.sentry]
url = "https://mcp.sentry.dev/mcp"

[mcp.linear]
url = "https://mcp.linear.app/mcp"

[agent.oncall]
mcp = ["sentry", "linear"]

Tools arrive prefixed with the connection id, such as sentry__search.

The same setup works for GitHub, Linear, Notion, Stripe, and each has its own guide. See all guides.

Next steps