Blogguide12 min read

Adding Your Own MCP Tools to an AI SRE Agent, Safely

How Aurora SRE calls your internal MCP servers and acts as one: registration, Allow or Confirm per tool, background runs, and the prompt injection gaps.

AA
Arvo AI Team, Engineering

To extend an AI SRE agent with tools that hit your internal APIs, wrap those APIs in a remote MCP server and register it with an agent that acts as an MCP client. Aurora SRE, which is open source and self-hostable, does this with a name and a URL: it probes the server, caches its tool list, and lets the agent call those tools in chat and in investigations. Tools that are not known to be read-only ask a human first, and are withheld from background runs where nobody can answer.

The first version we built did not survive contact with real servers. It registered one agent tool per remote tool, named mcp_<label>_<tool>. Against a hosted server with 64 tools that was already 64 JSON Schemas in the prompt on every turn, and the pull request listed "640 tool schemas bound every turn" at the 10-server limit as an open problem. Ask mode, our read-only mode, was worse: it blocks the whole mcp_ prefix and re-admits a fixed list of GitHub tool names, so it silently dropped every custom tool while the prompt still advertised them. The agent called tools that did not exist and improvised. This post covers the design that replaced it and the parts that are still weak.

Which AI SRE agents expose an MCP-compatible interface for custom tools?

MCP shows up in an SRE agent in two directions. Here is how each works in Aurora at v1.5.31.

Aurora as MCP clientAurora as MCP server
Who calls whomAurora's agent calls your serverCursor, Claude Code, Claude Desktop, Codex, Windsurf or Cline call Aurora
TransportStreamable HTTP, falling back to HTTP+SSE. No stdioStreamable HTTP on port 8811
AuthNone, bearer token, custom header, or OAuth with PKCEPer-user bearer token
ScopeWhole organization, up to 10 servers and 256 tools per serverThe calling user's own RBAC scope
How tools reach the modelTwo dispatcher tools, whatever you registerA short always-visible tier, plus 6 connector-gated tools (TIER2_TOOLS) and 84 allowlisted tools (DISPATCH_ALLOWLIST) reached through search_tools and call_tool. Both counts are entries in registry.py at v1.5.31
WritesPer-tool Allow or ConfirmTerraform, kubectl mutations and shell exec are banned from the allowlist by a startup assertion

The server side is in the MCP guide and its allowlist is DISPATCH_ALLOWLIST. Both directions run inside your own deployment when you self-host, so incident data and the credentials for your internal tools stay on your network. The rest of this post is about the client side, where the security engineering is.

How do you register a custom MCP server?

The UI (Connectors, then Custom MCP Servers) asks for a Name and a Server URL. The API takes the same fields. This is the body the form posts to /api/mcp/servers for a server that wants a key in a custom header:

{
  "label": "netbox",
  "url": "https://netbox-mcp.internal.example.com/mcp",
  "authType": "header",
  "headerName": "X-Api-Key",
  "token": "<your token>"
}

authType is one of none, bearer, header or oauth; OAuth goes through a browser consent flow instead of this route. The label is normalised to lowercase letters, digits and dashes, 32 characters at most. What happens next, from mcp_routes.py and client.py:

  • Nothing is stored until a handshake succeeds. A bad URL or token fails at registration, not mid-incident.
  • Transport is detected, not asked. Aurora tries Streamable HTTP, then the older HTTP+SSE transport, the order the MCP spec's backwards compatibility guide describes, and stores whichever worked. A 401 or 403 does not trigger the fallback. It used to: the auth error subclassed the connection error, so a wrong token was retried as SSE and came back as a transport failure.
  • stdio is not supported. Running a command typed into a form, inside the Aurora container, is remote code execution.
  • OAuth uses protected-resource metadata discovery, dynamic client registration and PKCE S256. It sends the resource parameter from the MCP authorization spec on the authorization request and the code exchange, but not on token refresh, where the spec also requires it. The redirect URI is built from FRONTEND_URL, never from the request.
  • Credentials live in your secrets backend (Vault by default), one secret per organization.
  • Scope is the organization. One person registers a server and every member's agent can use it. With OAuth the whole org acts as whoever clicked consent, so use a bot account. Registering needs the connectors:write permission, and since PR 753 an admin can limit a single server (mcp:<label>) to certain roles.

Private network targets and SSRF

A user-supplied URL that the server fetches is a request forgery primitive, and OAuth makes it worse: a hostile server can name a token endpoint at 169.254.169.254. So the guard in net.py runs on the MCP URL and on every OAuth metadata, registration and token endpoint.

What v1.5.31 does: loopback, link-local (including 169.254.169.254), reserved, multicast and unspecified addresses are always refused. Other private ranges such as 10.0.0.0/8 are allowed when MCP_ALLOW_PRIVATE_TARGETS=true, which is the default, and refused when it is false. The setting is true in Compose, in the Helm chart and when the variable is unset, because self-hosted installs keep MCP servers on cluster-internal addresses. Set it to false anywhere you do not trust everyone who holds connectors:write. Every resolved address must pass, so a hostname with one public and one loopback record is refused. The shipped check:

        # Python's is_private includes loopback and link-local (169.254.169.254),
        # so those have to be rejected before the private-address allow.
        if (
            ip.is_loopback
            or ip.is_link_local
            or ip.is_reserved
            or ip.is_multicast
            or ip.is_unspecified
        ):
            raise ValueError(f"{host} resolves to {ip}, which Aurora refuses.")
        if ip.is_private and not private_ok:
            # ...

That comment is there because we got this wrong twice in one afternoon on the pull request branch, before anything merged or shipped. The first design defaulted to false and skipped the check entirely when set to true. Review asked for a default that works on self-hosted clusters, so the default flipped to true: no address check at all out of the box. Our automated PR risk review flagged that commit. The hardening commit that followed tested ip.is_private first, and Python's ipaddress counts 127.0.0.1 and 169.254.169.254 as private, so loopback and the cloud metadata address were still allowed. Our risk review passed that commit; a second automated code review caught the ordering, and the fix above landed 32 minutes later. An allow branch keyed on is_private has to come after the unconditional refusals.

One gap remains. The check is resolve-then-connect: a DNS answer that changes between the check and the request still gets through, and closing that needs a resolver that pins the validated IP.

How are a server's tools exposed to the agent?

Only two tools are registered, whatever you connect: mcp_list_tools and mcp_call_tool. The system prompt gets one line per server with a tool count. Called bare, mcp_list_tools returns servers and counts. With server= or query= it returns up to 25 tools (100 at most), each with a 200-character description and arguments compressed to name:type. With server= and tool= it returns one full JSON Schema. A comment in custom_mcp_tools.py records why listings do not carry schemas: for 25 tools of one hosted server the listing was 38KB, of which 30KB was inputSchema.

The design has a security cost. When each remote tool was its own agent tool, a disallowed tool was never built and the model could not name it. With a dispatcher the model can pass any string, so every rule is enforced by refusing the call, and discovery and invocation share one filter:

    for server in servers_for_user(user_id):
        for tool_def in server.get("tools") or []:
            if not tool_def.get("name"):
                continue
            if not _tool_allowed(server, tool_def, is_background, is_pr_review):
                continue
            # ...
            if ModeAccessController.is_read_only_mode(mode) and not is_read_tool(tool_def):
                continue
            out.append((server, tool_def))

With two filters the agent would be shown tools it is then refused, and retry. Refusals come back as JSON the model can read (unknown_tool, not_permitted, read_only_mode, needs_confirmation_unavailable, missing_arguments) instead of exceptions.

Which custom tools need human approval, and what runs in the background?

Each discovered tool has one of two modes.

ModeIn chatBackground RCA and PR reviewAsk mode
AllowRuns without askingAvailableAvailable if classified as a read
ConfirmAsks you first, showing the tool, server and argumentsNot listed, not callableRefused if classified as a write

We started with three modes (auto, always, never) and a server-wide read-only switch, and cut both before release: there are only two decisions to make, run it or ask first.

The default mode comes from a classification, in store.py:

    if isinstance(tool, dict):
        name = tool.get("name", "")
        annotations = tool.get("annotations")
        if isinstance(annotations, dict):
            if annotations.get("destructiveHint") is True:
                return False
            if annotations.get("readOnlyHint") is True:
                return True
    else:
        name = tool
    return str(name or "").lower().startswith(READ_PREFIXES)

READ_PREFIXES is 21 verbs (get, list, search, query, describe and so on) followed by _ or -. Anything else is a write. Our built-in servers use the opposite rule, a deny list, because we know their naming. A custom tool can be called purge_cache or apply, so an unknown name has to mean Confirm. A tool called restart_deployment or rollback_release lands on Confirm with no configuration.

Three limits of that classifier, stated plainly:

  • The MCP spec says clients "MUST consider tool annotations to be untrusted unless they come from trusted servers". We still use readOnlyHint as a default, because the author usually knows better than a verb guess. A server can lie, and the per-tool override is the only answer to that.
  • An explicit readOnlyHint: false does not force Confirm. Only destructiveHint: true does. A tool annotated as not read-only but named get_... falls through to the name rule and is allowed.
  • A verb is not a guarantee. query_database starts with a read verb and may run any SQL you give it.

In a background investigation the needs_confirmation_unavailable refusal tells the agent to "Report the intended action instead", so the write shows up as a recommendation in the RCA.

What stops prompt injection through MCP tool output?

Not enough. Read this before connecting a server that returns text other people wrote: ticket bodies, log lines, wiki pages.

What Aurora does at v1.5.31:

  • Tool descriptions, the usual tool-poisoning vector, never enter the system prompt. They are capped at 1,000 characters when cached and shown 200 characters at a time in listings.
  • Results are flattened to text, binary content is replaced with [binary content omitted], and anything over 40,000 characters is summarised by a model before the agent sees it (over 400,000 it is truncated first).
  • An injected instruction still has to pass the controls on actions. Confirm tools need a person, and shell and cloud commands go through signature matching, the org command policy and an LLM judge that fails closed (AI agent kubectl safety).

What it does not do:

  • It does not screen custom tool output for injected instructions or mark it as untrusted. The spec's client guidance includes "Validate tool results before passing to LLM"; we do not. Our prompt-injection rail inspects the user's message, not tool results.
  • Allow-mode tools run with no human in the path. Text returned by one server can steer a call to an Allow tool on another, with data in the arguments. Calls are shown in the chat as they run, but nothing holds them.

Our position: Allow is a trust decision about the data a tool returns, not only about whether it writes. A read tool over attacker-writable text deserves Confirm, or a server of its own that background runs cannot see.

What happens when a custom MCP server is slow or down?

Each call opens a new session, with no pooling. The HTTP timeout passed to the transport is 20 seconds, OAuth endpoints get 15, and a result that has not arrived within 60 seconds is discarded. For OAuth servers an expired token is refreshed before the call, and a 401 or 403 triggers one refresh and one retry, never a loop. tools/list pagination stops after 10 pages so a server that repeats a cursor cannot spin forever. Aurora does not poll for tool changes; Refresh tools re-runs discovery and keeps your per-tool modes.

Failure reporting is a current limit. A failed call currently comes back to the agent as an empty result, so the agent cannot tell a failure from no data. The dispatcher has a branch that returns MCP server '<label>' error: ..., but the call runs through a shared helper in mcp_tools.py that ends like this:

        try:
            return future.result(timeout=timeout)  # Configurable timeout
        except concurrent.futures.TimeoutError:
            logging.error(f" MCP operation timed out after {timeout} seconds")
            return []
        except Exception as e:
            logging.error(f" Error in MCP operation: {str(e)}")
            return []

So a timeout, an unreachable server or a rejected token is logged on the Aurora server and reaches the agent as the string []. Errors a server reports inside a result (isError) do arrive, as Tool reported an error: .... This is from reading the released code, not from a running deployment. Until it changes, treat an empty answer from a custom tool as unknown and check the server logs.

What is still unsolved

  • Everything flagged above: failures surfacing as [], no screening of tool output for injected instructions, resource missing on token refresh, and the DNS check-then-connect window.
  • OAuth only works when the authorization server is on the same origin as the MCP server, and only through dynamic client registration. The current spec revision (2026-07-28) marks dynamic registration as deprecated in favour of Client ID Metadata Documents, which we do not implement.
  • Our client opens with the initialize handshake. The 2026-07-28 revision removes that handshake, and its compatibility matrix says a client that only speaks the older form fails against a server that only speaks the new one. We have not tested against such a server.
  • Two parallel OAuth refreshes for the same server can lose a rotated refresh token; the server then needs reconnecting.
  • The connector's unit tests were kept out of the public repo, so CI only asserts RBAC on its routes.

For other agents, see open source AI SRE agents compared and top AI SRE tools.

Try it

  1. Run your MCP server where the Aurora server can reach it, over Streamable HTTP or SSE.
  2. In Aurora open Connectors, then Custom MCP Servers. Enter a Name and the Server URL and click Connect. Paste a token or complete the OAuth pop-up if asked.
  3. Expand the tool list and set anything you do not want run unattended to Confirm.
  4. On a shared or multi-tenant install, set MCP_ALLOW_PRIVATE_TARGETS=false.
  5. For the other direction, create a token under Settings > API Tokens > MCP and point your editor at <AURORA_MCP_URL>/mcp.

Sourcing note. Verified against Aurora v1.5.31 on 2026-12-02: every behaviour above is from the linked files at that tag or from PR 698. MCP protocol statements were checked against modelcontextprotocol.io on the same day. No lab run is behind this post.

Questions

Try Aurora for free

Open source, AI-powered incident management. Deploy in minutes.