Letting Coding Agents In Safely: InfraOrcinus's MCP Server

By Chirag Panchal · Founder & Lead Architect · · 6 min read

How coding agents connect to InfraOrcinus over the Model Context Protocol with machine tokens only, through a fixed, reviewed set of five tools that can read environments and runs and propose changes, but can never approve, apply, delete or touch permissions. Why proposing is allowed and approving never is, and how errors help an agent without leaking internals.

Development Status & Architectural Evolution: InfraOrcinus is in active development. Architecture specifications, internal interfaces, and operational protocols described herein reflect our current engineering design and are continuously refined to make InfraOrcinus robust, resilient, and enterprise-grade.

Coding agents are already writing infrastructure code in people's editors. The next request is obvious: "let it look at the environment, and let it propose the change." The Model Context Protocol (MCP) is the common way to give an agent that kind of access.

The difficulty is that "give an agent access to infrastructure" can mean anything from read a status to delete production. InfraOrcinus's MCP server answers it by being small on purpose. The set of things an agent can do is a short list that was reviewed, and the list is checked by a test so it cannot grow quietly.


1. Five Tools, Fixed by a Manifest

The server offers exactly five tools:

Tool What it does Needs
list_environments Lists the environments the caller can see: id, name, state, provider, project mcp:read
get_change_plan Reads a change plan: waves, status, risk, verification mcp:read
get_run Reads the status of one run mcp:read
propose_change Creates a draft change plan mcp:propose
request_run Requests a run for an environment mcp:propose

The list lives in a manifest in the code. A test compares the tools a client is actually offered with the manifest, and startup checks it too, so adding a sixth tool is a reviewed code change, not a side effect of someone wiring a new handler. There is no tool to approve, apply, destroy, delete, change a credential or edit a permission. They are absent, not forbidden, so there is nothing for a clever prompt to unlock.


2. Machine Tokens Only, With Explicit Scopes

The endpoint accepts machine tokens, not browser sessions. Tokens carry scopes from a closed list, and an unknown scope is rejected when the token is created, never ignored:

  • mcp:read lets an agent read. It sees the three read tools.
  • mcp:propose adds the two tools that start something, and each tool re-checks the scope when it is called.

A token created before scopes existed carries none, so it keeps its role-based access to the existing API and cannot reach the MCP endpoint at all. A read-only agent is a first-class setup: give it mcp:read and it never even sees the propose tools.

Sessions are stateless. Every request is authenticated on its own, so revoking or expiring a token stops it immediately, with no session to linger. The caller is fixed from the authenticated token when the request starts. A value the client sends can never change who it is. Browser requests carrying an Origin header are refused unless that origin is allow-listed, and request bodies are capped at 256 KiB.


3. Proposing Is Allowed, Approving Never Is

The two write tools are designed so that neither is an action with consequences by itself:

  • propose_change creates a change plan in draft. Drafts start nothing. The plan is marked as proposed by an agent, subject to the same limits and validation as a human draft, and it needs a different administrator to approve it before any wave can start. The agent's token owner counts as the drafter, so they cannot approve it either.
  • request_run starts a run, which validates and plans, and then waits for a person to approve the apply in the UI. The tool's answer says so.

So the worst case for a compromised or confused agent is a pile of draft plans and queued plans for a person to reject. It cannot move a change one step past the human gate, because the gate is not reachable through this interface.


4. Scope Applies Here Too

Every tool looks things up through the caller's organization and project scope, the same rule the web UI uses. An environment the token owner cannot see is not found, indistinguishable from one that does not exist, and a change plan is readable only if every environment in it is. An agent can therefore only reason about what a person in its position could see.

Everything an agent does is audited. The trail records an actor type of agent, which token made the call and the proposal it belongs to, so "who proposed this?" has a precise answer later.


5. Errors That Help Without Leaking

Agents recover from errors by reading them, so the messages matter, and they are also the easiest place to leak internals.

  • A caller mistake (a missing id, a malformed argument) is returned verbatim, so the agent can fix its call.
  • Validation errors from the change-plan rules, such as "environment X appears more than once" or "Y must be in an earlier wave", are returned, because they are the information the agent needs to correct a draft.
  • Not found and forbidden have fixed messages.
  • Everything else becomes a generic "the request failed". Database errors, stack traces and paths are never sent to the agent.

6. Using It

  1. Create a machine token with the least scope that does the job: mcp:read to start.
  2. Point the agent's MCP client at the server with that token as its bearer credential. Native MCP clients send no Origin header and are unaffected by the browser rule.
  3. Add mcp:propose only for agents you want drafting plans, and expect a person to review each draft.

Summary

The MCP server gives a coding agent five reviewed tools, three that read and two that propose. Access needs a scoped machine token, runs on the same organization and project scope as the UI, and is audited as an agent. Proposals are drafts and run requests wait for a person, because approving, applying, deleting and changing permissions are simply not on the list.