From 764ba14c5d465d0288acc55a8c4185a10165f986 Mon Sep 17 00:00:00 2001 From: Josh Drake Date: Tue, 17 Nov 2026 17:37:16 -0600 Subject: [PATCH 1/7] Draft the MCP gateway concept and reference pages Add two pages for the MCP gateway, which is in early access: - platform/mcp-gateway.mdx explains what the gateway does, how a request flows, what the device certificate proves, where the OAuth token lives, the three policy modes, what is recorded, and what the gateway does not do. - platform/mcp-gateway-reference.mdx lists the Cedar policy schema and actions, example policies, modes, limits, session and decision values, audit events, timings, roles, agent commands and messages. The pages are not in manifest.json yet, so nothing links to them. Co-Authored-By: Claude Fable 5.2 --- platform/mcp-gateway-reference.mdx | 397 +++++++++++++++++++++++++++++ platform/mcp-gateway.mdx | 199 +++++++++++++++ 2 files changed, 596 insertions(+) create mode 100644 platform/mcp-gateway-reference.mdx create mode 100644 platform/mcp-gateway.mdx diff --git a/platform/mcp-gateway-reference.mdx b/platform/mcp-gateway-reference.mdx new file mode 100644 index 00000000..65507bcb --- /dev/null +++ b/platform/mcp-gateway-reference.mdx @@ -0,0 +1,397 @@ +--- +updated_at: November 17, 2026 +title: MCP Gateway Reference +html_title: Smallstep MCP Gateway Reference for Policies, Sessions, and Errors +description: Reference for the Smallstep MCP gateway. Covers the Cedar policy schema, actions, modes, session and decision values, limits, roles, and error messages. +--- + +This page lists the values, limits, and messages you meet when you run the [Smallstep MCP gateway](./mcp-gateway.mdx). + + +
+The MCP gateway is in early access. +Contact Smallstep to turn it on for your team. +
+
+ +## Policy schema + +Access policies are written in [Cedar](https://www.cedarpolicy.com/) and validated against schema version `2026-09-01`. +The schema is the same for every team. +Every name is in the `Smallstep` namespace. + +### Entities + +The principal of every request is the user. +The device and the MCP client are in the request's context. + +| Entity | Identified by | Attributes | +|---|---|---| +| `Smallstep::User` | The user's email address | `email` | +| `Smallstep::Device` | The device's ID in your inventory | `os`, `os_version`, `ownership`, `assurance`, `lifecycle`, `enrollment`, `tags`, `shared`, and optionally `serial`, `hostname`, `agent_version` | +| `Smallstep::Client` | The MCP client's name | `name`, and optionally `version` | +| `Smallstep::Upstream` | The MCP server's URL | `identifier`, `host` | +| `Smallstep::Tool` | The MCP server's URL, then `#`, then the tool name | `name`, `upstream_host` | +| `Smallstep::Team` | Your team's ID | None | + +In a policy, an MCP server is a `Smallstep::Upstream`. +A tool belongs to its MCP server, so `resource in Smallstep::Upstream::""` matches every tool of that server. + +Device attributes hold the values from your device inventory, in upper case. +`ownership` is `COMPANY_OWNED`, `USER_OWNED`, or `UNKNOWN`. +`assurance` is `HIGH`, `NORMAL`, or `NO_ASSURANCE`. +`tags` is a set of strings, and `shared` is a boolean. + +The MCP client reports its own name and version when it opens a session. +The gateway can't verify them. +A rule on `context.client` separates well-behaved clients, and it isn't a security boundary. + +### Request context + +| Attribute | Value | Present | +|---|---|---| +| `context.device` | The device that presented the certificate | Always | +| `context.client` | The MCP client | When the client reported a name | +| `context.upstream` | The MCP server | Always | +| `context.method` | The JSON-RPC method of the call | Always | +| `context.tool` | A record with the tool's `name` | For `tools/call` | +| `context.session_id` | The gateway's session ID | Always | +| `context.request_id` | The gateway's ID for this call | Always | +| `context.amr` | How the device authenticated. The set contains `"mtls"` | Always | +| `context.source_ip` | The address the connection came from | When known | +| `context.time` | When the gateway evaluated the call | Always | +| `context.protocol_version` | The MCP protocol version the client asked for | When the client sent one | + +A tool call's arguments aren't available to policy. + +### Actions + +The gateway evaluates one action for each JSON-RPC call. +The action is named after the call's method. + +| JSON-RPC method | Action | Resource | +|---|---|---| +| `initialize` | `Smallstep::Action::"initialize"` | The MCP server | +| `tools/list` | `Smallstep::Action::"tools/list"` | The MCP server | +| `resources/list` | `Smallstep::Action::"resources/list"` | The MCP server | +| `resources/templates/list` | `Smallstep::Action::"resources/templates/list"` | The MCP server | +| `prompts/list` | `Smallstep::Action::"prompts/list"` | The MCP server | +| `tools/call` | `Smallstep::Action::"tools/call"` | The tool | +| `resources/read` | `Smallstep::Action::"resources/read"` | The MCP server | +| `prompts/get` | `Smallstep::Action::"prompts/get"` | The MCP server | +| `completion/complete` | `Smallstep::Action::"completion/complete"` | The MCP server | +| Any other method | `Smallstep::Action::"other"` | The MCP server | + +The four list actions are also in the group `Smallstep::Action::"Discovery"`. +Write `action in Smallstep::Action::"Discovery"` to match all of them. + +For `"other"`, `context.method` still holds the method the client sent. + +Notifications aren't evaluated. + +### Rules to know + +- **A session starts with `initialize`, and the policy applies to it.** + A policy set that permits only `tools/call` denies `initialize`, so in Enforce no session can open. + Start from a policy that permits every action, then add `forbid` statements. +- **Cedar denies by default.** + A call goes ahead only when a `permit` statement matches and no `forbid` statement matches. +- **Write the MCP server's URL without a trailing slash.** + The gateway reduces a URL to lower-case scheme and host, no default port, no trailing slash, and no query string. + `https://api.githubcopilot.com/mcp/` is `Smallstep::Upstream::"https://api.githubcopilot.com/mcp"` in a policy. + A statement that names the URL with a trailing slash never matches. +- **Check an optional attribute before you read it.** + Write `context has client && context.client.name == "claude-code"`. + Without the `has` check the statement doesn't pass validation. +- **`resource.name` exists only for `tools/call`.** + For every other action the resource is the MCP server, which has no `name`. +- **Match tools by name.** + The schema declares `read_only`, `destructive`, `idempotent`, and `open_world` on a tool. + The gateway doesn't set them, so don't write rules on them. + +## Example policies + +### The baseline + +The console offers three statements when you choose **Start from the baseline**. +It saves all three and activates only `baseline-allow`. + +Allow everything, as a base for `forbid` statements: + +```text +@id("baseline-allow") +@description("Allow everything; add forbid policies to restrict.") +permit (principal, action, resource); +``` + +Allow tool calls only from company-owned devices with high assurance: + +```text +@id("example-managed-devices-only") +@description("Only company-owned, high-assurance devices may call tools.") +forbid (principal, action == Smallstep::Action::"tools/call", resource) +unless { context.device.ownership == "COMPANY_OWNED" && context.device.assurance == "HIGH" }; +``` + +Make one MCP server read-only for a group of users: + +```text +@id("example-github-read-only-for-contractors") +forbid (principal, action == Smallstep::Action::"tools/call", + resource in Smallstep::Upstream::"https://api.githubcopilot.com/mcp") +when { principal.email like "*@contractor.example" && !(resource.name like "get_*" || resource.name like "list_*" || resource.name like "search_*") }; +``` + +### Block tools by name + +This statement refuses calls to tools on one MCP server whose names start with `save_`, `create_`, `update_`, or `delete_`, for every user: + +```text +@id("linear-block-writes") +@description("Refuse Linear tools whose names start with save_, create_, update_, or delete_.") +forbid ( + principal, + action == Smallstep::Action::"tools/call", + resource in Smallstep::Upstream::"https://mcp.linear.app/mcp" +) +when { + resource.name like "save_*" || + resource.name like "create_*" || + resource.name like "update_*" || + resource.name like "delete_*" +}; +``` + +A statement that matches by name blocks only the names it matches. +Read the MCP server's tool list before you rely on a statement like this one, and check it again when the server adds tools. +To allow a fixed set of tools and refuse the rest, write the statement the way `example-github-read-only-for-contractors` does. + +## Policies, versions, and activations + +| Object | What it is | +|---|---| +| Policy | One Cedar statement. Its `@id` annotation is the policy's ID | +| Version | The text of a policy at one save. Versions never change | +| Activation | A fixed list of policy versions. The gateway evaluates one activation at a time | +| Mode | Off, Monitor, or Enforce, for the whole team | + +Saving a policy creates a new version and changes nothing else. +The gateway evaluates a version only after you activate a set that includes it. +Activating never changes the mode. + +Changing the `@id` in the editor creates a different policy. +A policy can be archived and never deleted. +You can't archive a policy while the live activation includes it. + +### Modes + +| Mode | Calls the policy allows | Calls the policy denies | +|---|---|---| +| Off | Forwarded. No decision is recorded | Forwarded. No decision is recorded | +| Monitor | Forwarded. The decision is recorded | Forwarded. The decision is recorded as "would refuse" | +| Enforce | Forwarded. The decision is recorded | Refused. The decision is recorded as "deny" | + +Off is the starting mode. +A team with no activation behaves as Off, and you can't choose Enforce until you activate a policy set. + +In Enforce, the gateway also refuses a request it can't read as a single JSON-RPC message. +That includes a JSON-RPC batch and a request body larger than 1 MiB. + +If a `forbid` statement fails while it's being evaluated, the gateway denies the call. + +### What a refused call looks like + +The gateway answers a refused call with a JSON-RPC error, so the MCP client receives it as part of the conversation: + +```json +{ + "jsonrpc": "2.0", + "id": 7, + "error": { + "code": -32003, + "message": "denied by policy linear-block-writes for https://mcp.linear.app/mcp tool save_issue", + "data": { + "session_id": "3f2b9c1e-7a54-4d0b-9e61-5c8a2d417f90", + "request_id": "b81d4e06-2c9a-4f37-a5d2-6e0f93c17a48", + "policies": ["linear-block-writes"] + } + } +} +``` + +The message names the `forbid` policies that matched. +When no `permit` statement matched, the message names no policy: `denied by policy for https://mcp.linear.app/mcp`. + +### Limits + +| Item | Limit | +|---|---| +| Statements in one policy | 1 | +| Policy ID | 1 to 128 characters from `A-Z`, `a-z`, `0-9`, `_`, `.`, `:`, `-` | +| Policy text | 65,536 characters | +| Policy description | 1,024 characters | +| Policies in one activation | 256 | +| Request body the gateway evaluates | 1 MiB | +| Captured tool arguments | 4,096 bytes for each call. Larger arguments aren't stored | + +### Messages when a policy doesn't save + +| Message | Cause | +|---|---| +| `policy is missing the required @id("...") annotation` | The statement has no `@id` | +| `policy document must contain exactly one policy, found 2` | The text holds more than one statement | +| `validating policy against schema 2026-09-01: … unrecognized action …` | The action isn't in the table of actions | +| `validating policy against schema 2026-09-01: … attribute name on entity type Smallstep::Upstream not found` | The statement reads `resource.name` for an action other than `tools/call` | +| `validating policy against schema 2026-09-01: … unable to guarantee safety of access to optional attribute …` | The statement reads an optional attribute without a `has` check | +| `ENFORCE requires an activation` | You chose Enforce before activating a policy set | +| `policy is part of the active activation` | You tried to archive a policy the live activation includes | + +## Sessions + +A session is one conversation between an MCP client and an MCP server through the gateway. +It belongs to the user and the device that opened it. + +### Status + +| Status | Meaning | +|---|---| +| active | The session is open | +| ended | The MCP client closed it | +| expired | Nothing was sent for 24 hours, or the MCP server dropped its side | +| revoked | An administrator ended it | +| denied | The session couldn't open. The policy refused it, or the user hasn't approved access to the MCP server yet | +| failed | The MCP server, or the gateway's token exchange, returned an error while the session was opening | + +### End reason + +| End reason | Meaning | +|---|---| +| closed by client | The MCP client ended the session | +| idle timeout | No request for 24 hours | +| upstream gone | The MCP server reported that its session no longer exists | +| revoked | An administrator revoked the session. The console shows who | +| policy deny | The access policy refused the session in Enforce | +| consent required | The user has to approve access to the MCP server first | +| upstream error | The MCP server refused or failed the opening request | +| exchange error | The gateway couldn't get an access token for the MCP server | +| policy unavailable | The gateway couldn't read the team's policy | +| timeout | The session didn't finish opening within 5 minutes | + +### Timeline entries + +| Entry | What it records | +|---|---| +| session | A change in the session's status | +| A method name, such as `tools/call · save_issue` | One call, with the MCP server's HTTP status and the time it took | +| decision | One policy evaluation: the outcome, the policies that determined it, the mode, and whether it was enforced | +| token exchange | The gateway asked for an access token: "token issued" or "exchange failed" | +| consent | The user has to approve access first | + +A call's arguments appear in the timeline only when **Capture tool arguments** is on. +Otherwise the entry shows a hash and the size of the arguments. + +### Revoking a session + +Revoking ends one session. +The next request in that session is refused, and the MCP client has to open a new one. +Revoking doesn't block the user or the device. +To keep someone out, use a `forbid` statement in Enforce, or remove the device from your inventory. + +## Decisions + +| Outcome | Meaning | +|---|---| +| allow | The policy allowed the call | +| would refuse | The policy denied the call, the mode was Monitor, and the call went ahead | +| deny | The policy denied the call, the mode was Enforce, and the call was refused | + +A decision marked "partial" means at least one statement failed while it was being evaluated. + +A decision names the policies that determined it. +Those are the `forbid` statements that matched, or the `permit` statements that matched when no `forbid` did. +A decision with "no matching policy" means no `permit` statement matched. + +Each decision records the activation it was evaluated against, so you can read back the exact policy text that was in force. +A decision record holds IDs and hashes. +It doesn't hold policy text or user attributes. + +## Audit events + +MCP activity appears under **Audit → Events** in the category MCP. + +| Event type | When it's recorded | +|---|---| +| `SESSION_RESOLVED` | The gateway matched a device certificate to a device and a user | +| `SESSION_STARTED` | The MCP server accepted a new session | +| `SESSION_ENDED` | A session ended | +| `CONSENT_REQUIRED` | A user has to approve access to an MCP server | +| `TOKEN_ISSUED` | The token broker returned an access token | +| `TOOL_CALLED` | A tool call passed the policy | +| `POLICY_DECISION` | The gateway evaluated a call in Monitor or Enforce | + +## How quickly changes apply + +| Change | Takes effect within | +|---|---| +| Revoking a session | 10 seconds | +| Changing the mode, activating a policy set, or rolling back | 30 seconds | +| A device leaving your inventory, or its attributes changing | 60 seconds | +| Saving or removing trust roots | The next connection | + +| Item | Lifetime | +|---|---| +| Device certificate for an MCP server | 24 hours, renewed by the agent | +| Link to approve access to an MCP server | 10 minutes | +| Idle session | Expires after 24 hours | +| Sessions, timelines, and decisions | Kept for 30 days after the session ends | + +## Roles + +| Task | Owner | Admin | Device admin | +|---|---|---|---| +| Set or remove trust roots | Yes | Yes | No | +| Add or delete an MCP server | Yes | Yes | No | +| Read sessions, timelines, and decisions under **Audit** | Yes | Yes | Yes | +| Revoke a session | Yes | Yes | No | +| Save or archive a policy, activate a set, change the mode | Yes | Yes | No | + +## Commands on the device + +| Command | What it does | +|---|---| +| `step-agent mcp proxy --upstream ` | Runs the agent's MCP proxy for one MCP server. An MCP client starts this command as a local MCP server | +| `step-agent mcp tools list --upstream ` | Opens a session through the gateway and lists the MCP server's tools. Use it to check the whole path from a device | + +`` is the **Upstream** value of the MCP server in the console, such as `linear`. +It has to match exactly, including case. + +### Messages from the agent + +| Message | Cause | What to do | +|---|---|---| +| `consent required: open to authorize this upstream` | The user hasn't approved access to this MCP server | Open the link, approve, and try again. Each user does this once for each MCP server | +| `denied by policy for ` | The access policy refused the session or the call, and no `permit` statement matched | Check that the live activation permits `initialize`, and read the decision under **Audit → Decisions** | +| `denied by policy for tool ` | A `forbid` statement refused the call | Read the decision under **Audit → Decisions** | +| `no MCP proxy configured for upstream ""` | The device has no MCP server with that **Upstream** value | Check the value in the console, and wait for the agent to pick up new configuration | +| `endpoint "" has no usable certificate` | The agent doesn't have a certificate for this MCP server yet | Check the device's assurance level and that it has a user assigned | + +When a user opens the approval link for an MCP server that has no OAuth client, the page says `this upstream is not configured for your tenant`. +Delete the MCP server in the console and add it again with the client ID and client secret of your OAuth app. + +## Catalog entries + +The catalog fills in the form when you add an MCP server. +Use the URL in the last column when you name the server in a policy. + +| Catalog entry | Upstream | URL in a policy | +|---|---|---| +| GitHub | `github` | `https://api.githubcopilot.com/mcp` | +| Linear | `linear` | `https://mcp.linear.app/mcp` | +| Notion | `notion` | `https://mcp.notion.com/mcp` | +| Slack | `slack` | `https://mcp.slack.com/mcp` | +| Sentry | `sentry` | `https://mcp.sentry.dev/mcp` | +| Figma | `figma` | `https://mcp.figma.com/mcp` | +| Atlassian Jira | `jira` | `https://mcp.atlassian.com/v1/mcp/authv2` | +| Stripe | `stripe` | `https://mcp.stripe.com` | + +Choose **Custom** to add any other MCP server that uses OAuth. diff --git a/platform/mcp-gateway.mdx b/platform/mcp-gateway.mdx new file mode 100644 index 00000000..77f4c36a --- /dev/null +++ b/platform/mcp-gateway.mdx @@ -0,0 +1,199 @@ +--- +updated_at: November 17, 2026 +title: MCP Gateway +html_title: How the Smallstep MCP Gateway Protects MCP Servers with Device Identity +description: Learn how the Smallstep MCP gateway replaces API keys in AI agent configurations with hardware-attested device certificates, brokered OAuth tokens, access policy, and an audit trail. +--- + +The Smallstep MCP gateway puts the Model Context Protocol (MCP) servers your team uses behind device identity. +An AI agent on an enrolled device reaches an MCP server, such as GitHub or Linear, through the gateway. +It proves itself with the device's certificate, and no API key is stored on the laptop. +The gateway records every session and tool call, and it can apply an access policy to each call. + + +
+The MCP gateway is in early access. +Contact Smallstep to turn it on for your team. +
+
+ +## The problem it solves + +An MCP client such as Claude Code usually authenticates to an MCP server with a personal access token or an OAuth token that sits in a configuration file on the laptop. +That token proves who the user is. +It doesn't prove which device is using it. +Anyone who copies the token can use it from another machine, and you have no record of what an agent did with it. + +The MCP gateway changes three things: + +- **No API key on the laptop.** + The MCP client's configuration holds a command that starts the Smallstep Agent, and nothing else. + The device's certificate opens the connection, and its private key can't be copied off the device. +- **A record of what agents do.** + Each connection is a session tied to a user, a device, and an MCP client. + You can read every call in it, and end the session. +- **Policy on every call.** + You write rules about which users, devices, and clients may call which tools. + You can watch what a rule would refuse before you enforce it. + +## How a request flows + +```mermaid +sequenceDiagram + participant Client as MCP client + participant Agent as Smallstep Agent + participant Gateway as MCP gateway + participant Broker as Token broker + participant Server as MCP server + Client->>Agent: Start the agent's MCP proxy + Agent->>Gateway: Connect with the device certificate (mutual TLS) + Gateway->>Gateway: Verify the certificate, find the device and user, evaluate policy + Gateway->>Broker: Ask for the user's access token + Broker->>Gateway: OAuth access token for this MCP server + Gateway->>Server: Forward the request with the access token + Server->>Client: Response, relayed through the gateway and the agent +``` + +1. The MCP client starts the Smallstep Agent's MCP proxy as a local MCP server. + The client's configuration names that command. + It holds no token and no URL. +2. The agent opens a mutual TLS connection to your team's gateway endpoint and presents the device's certificate. + The private key stays in the device's TPM or Secure Enclave. +3. The gateway checks that the certificate chains to your team's trust roots. + It finds the device in your device inventory and reads the user from the certificate. + A device that isn't active in the inventory is refused. +4. The gateway evaluates your access policy when the client opens a session, and again on every call in that session. +5. The gateway asks the token broker for the user's OAuth access token for that MCP server, and forwards the request with it. +6. The MCP server answers as it would for any authorized client. + It receives the user's access token and never sees the device certificate. + +Mutual TLS protects the connection between the device and the gateway. +The connection from the gateway to the MCP server uses TLS and the user's access token. + +## The parts + +**MCP server.** +The service an agent calls, such as the GitHub or Linear MCP server, or one you host. +You publish an MCP server through the gateway in the Smallstep console under **Protect → MCP Proxies**. +The console calls each entry an MCP proxy. + +**MCP gateway.** +The endpoint that verifies device certificates and forwards requests. +Each team has its own gateway endpoint, shown under **Protect → MCP Gateway**. + +**Trust roots.** +The certificate authority (CA) certificate the gateway uses to verify device certificates. +You set it once for the team. + +**Device credential.** +When you add an MCP server, Smallstep creates a credential for it. +The Smallstep Agent on each device requests a certificate from that credential and renews it without anyone's help. +The certificate is valid for 24 hours. + +**The agent's MCP proxy.** +A command in the [Smallstep Agent](./smallstep-agent.mdx) that an MCP client runs as a local MCP server. +It relays the client's requests to the gateway over the agent's connection. + +**Token broker.** +The service that holds each user's OAuth grant for each MCP server and hands the gateway an access token when it needs one. + +**Session.** +One conversation between an MCP client and an MCP server through the gateway. +A session belongs to the user and the device that opened it. + +**Access policy.** +The rules that decide whether a call may go ahead, written in [Cedar](https://www.cedarpolicy.com/). + +**Decision.** +The recorded outcome of evaluating the access policy for one call. + +## What the device proves + +The certificate a device presents to the gateway comes from a **hardware-attested** key. +That is a stronger claim than a hardware-bound key. + +- A **hardware-bound** key is generated inside the device's TPM or Secure Enclave and can't be exported. + The device can use the key, and nobody can copy it to another machine. +- A **hardware-attested** key is hardware-bound, and the hardware has proven it. + Before Smallstep issues the certificate, the secure hardware gives the CA cryptographic evidence that it generated the key and holds it. + The CA issues the certificate only when that evidence checks out for a device it knows. + +Without attestation, a certificate request says where the key lives, and the CA has to take the device's word for it. +With attestation, the CA has verified it. +[Core Concepts](./core-concepts.mdx#device-attestation) explains device attestation in more depth. + +Smallstep issues a certificate for an MCP server only to a device with high assurance in your inventory. +The gateway reads the user from the certificate, so the device also needs a user assigned. + +The gateway relies on the device inventory and the user assignments you already have in Smallstep. +It works the same way whichever MDM and identity provider those come from. + +## Where the OAuth token lives + +MCP servers still authorize people with OAuth. +The gateway moves the token off the device. + +The first time a person uses an MCP server through the gateway, they get a link to approve access in their browser. +They sign in to the MCP server's provider and approve, as they would for any OAuth app. +The resulting grant goes to the token broker. +The broker encrypts it with a key that belongs to your team. + +After that, the gateway gets the access token from the broker and adds it to each request on the way to the MCP server. +The token never reaches the device, the agent, or the MCP client. + +Each team uses its own OAuth app for each MCP server. +You register the app with the provider and give its client ID and client secret to Smallstep when you add the MCP server. + +## Access policy + +An access policy is a set of Cedar statements. +A statement can refer to the user, the device and its inventory attributes, the MCP client, the MCP server, and the tool being called. + +The gateway evaluates the policy in one of three modes: + +- **Off.** Nothing is evaluated. This is the starting mode. +- **Monitor.** Every call is evaluated and the decision is recorded. Nothing is refused. +- **Enforce.** Every call is evaluated and recorded, and a call the policy denies is refused. + +Monitor shows you what a policy would refuse, on real traffic, before you turn on Enforce. + +A refused call returns an error to the MCP client inside the MCP conversation. +The agent can read it and tell the person that their organization's policy blocked the call. + +The [MCP gateway reference](./mcp-gateway-reference.mdx) lists what a policy can refer to. + +## What is recorded + +- **Sessions.** + Who connected, from which device, with which MCP client, to which MCP server, and when the session ended and why. +- **A timeline for each session.** + Each call, each policy decision, and each token exchange, in order. +- **Decisions.** + The outcome of each policy evaluation, the policy that determined it, and the exact set of policy versions in force. +- **Events.** + MCP activity also appears in your team's audit events, next to device and certificate events. + +Sessions and their timelines are recorded in every mode, including Off. +Decisions are recorded in Monitor and Enforce. + +By default the gateway keeps a hash and the size of a tool call's arguments, and not the arguments themselves. +You can turn on argument capture for your team to store them. + +## What the gateway doesn't do + +- **It doesn't make an enrolled device safe to compromise.** + The gateway stops a copied credential from working anywhere else. + It doesn't stop prompt injection, a malicious MCP server, or software already running on an enrolled device from using that device's access. +- **It doesn't reach agents that run somewhere else.** + The MCP client has to run on the enrolled device and start the agent's MCP proxy there. + An agent hosted in a vendor's cloud can't present your device's certificate. +- **It doesn't stop someone from going around it.** + A person can still connect an MCP client directly to an MCP server with a token of their own. + Preventing that depends on the controls the MCP server and the MCP client offer. +- **Ending a session doesn't remove access.** + Revoking a session disconnects it. + The MCP client can open a new session if the device is still active and the policy allows it. + +## Next steps + +- [MCP gateway reference](./mcp-gateway-reference.mdx): the policy schema, the values a session or a decision can have, limits, and error messages. From 6f77c73f4fbf0dec6f0ed9a6df30a6737e07e043 Mon Sep 17 00:00:00 2001 From: Josh Drake Date: Tue, 17 Nov 2026 17:39:50 -0600 Subject: [PATCH 2/7] Start the MCP server setup guide and tighten the reference page Add tutorials/protect-mcp-servers.mdx with the steps checked on a test team: set the gateway's trust roots, register an OAuth app, add the MCP server, and approve access from a device. The steps that follow approval (a successful tool list and an MCP client) are not written yet, because they have not been run. In the reference page: - Show audit events by the labels the console displays. - Replace the IDs in the refused-call example with made-up values. - Separate the three baseline statements from the example that blocks tools by name, and say what a name match does not cover. - Reduce the roles table to what each role can do in the console. Co-Authored-By: Claude Fable 5.2 --- platform/mcp-gateway-reference.mdx | 18 ++-- tutorials/protect-mcp-servers.mdx | 142 +++++++++++++++++++++++++++++ 2 files changed, 151 insertions(+), 9 deletions(-) create mode 100644 tutorials/protect-mcp-servers.mdx diff --git a/platform/mcp-gateway-reference.mdx b/platform/mcp-gateway-reference.mdx index 65507bcb..a8956837 100644 --- a/platform/mcp-gateway-reference.mdx +++ b/platform/mcp-gateway-reference.mdx @@ -319,15 +319,15 @@ It doesn't hold policy text or user attributes. MCP activity appears under **Audit → Events** in the category MCP. -| Event type | When it's recorded | -|---|---| -| `SESSION_RESOLVED` | The gateway matched a device certificate to a device and a user | -| `SESSION_STARTED` | The MCP server accepted a new session | -| `SESSION_ENDED` | A session ended | -| `CONSENT_REQUIRED` | A user has to approve access to an MCP server | -| `TOKEN_ISSUED` | The token broker returned an access token | -| `TOOL_CALLED` | A tool call passed the policy | -| `POLICY_DECISION` | The gateway evaluated a call in Monitor or Enforce | +| Type | Message | When it's recorded | +|---|---|---| +| Session resolved | device session resolved | The gateway matched a device certificate to a device and a user. One connection can record this more than once | +| Session started | session started | The MCP server accepted a new session | +| Session ended | session, then the final status, such as "session denied" | A session ended | +| Consent required | consent required | A user has to approve access to an MCP server | +| Token issued | provider token issued | The token broker returned an access token | +| Tool called | tool call, then the tool name | A tool call passed the policy | +| Policy decision | policy allow or policy deny, then the method and tool | The gateway evaluated a call in Monitor or Enforce | ## How quickly changes apply diff --git a/tutorials/protect-mcp-servers.mdx b/tutorials/protect-mcp-servers.mdx new file mode 100644 index 00000000..15710adf --- /dev/null +++ b/tutorials/protect-mcp-servers.mdx @@ -0,0 +1,142 @@ +--- +updated_at: November 17, 2026 +title: Protect MCP Servers +html_title: Protect MCP Servers with Device Identity and the Smallstep MCP Gateway +description: Put an MCP server such as Linear behind the Smallstep MCP gateway, so AI agents on enrolled devices connect with a hardware-attested device certificate and no API key on the laptop. +--- + +This guide shows how to put a Model Context Protocol (MCP) server behind the Smallstep MCP gateway. +When you finish, an AI agent on an enrolled device reaches the MCP server with the device's certificate. +The MCP client's configuration holds no API key. + +The guide uses Linear as the example. +The steps are the same for the other MCP servers in the console's catalog. + +[MCP Gateway](../platform/mcp-gateway.mdx) explains how the parts fit together. + + +
+ The MCP gateway is in early access. + Contact Smallstep to turn it on for your team. + This guide was tested with Smallstep Agent 0.70.0 on Linux. +
+
+ +## Before you begin + +You will need: + +- The MCP gateway turned on for your team. +- The Owner or Admin role in Smallstep. +- A device enrolled in Smallstep with the [Smallstep Agent](../platform/smallstep-agent.mdx) 0.70.0 or later. + The device needs high assurance and a user assigned. +- An account with the MCP server's provider that can register an OAuth app. + For Linear, that is a workspace admin. + +# Step 1: Configure the gateway + +The gateway accepts a device only when its certificate chains to your team's trust roots. +Set the trust roots once for the team. + +## Download the root certificate + +MCP server certificates come from your team's Accounts authority. + +1. In Certificate Manager, go to [Authorities](https://smallstep.com/app/?next=/cm/authorities). +2. Select the Accounts authority. +3. Download the **Root Certificate**. + +## Save the trust roots + +1. In the Smallstep console, go to **Protect → MCP Gateway**. +2. Under **Device trust roots**, upload the root certificate. + You can also paste its text. +3. If the file holds more than one certificate, the console asks you to pick one. + Pick the certificate marked **Root**. +4. Choose **Save trust roots**. + +The same page shows your team's **Gateway endpoint**. +Devices connect to this host. +You don't need to copy it, because the agent receives it with each MCP server you add. + +# Step 2: Add an MCP server + +The gateway forwards each request with the user's own OAuth access token. +To get those tokens, Smallstep needs an OAuth app that your team registers with the MCP server's provider. + +## Start the form + +1. In the Smallstep console, go to **Protect → MCP Proxies** and choose **Add MCP proxy**. +2. Under **Pick an MCP server**, choose **Linear**. + The card fills in the name, the **Upstream** value, the MCP server's URL, and the provider's OAuth settings. +3. Under **Provider OAuth client**, copy the callback URL. + +Keep the form open. + +## Register an OAuth app + +1. On the Linear card, follow **Register an OAuth app**. + It opens the provider's page for new OAuth apps. +2. Create an app, and set its redirect or callback URL to the URL you copied. +3. Copy the app's client ID and client secret. + +## Finish the form + +1. Back in the Smallstep console, enter the **Client ID** and the **Client secret**. +2. Leave the other fields as the card set them. +3. Choose **Add MCP proxy**. + + +
+ Enter both the client ID and the client secret before you save. + Without them, nobody can approve access to the MCP server. + You can't edit an MCP server after you add it. + To change a setting, delete the MCP server and add it again. +
+
+ +Smallstep creates a credential for the MCP server. +The Smallstep Agent on each of your team's devices requests a certificate from it and keeps the certificate renewed. +A device can take a few minutes to receive a new MCP server. + +Note the **Upstream** value, `linear` in this example. +Commands on the device use it to name the MCP server. + +# Step 3: Configure clients + +## Check that the device has its certificate + +On an enrolled device, run: + +```bash +step-agent status +``` + +The MCP server appears by name with a check mark once the agent has its certificate: + +```text +Linear (mcp-linear) ✔ +``` + +## Approve access to the MCP server + +Each person approves access once for each MCP server. +On the device, run: + +```bash +step-agent mcp tools list --upstream linear +``` + +The first time, the command stops and prints a link: + +```text +consent required: open https://… to authorize this upstream +``` + +1. Open the link in a browser. + The link is valid for 10 minutes. +2. Sign in to the provider and approve access for the OAuth app. +3. Run the command again. + +If the link shows `this upstream is not configured for your tenant`, the MCP server has no OAuth client. +Delete it under **Protect → MCP Proxies** and add it again with the client ID and client secret. From e221ac5049d8d6844b992016b1f4ac69bb199c54 Mon Sep 17 00:00:00 2001 From: Josh Drake Date: Tue, 17 Nov 2026 17:52:32 -0600 Subject: [PATCH 3/7] Finish the MCP setup guide and add the policy and audit guides Complete tutorials/protect-mcp-servers.mdx with the steps after a person approves access: the tool list, connecting Claude Code, finding the session, and common problems. Add tutorials/mcp-gateway-policy.mdx, which takes one policy from the baseline through Monitor to Enforce and back, and tutorials/mcp-gateway-audit.mdx, which covers sessions, timelines, decisions, events, argument capture, and ending a session. Every step was run on a test team with Smallstep Agent 0.70.0 and Claude Code on Linux. The reference page now records what that run showed: how a refused call reads in a timeline, what the agent prints after a session is revoked, and when a token exchange entry is absent. Co-Authored-By: Claude Fable 5.2 --- platform/mcp-gateway-reference.mdx | 13 +- platform/mcp-gateway.mdx | 3 + tutorials/mcp-gateway-audit.mdx | 170 +++++++++++++++++++++++ tutorials/mcp-gateway-policy.mdx | 211 +++++++++++++++++++++++++++++ tutorials/protect-mcp-servers.mdx | 83 ++++++++++++ 5 files changed, 478 insertions(+), 2 deletions(-) create mode 100644 tutorials/mcp-gateway-audit.mdx create mode 100644 tutorials/mcp-gateway-policy.mdx diff --git a/platform/mcp-gateway-reference.mdx b/platform/mcp-gateway-reference.mdx index a8956837..4bbfd30e 100644 --- a/platform/mcp-gateway-reference.mdx +++ b/platform/mcp-gateway-reference.mdx @@ -273,8 +273,8 @@ It belongs to the user and the device that opened it. | policy deny | The access policy refused the session in Enforce | | consent required | The user has to approve access to the MCP server first | | upstream error | The MCP server refused or failed the opening request | -| exchange error | The gateway couldn't get an access token for the MCP server | -| policy unavailable | The gateway couldn't read the team's policy | +| `exchange_error` | The gateway couldn't get an access token for the MCP server | +| `policy_unavailable` | The gateway couldn't read the team's policy | | timeout | The session didn't finish opening within 5 minutes | ### Timeline entries @@ -287,6 +287,13 @@ It belongs to the user and the device that opened it. | token exchange | The gateway asked for an access token: "token issued" or "exchange failed" | | consent | The user has to approve access first | +A decision entry comes before the call it decided. +An allowed call reads "not enforced" in every mode. +A call the gateway refused reads "enforced", and its call entry reads "no upstream response". + +The gateway keeps a user's access token for up to 60 seconds. +A session that opens within that time has no token exchange entry. + A call's arguments appear in the timeline only when **Capture tool arguments** is on. Otherwise the entry shows a hash and the size of the arguments. @@ -294,6 +301,7 @@ Otherwise the entry shows a hash and the size of the arguments. Revoking ends one session. The next request in that session is refused, and the MCP client has to open a new one. +The agent's MCP proxy on the device stops with the message `session not found`. Revoking doesn't block the user or the device. To keep someone out, use a `forbid` statement in Enforce, or remove the device from your inventory. @@ -372,6 +380,7 @@ It has to match exactly, including case. | `consent required: open to authorize this upstream` | The user hasn't approved access to this MCP server | Open the link, approve, and try again. Each user does this once for each MCP server | | `denied by policy for ` | The access policy refused the session or the call, and no `permit` statement matched | Check that the live activation permits `initialize`, and read the decision under **Audit → Decisions** | | `denied by policy for tool ` | A `forbid` statement refused the call | Read the decision under **Audit → Decisions** | +| `failed to connect (session ID: ): session not found` | The session was revoked, or it expired | Start the MCP server again in the MCP client. The client opens a new session | | `no MCP proxy configured for upstream ""` | The device has no MCP server with that **Upstream** value | Check the value in the console, and wait for the agent to pick up new configuration | | `endpoint "" has no usable certificate` | The agent doesn't have a certificate for this MCP server yet | Check the device's assurance level and that it has a user assigned | diff --git a/platform/mcp-gateway.mdx b/platform/mcp-gateway.mdx index 77f4c36a..a9b92c8d 100644 --- a/platform/mcp-gateway.mdx +++ b/platform/mcp-gateway.mdx @@ -196,4 +196,7 @@ You can turn on argument capture for your team to store them. ## Next steps +- [Protect MCP Servers](../tutorials/protect-mcp-servers.mdx): put an MCP server behind the gateway and connect an MCP client. +- [Control MCP access with policy](../tutorials/mcp-gateway-policy.mdx): write a policy, watch what it would refuse, and enforce it. +- [Audit MCP activity](../tutorials/mcp-gateway-audit.mdx): read sessions, timelines, and decisions, and end a session. - [MCP gateway reference](./mcp-gateway-reference.mdx): the policy schema, the values a session or a decision can have, limits, and error messages. diff --git a/tutorials/mcp-gateway-audit.mdx b/tutorials/mcp-gateway-audit.mdx new file mode 100644 index 00000000..aeb402b6 --- /dev/null +++ b/tutorials/mcp-gateway-audit.mdx @@ -0,0 +1,170 @@ +--- +updated_at: November 17, 2026 +title: Audit MCP Activity +html_title: Audit AI Agent Activity Through the Smallstep MCP Gateway +description: Read MCP sessions, per-call timelines, policy decisions, and audit events for AI agents that reach MCP servers through the Smallstep MCP gateway, and end a session. +--- + +The Smallstep MCP gateway records what AI agents do with the MCP servers behind it. +This guide shows where to find those records in the Smallstep console and how to end a session. + + +
+ The MCP gateway is in early access. + Contact Smallstep to turn it on for your team. +
+
+ +## Before you begin + +You will need: + +- An MCP server behind the gateway. + See [Protect MCP Servers](./protect-mcp-servers.mdx). +- The Owner, Admin, or Device Admin role in Smallstep. + Only an Owner or Admin can end a session. + +## What is recorded + +The **Audit** page in the Smallstep console has three tabs: + +| Tab | What it shows | Recorded when | +|---|---|---| +| **Sessions** | One row for each connection between an MCP client and an MCP server, with a timeline of its calls | Always | +| **Decisions** | The outcome of each policy evaluation | The policy mode is Monitor or Enforce | +| **Events** | MCP activity next to your team's device and certificate events | Always | + +The gateway keeps sessions, timelines, and decisions for 30 days after a session ends. + +# Read sessions + +In the Smallstep console, go to **Audit → Sessions**. + +Each row is one session. +A session belongs to the user and the device that opened it. + +| Column | What it shows | +|---|---| +| **Status** | Whether the session is active, and how it ended | +| **Principal** | The user's email address, read from the device certificate | +| **Device · client** | The device, and the name and version the MCP client reported, such as `claude-code 2.1.327` | +| **Resource** | The MCP server's host | +| **End reason** | Why the session ended, such as "closed by client" or "consent required" | +| **Events** | The number of entries in the session's timeline | + +Search by user, device, or host, and filter by status. + +The MCP client reports its own name and version. +The gateway can't verify them. + +The [MCP gateway reference](../platform/mcp-gateway-reference.mdx#sessions) explains each status and end reason. + +## Read a session's timeline + +Select a session to open its timeline. +The timeline lists what happened in the session, in order: + +```text +decision · initialize allow baseline-allow · Monitor · not enforced +token exchange token issued · → mcp.linear.app +session active +initialize HTTP 200 · 375 ms +decision · tools/call · search_documentation allow baseline-allow · Monitor · not enforced +tools/call · search_documentation HTTP 200 · 1109 ms +session ended · closed by client +``` + +| Entry | What it records | +|---|---| +| A method name, such as `tools/call · save_issue` | One call, with the MCP server's HTTP status and the time it took | +| **decision** | The policy's outcome for the call that follows it, the policy that determined it, and the mode | +| **token exchange** | The gateway got the user's access token for the MCP server | +| **consent** | The user has to approve access to the MCP server first | +| **session** | A change in the session's status | + +Decision entries appear only when the policy mode is Monitor or Enforce. + +A call that the gateway refused reads **no upstream response**, because the call never reached the MCP server. +The decision before it reads **deny** and **enforced**. + +While a session is active, the timeline updates as new calls arrive. + +## Record tool arguments + +By default, the timeline shows a hash and the size of a tool call's arguments. +It doesn't show the arguments. + +To store the arguments: + +1. Go to **Protect → MCP Gateway**. +2. Under **Mode**, turn on **Capture tool arguments**. + +The timeline then shows the arguments of each tool call, up to 4 KiB for each call. +Arguments larger than that aren't stored. + +Tool arguments can hold sensitive data, such as the text of an issue or a search query. +Turn capture on only if your team may store that data. + +# Read decisions + +Go to **Audit → Decisions**. + +The line at the top counts the decisions in the time range, by outcome. +When the mode is Monitor, it also says how many calls Enforce would have refused. + +| Outcome | Meaning | +|---|---| +| **allow** | The policy allowed the call | +| **would refuse** | The policy denied the call, the mode was Monitor, and the call went ahead | +| **deny** | The policy denied the call, the mode was Enforce, and the call was refused | + +Each row shows the policy that determined the outcome, the MCP server and tool, the user, and the mode. +A row that reads **no matching policy** means no `permit` statement matched the call. + +Select a row to see more: + +- The user, the device, the session, the MCP client, the tool, and the method. +- The policies that determined the outcome. +- The activation that was in force, so you can read back the exact policy text. + +A decision record holds IDs and hashes. +It doesn't hold policy text or user attributes. + +# Read events + +Go to **Audit → Events** and filter by the category **MCP**. + +MCP events sit in the same list as your team's other events. +You can read a device's enrollment, its certificates, and its MCP sessions in one place. + +| Type | When it's recorded | +|---|---| +| Session resolved | The gateway matched a device certificate to a device and a user | +| Session started | The MCP server accepted a new session | +| Session ended | A session ended | +| Consent required | A user has to approve access to an MCP server | +| Token issued | The gateway got an access token for the MCP server | +| Tool called | A tool call passed the policy | +| Policy decision | The gateway evaluated a call in Monitor or Enforce | + +# End a session + +1. Go to **Audit → Sessions**. +2. On an active session, choose **Revoke**. +3. Choose **Revoke session**. + +The gateway refuses the session's next request within 10 seconds. +The agent's MCP proxy on the device stops with the message `session not found`, and the MCP client has to start it again. + + +
+ Revoking ends one session. + It doesn't block the user or the device, and the MCP client can open a new session. + To keep someone out, use a forbid statement in Enforce, or remove the device from your inventory. +
+
+ +# Next steps + +- [Control MCP access with policy](./mcp-gateway-policy.mdx): decide which calls the gateway allows. +- [MCP gateway reference](../platform/mcp-gateway-reference.mdx): every status, end reason, and message. diff --git a/tutorials/mcp-gateway-policy.mdx b/tutorials/mcp-gateway-policy.mdx new file mode 100644 index 00000000..54fe9fbc --- /dev/null +++ b/tutorials/mcp-gateway-policy.mdx @@ -0,0 +1,211 @@ +--- +updated_at: November 17, 2026 +title: Control MCP Access with Policy +html_title: Control Which Users, Devices, and Tools Can Use MCP Servers with Cedar Policy +description: Write a Cedar access policy for the Smallstep MCP gateway, watch what it would refuse in Monitor mode, then enforce it and roll back if you need to. +--- + +The Smallstep MCP gateway can evaluate an access policy on every call an AI agent makes to an MCP server. +A policy can refer to the user, the device, the MCP client, the MCP server, and the tool. + +This guide takes one policy from a draft to enforcement. +You start from a baseline that allows everything, add a statement that refuses some tools, watch what it would refuse, and then enforce it. + + +
+ The MCP gateway is in early access. + Contact Smallstep to turn it on for your team. +
+
+ +## Before you begin + +You will need: + +- An MCP server behind the gateway, and a device that can reach it. + See [Protect MCP Servers](./protect-mcp-servers.mdx). +- The Owner or Admin role in Smallstep. + +This guide uses Linear as the MCP server. + +## How policy works + +A policy is one [Cedar](https://www.cedarpolicy.com/) statement. +A `permit` statement allows calls, and a `forbid` statement refuses them. +A call goes ahead only when a `permit` statement matches it and no `forbid` statement does. + +Three things decide what happens to a call: + +- **The policies you saved.** + Saving a policy doesn't change what the gateway does. +- **The activation.** + An activation is the set of policies the gateway evaluates. + You choose which policies are in it. +- **The mode.** + In **Off**, the gateway evaluates nothing. + In **Monitor**, it evaluates every call and records the decision, and refuses nothing. + In **Enforce**, it refuses the calls the policy denies. + +You find all three in the Smallstep console under **Protect → MCP Gateway**. + +# Step 1: Start from the baseline + +1. In the Smallstep console, go to **Protect → MCP Gateway**. +2. Under **Policies**, choose **Start from the baseline**. + +The console saves three policies and activates one of them: + +- `baseline-allow` permits every call. + It is active. +- `example-managed-devices-only` and `example-github-read-only-for-contractors` are examples of `forbid` statements. + They are saved and not active. + +The mode doesn't change. + + +
+ Keep a policy that permits every action in your activation, and restrict with forbid statements. + The policy applies to the call that opens a session, as well as to tool calls. + The policy editor's starter template permits tool calls only. + If that template is the only active policy, Enforce refuses every session. +
+
+ +# Step 2: Turn on Monitor + +Under **Mode**, choose **Monitor**. + +The change saves at once, and the gateway applies it within 30 seconds. +From then on, the gateway records a decision for every call. +It doesn't refuse anything. + +# Step 3: Write a policy + +1. Under **Policies**, choose **New policy**. +2. Replace the text under **Cedar** with your statement. +3. Check the line under the editor. + It reads `Parsed as @id("…")` when the statement is valid. + Otherwise it shows **Cedar does not compile** and the reason. +4. Choose **Save policy**. + +This example refuses Linear tools whose names start with `save_`, `create_`, `update_`, or `delete_`: + +```text +@id("linear-block-writes") +@description("Refuse Linear tools whose names start with save_, create_, update_, or delete_.") +forbid ( + principal, + action == Smallstep::Action::"tools/call", + resource in Smallstep::Upstream::"https://mcp.linear.app/mcp" +) +when { + resource.name like "save_*" || + resource.name like "create_*" || + resource.name like "update_*" || + resource.name like "delete_*" +}; +``` + +Three rules apply to every statement: + +- The `@id` annotation is the policy's ID. + If you change it, you create a different policy. +- One policy holds one statement. +- Write the MCP server's URL without a trailing slash. + A statement that names the URL with a trailing slash never matches. + + +
+ This statement matches tools by name, so it refuses only the names it matches. + An MCP server can have other tools that change data. + Run step-agent mcp tools list --upstream linear on a device to read the tool names before you rely on a statement like this one. +
+
+ +The [MCP gateway reference](../platform/mcp-gateway-reference.mdx#policy-schema) lists everything a statement can refer to. + +# Step 4: Activate the policy + +Saving a policy doesn't activate it. + +1. Go back to **Protect → MCP Gateway**. +2. Under **Activation**, select `baseline-allow` and `linear-block-writes`. + The line below the list reads `2 selected · 1 permit · 1 forbid`. +3. Choose **Activate**. + +The console confirms that the new activation is live and that the mode is unchanged. +Because the mode is Monitor, nothing is refused yet. + +# Step 5: See what the policy would refuse + +## Simulate one call + +1. Under **Policies**, choose **Simulate**. +2. Enter a user's email address and a device. + For the device, paste its ID from the device's page under **Devices**. +3. For **Upstream URL**, enter `https://mcp.linear.app/mcp`. +4. Leave **Method** as `tools/call`, and enter `save_issue` for **Tool**. +5. Choose **Run**. + +The result shows the outcome, the mode, and the policies that determined it. +The simulator uses the device's attributes from your inventory, and it records nothing. + +## Watch real calls + +Use the MCP server from an MCP client for a while. +Then go to **Audit → Decisions**. + +A call that the policy denied in Monitor has the outcome **would refuse**. +The call still went ahead. +The line above the table counts them: + +```text +Enforcing would have refused 1 of 21 calls in the last 24 hours. +``` + +Select a decision to see the user, the device, the MCP client, the tool, and the policy that determined the outcome. + +# Step 6: Enforce the policy + +1. Go to **Protect → MCP Gateway**. +2. Under **Mode**, choose **Enforce**. +3. Read the confirmation, which names the activation the gateway will enforce, and choose **Enforce**. + +The gateway applies the change within 30 seconds. + +A refused call returns an error to the MCP client. +The message names the policy: + +```text +denied by policy linear-block-writes for https://mcp.linear.app/mcp tool save_issue +``` + +Claude Code shows this message to the model, so the agent can tell the person that a policy blocked the call. +Other calls in the same session keep working. + +The decision appears under **Audit → Decisions** with the outcome **deny**. + +# Roll back + +To stop refusing calls at once, set **Mode** back to **Monitor**. + +To return to an earlier set of policies: + +1. Go to **Protect → MCP Gateway**. +2. Under **Activation**, find the activation in **History**. +3. Choose **Roll back to this**, then **Roll back**. + +A rollback doesn't change the mode. +The gateway applies it within 30 seconds. + +# Retire a policy + +To remove a policy from the list, open it and choose **Archive**. +You can't archive a policy while the live activation includes it. +An archived policy can't be activated again. +Its versions stay readable from the activations and decisions that used them. + +# Next steps + +- [Audit MCP activity](./mcp-gateway-audit.mdx): read sessions, timelines, and decisions. +- [MCP gateway reference](../platform/mcp-gateway-reference.mdx): the policy schema, actions, limits, and error messages. diff --git a/tutorials/protect-mcp-servers.mdx b/tutorials/protect-mcp-servers.mdx index 15710adf..aca86088 100644 --- a/tutorials/protect-mcp-servers.mdx +++ b/tutorials/protect-mcp-servers.mdx @@ -140,3 +140,86 @@ consent required: open https://… to authorize this upstream If the link shows `this upstream is not configured for your tenant`, the MCP server has no OAuth client. Delete it under **Protect → MCP Proxies** and add it again with the client ID and client secret. + +When access is approved, the command lists the MCP server's tools: + +```text +✓ device certificate accepted; MCP session established through the gateway + upstream server: Linear 1.0.2 + protocol version: 2025-11-25 +✓ 84 tool(s) available from the upstream: + • get_attachment + • list_comments + … +``` + +The device, the gateway, and the MCP server now work together. + +## Connect an MCP client + +An MCP client reaches the MCP server by running the agent's MCP proxy as a local MCP server. +The command is the same for every client: + +```bash +step-agent mcp proxy --upstream linear +``` + +This guide was tested with Claude Code. +To add the MCP server to Claude Code, run: + +```bash +claude mcp add linear -- step-agent mcp proxy --upstream linear +``` + +To share the configuration with a project, add `--scope project`. +Claude Code then writes this `.mcp.json` file: + +```json +{ + "mcpServers": { + "linear": { + "type": "stdio", + "command": "step-agent", + "args": ["mcp", "proxy", "--upstream", "linear"] + } + } +} +``` + +The configuration holds no token and no URL. +You can commit it to a repository. + +For another MCP client, add a local MCP server that uses the standard input and output transport, with the same command and arguments. + +# Verify and troubleshoot + +## See the session + +Use a tool from the MCP server in your MCP client. +Then, in the Smallstep console, go to **Audit → Sessions**. + +Each connection appears as one row. +The row shows the user, the device, the MCP client and its version, and the MCP server's host. +Select a row to read the session's timeline, which lists each call in order. + +[Audit MCP activity](./mcp-gateway-audit.mdx) explains what the timeline records. + +## Common problems + +| What you see | Cause | What to do | +|---|---|---| +| `no MCP proxy configured for upstream "linear"` | The device hasn't received the MCP server, or the **Upstream** value doesn't match | Check the **Upstream** value under **Protect → MCP Proxies**. Wait a few minutes after you add an MCP server | +| `consent required: open … to authorize this upstream` | This person hasn't approved access to the MCP server | Open the link and approve | +| `this upstream is not configured for your tenant` in the browser | The MCP server has no OAuth client | Delete the MCP server and add it again with the client ID and client secret | +| `denied by policy for https://…` | The access policy refuses the session | Read the decision under **Audit → Decisions**. See [Control MCP access with policy](./mcp-gateway-policy.mdx) | +| The connection fails before any message from the gateway | The device's certificate doesn't chain to the gateway's trust roots | Check the trust roots under **Protect → MCP Gateway** | + +The [MCP gateway reference](../platform/mcp-gateway-reference.mdx#messages-from-the-agent) lists more messages. + +# Next steps + +The gateway starts with its access policy turned off. +Every enrolled device with a certificate can use every tool of the MCP servers you add. + +- [Control MCP access with policy](./mcp-gateway-policy.mdx): decide which users, devices, and tools are allowed, and test a policy before you enforce it. +- [Audit MCP activity](./mcp-gateway-audit.mdx): read sessions, timelines, and decisions, and end a session. From 63146a799a48b9c81736e0e305d1a3cf3502c84c Mon Sep 17 00:00:00 2001 From: Josh Drake Date: Tue, 17 Nov 2026 17:52:32 -0600 Subject: [PATCH 4/7] Add the MCP gateway pages to the navigation Add a "Smallstep MCP Gateway" group after "Protect" with the concept page, the three guides, and the reference page. This commit is separate so it can be dropped if the pages should stay out of the sidebar. Co-Authored-By: Claude Fable 5.2 --- manifest.json | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/manifest.json b/manifest.json index 2c461c31..a434b996 100644 --- a/manifest.json +++ b/manifest.json @@ -149,6 +149,31 @@ } ] }, + { + "title": "Smallstep MCP Gateway", + "routes": [ + { + "title": "How the MCP Gateway Works", + "path": "/platform/mcp-gateway.mdx" + }, + { + "title": "Protect MCP Servers", + "path": "/tutorials/protect-mcp-servers.mdx" + }, + { + "title": "Control MCP Access with Policy", + "path": "/tutorials/mcp-gateway-policy.mdx" + }, + { + "title": "Audit MCP Activity", + "path": "/tutorials/mcp-gateway-audit.mdx" + }, + { + "title": "MCP Gateway Reference", + "path": "/platform/mcp-gateway-reference.mdx" + } + ] + }, { "title": "Smallstep for Certificate-Based VPN", "routes": [ From 83a062579231da9e59296f9609a934e4d31d1762 Mon Sep 17 00:00:00 2001 From: Josh Drake Date: Tue, 17 Nov 2026 17:55:13 -0600 Subject: [PATCH 5/7] Correct four statements in the MCP guides - Audit guide: the "would have refused" line appears when decisions in the range have that outcome, not whenever the mode is Monitor. - Policy guide: returning to Monitor takes up to 30 seconds, like every other mode change. - Policy guide: say that "Start from the baseline" appears only while the team has no policies, and what to check otherwise. - Setup guide: remove an unchecked statement about which Linear role can register an OAuth app. Not everything in these pages was run by hand in the console. The OAuth app was registered by a person; the example policy was saved and activated through the API; the simulator was not run against a forbid statement; "claude mcp add" was run with project scope only; the Device Admin role, the trust-roots failure row, and the live timeline refresh come from reading the code. Co-Authored-By: Claude Fable 5.2 --- tutorials/mcp-gateway-audit.mdx | 2 +- tutorials/mcp-gateway-policy.mdx | 6 +++++- tutorials/protect-mcp-servers.mdx | 1 - 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/tutorials/mcp-gateway-audit.mdx b/tutorials/mcp-gateway-audit.mdx index aeb402b6..878ad306 100644 --- a/tutorials/mcp-gateway-audit.mdx +++ b/tutorials/mcp-gateway-audit.mdx @@ -110,7 +110,7 @@ Turn capture on only if your team may store that data. Go to **Audit → Decisions**. The line at the top counts the decisions in the time range, by outcome. -When the mode is Monitor, it also says how many calls Enforce would have refused. +When some decisions in the range have the outcome **would refuse**, it also says how many calls Enforce would have refused. | Outcome | Meaning | |---|---| diff --git a/tutorials/mcp-gateway-policy.mdx b/tutorials/mcp-gateway-policy.mdx index 54fe9fbc..1e00bc56 100644 --- a/tutorials/mcp-gateway-policy.mdx +++ b/tutorials/mcp-gateway-policy.mdx @@ -53,6 +53,9 @@ You find all three in the Smallstep console under **Protect → MCP Gateway**. 1. In the Smallstep console, go to **Protect → MCP Gateway**. 2. Under **Policies**, choose **Start from the baseline**. +The button appears while your team has no policies. +If your team already has policies, check that the live activation includes a policy that permits every action, such as [`baseline-allow`](../platform/mcp-gateway-reference.mdx#the-baseline). + The console saves three policies and activates one of them: - `baseline-allow` permits every call. @@ -187,7 +190,8 @@ The decision appears under **Audit → Decisions** with the outcome **deny**. # Roll back -To stop refusing calls at once, set **Mode** back to **Monitor**. +To stop refusing calls, set **Mode** back to **Monitor**. +The gateway applies the change within 30 seconds. To return to an earlier set of policies: diff --git a/tutorials/protect-mcp-servers.mdx b/tutorials/protect-mcp-servers.mdx index aca86088..8a1d8961 100644 --- a/tutorials/protect-mcp-servers.mdx +++ b/tutorials/protect-mcp-servers.mdx @@ -31,7 +31,6 @@ You will need: - A device enrolled in Smallstep with the [Smallstep Agent](../platform/smallstep-agent.mdx) 0.70.0 or later. The device needs high assurance and a user assigned. - An account with the MCP server's provider that can register an OAuth app. - For Linear, that is a workspace admin. # Step 1: Configure the gateway From 90dadf38d59fc1fbbb59ff916c497bfd0256c225 Mon Sep 17 00:00:00 2001 From: Josh Drake Date: Wed, 18 Nov 2026 11:17:05 -0600 Subject: [PATCH 6/7] Set the MCP gateway pages' date to November 18, 2026 The pages were checked again on that date with a second team: the tool list, Monitor and Enforce decisions, ending a session, a Claude Code run, and a timeline with argument capture off all matched what the pages describe. Co-Authored-By: Claude Fable 5.2 --- platform/mcp-gateway-reference.mdx | 2 +- platform/mcp-gateway.mdx | 2 +- tutorials/mcp-gateway-audit.mdx | 2 +- tutorials/mcp-gateway-policy.mdx | 2 +- tutorials/protect-mcp-servers.mdx | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/platform/mcp-gateway-reference.mdx b/platform/mcp-gateway-reference.mdx index 4bbfd30e..cf5ff51c 100644 --- a/platform/mcp-gateway-reference.mdx +++ b/platform/mcp-gateway-reference.mdx @@ -1,5 +1,5 @@ --- -updated_at: November 17, 2026 +updated_at: November 18, 2026 title: MCP Gateway Reference html_title: Smallstep MCP Gateway Reference for Policies, Sessions, and Errors description: Reference for the Smallstep MCP gateway. Covers the Cedar policy schema, actions, modes, session and decision values, limits, roles, and error messages. diff --git a/platform/mcp-gateway.mdx b/platform/mcp-gateway.mdx index a9b92c8d..f708545b 100644 --- a/platform/mcp-gateway.mdx +++ b/platform/mcp-gateway.mdx @@ -1,5 +1,5 @@ --- -updated_at: November 17, 2026 +updated_at: November 18, 2026 title: MCP Gateway html_title: How the Smallstep MCP Gateway Protects MCP Servers with Device Identity description: Learn how the Smallstep MCP gateway replaces API keys in AI agent configurations with hardware-attested device certificates, brokered OAuth tokens, access policy, and an audit trail. diff --git a/tutorials/mcp-gateway-audit.mdx b/tutorials/mcp-gateway-audit.mdx index 878ad306..3f9fe049 100644 --- a/tutorials/mcp-gateway-audit.mdx +++ b/tutorials/mcp-gateway-audit.mdx @@ -1,5 +1,5 @@ --- -updated_at: November 17, 2026 +updated_at: November 18, 2026 title: Audit MCP Activity html_title: Audit AI Agent Activity Through the Smallstep MCP Gateway description: Read MCP sessions, per-call timelines, policy decisions, and audit events for AI agents that reach MCP servers through the Smallstep MCP gateway, and end a session. diff --git a/tutorials/mcp-gateway-policy.mdx b/tutorials/mcp-gateway-policy.mdx index 1e00bc56..a3a4371d 100644 --- a/tutorials/mcp-gateway-policy.mdx +++ b/tutorials/mcp-gateway-policy.mdx @@ -1,5 +1,5 @@ --- -updated_at: November 17, 2026 +updated_at: November 18, 2026 title: Control MCP Access with Policy html_title: Control Which Users, Devices, and Tools Can Use MCP Servers with Cedar Policy description: Write a Cedar access policy for the Smallstep MCP gateway, watch what it would refuse in Monitor mode, then enforce it and roll back if you need to. diff --git a/tutorials/protect-mcp-servers.mdx b/tutorials/protect-mcp-servers.mdx index 8a1d8961..010f5606 100644 --- a/tutorials/protect-mcp-servers.mdx +++ b/tutorials/protect-mcp-servers.mdx @@ -1,5 +1,5 @@ --- -updated_at: November 17, 2026 +updated_at: November 18, 2026 title: Protect MCP Servers html_title: Protect MCP Servers with Device Identity and the Smallstep MCP Gateway description: Put an MCP server such as Linear behind the Smallstep MCP gateway, so AI agents on enrolled devices connect with a hardware-attested device certificate and no API key on the laptop. From 88ba48ff64a723fceb8bd90a995c86c49de4323f Mon Sep 17 00:00:00 2001 From: Carl Tashian Date: Wed, 18 Nov 2026 14:00:32 -0800 Subject: [PATCH 7/7] Add Claude Desktop MCP bundle steps to the MCP gateway tutorial Add steps to make an MCP bundle (.mcpb) file for Claude Desktop. An admin sends the bundle to the team, and each person installs the MCP server with drag-and-drop. Each person approves access to the MCP server one time before the install. Put the Claude Code steps in their own section. Make the MCP gateway overview page shorter, and make its headings shorter. Co-Authored-By: Claude Opus 5.5 --- manifest.json | 2 +- platform/mcp-gateway.mdx | 20 ++---- tutorials/protect-mcp-servers.mdx | 100 ++++++++++++++++++++++++------ 3 files changed, 86 insertions(+), 36 deletions(-) diff --git a/manifest.json b/manifest.json index a434b996..df2916b4 100644 --- a/manifest.json +++ b/manifest.json @@ -153,7 +153,7 @@ "title": "Smallstep MCP Gateway", "routes": [ { - "title": "How the MCP Gateway Works", + "title": "How it Works", "path": "/platform/mcp-gateway.mdx" }, { diff --git a/platform/mcp-gateway.mdx b/platform/mcp-gateway.mdx index f708545b..654982cc 100644 --- a/platform/mcp-gateway.mdx +++ b/platform/mcp-gateway.mdx @@ -17,26 +17,22 @@ The MCP gateway is in early access. -## The problem it solves +## The problem An MCP client such as Claude Code usually authenticates to an MCP server with a personal access token or an OAuth token that sits in a configuration file on the laptop. -That token proves who the user is. -It doesn't prove which device is using it. Anyone who copies the token can use it from another machine, and you have no record of what an agent did with it. -The MCP gateway changes three things: +Smallstep MCP Gateway offers: - **No API key on the laptop.** The MCP client's configuration holds a command that starts the Smallstep Agent, and nothing else. The device's certificate opens the connection, and its private key can't be copied off the device. - **A record of what agents do.** - Each connection is a session tied to a user, a device, and an MCP client. - You can read every call in it, and end the session. + Smallstep logs every MCP session and tool call linked to the device and the user. - **Policy on every call.** You write rules about which users, devices, and clients may call which tools. - You can watch what a rule would refuse before you enforce it. -## How a request flows +## Request flow ```mermaid sequenceDiagram @@ -70,7 +66,7 @@ sequenceDiagram Mutual TLS protects the connection between the device and the gateway. The connection from the gateway to the MCP server uses TLS and the user's access token. -## The parts +## Components **MCP server.** The service an agent calls, such as the GitHub or Linear MCP server, or one you host. @@ -101,12 +97,6 @@ The service that holds each user's OAuth grant for each MCP server and hands the One conversation between an MCP client and an MCP server through the gateway. A session belongs to the user and the device that opened it. -**Access policy.** -The rules that decide whether a call may go ahead, written in [Cedar](https://www.cedarpolicy.com/). - -**Decision.** -The recorded outcome of evaluating the access policy for one call. - ## What the device proves The certificate a device presents to the gateway comes from a **hardware-attested** key. diff --git a/tutorials/protect-mcp-servers.mdx b/tutorials/protect-mcp-servers.mdx index 010f5606..4b802d6b 100644 --- a/tutorials/protect-mcp-servers.mdx +++ b/tutorials/protect-mcp-servers.mdx @@ -157,38 +157,98 @@ The device, the gateway, and the MCP server now work together. ## Connect an MCP client An MCP client reaches the MCP server by running the agent's MCP proxy as a local MCP server. -The command is the same for every client: +The MCP command is the same for every agent harness. +For example, for the Linear upstream: ```bash step-agent mcp proxy --upstream linear ``` -This guide was tested with Claude Code. -To add the MCP server to Claude Code, run: +This guide covers Claude Code and Claude Desktop. For another MCP client, add a local MCP server that uses the standard input and output transport, with the above command and arguments. + +### Claude Code + +To add the Linear upstream MCP server to Claude Code, run: ```bash claude mcp add linear -- step-agent mcp proxy --upstream linear ``` -To share the configuration with a project, add `--scope project`. -Claude Code then writes this `.mcp.json` file: - -```json -{ - "mcpServers": { - "linear": { - "type": "stdio", - "command": "step-agent", - "args": ["mcp", "proxy", "--upstream", "linear"] - } - } -} -``` +### Claude Desktop + +For drag-and-drop install into Claude Desktop, you can make an MCP bundle (`.mcpb`) file. +The bundle holds no token or URL, so you can send it by email or chat. + +You'll need one bundle for each MCP server. + +#### Create the bundle + +1. Make a folder, and in it make a file with the name `manifest.json` and this content: + + ```json + { + "manifest_version": "0.3", + "name": "linear-via-smallstep", + "display_name": "Linear (via Smallstep)", + "version": "1.0.0", + "description": "Linear, through the Smallstep MCP Gateway.", + "author": { + "name": "Example Corp IT" + }, + "server": { + "type": "binary", + "entry_point": "/Applications/SmallstepAgent.app/Contents/MacOS/SmallstepAgent", + "mcp_config": { + "command": "/Applications/SmallstepAgent.app/Contents/MacOS/SmallstepAgent", + "args": ["mcp", "proxy", "--upstream", "linear"], + "platform_overrides": { + "win32": { + "command": "C:\\Program Files\\Smallstep Agent\\smallstep-agent.exe" + } + } + } + }, + "compatibility": { + "platforms": ["darwin", "win32"] + } + } + ``` + + For a different MCP server, change `name`, `display_name`, `description`, and the `--upstream` value. + +2. In the folder, make the bundle: + + ```bash + zip linear.mcpb manifest.json + ``` + + You can also use the [MCPB command-line tool](https://github.com/modelcontextprotocol/mcpb). It checks the manifest before making the bundle: + + ```bash + npx @anthropic-ai/mcpb pack . linear.mcpb + ``` + +#### Install the bundle + +Send these steps with the bundle: + +1. Approve access to the MCP server one time, as in [Approve access to the MCP server](#approve-access-to-the-mcp-server). + On macOS, run: + + ```bash + /Applications/SmallstepAgent.app/Contents/MacOS/SmallstepAgent mcp tools list --upstream linear + ``` + + On Windows, run: + + ```powershell + & "C:\Program Files\Smallstep Agent\smallstep-agent.exe" mcp tools list --upstream linear + ``` -The configuration holds no token and no URL. -You can commit it to a repository. +2. Drag `linear.mcpb` into the Claude Desktop window, or open it. +3. Choose **Install**. -For another MCP client, add a local MCP server that uses the standard input and output transport, with the same command and arguments. +The MCP server's tools then show in Claude Desktop. # Verify and troubleshoot