parseUserAgentAgentName (agent/request.ts)

argos · apps/backend/src/agent/request.ts · typescript · MIT
auth, Auth / Identity

* Works out whether an API request was made by a coding agent, and which one. Agents never call the API directly — they drive the CLI or the MCP server — so each surface carries the identity differently: - **CLI**: an `agent/<name>` token in the `User-Agent`, from the agent detec

// Source: https://github.com/argos-ci/argos | License: MIT | Copyright 2017 Olivier Tassinari & Greg Bergé
// Provided via justclaw.it.com; keep this notice with the code.
/**
 * Works out whether an API request was made by a coding agent, and which one.
 *
 * Agents never call the API directly — they drive the CLI or the MCP server —
 * so each surface carries the identity differently:
 *
 * - **CLI**: an `agent/<name>` token in the `User-Agent`, from the agent
 *   detection the CLI runs at startup.
 * - **MCP**: the OAuth client holding the access token. OAuth exists here to
 *   serve the CLI and MCP clients, and MCP is an agent protocol — so an OAuth
 *   client that isn't the CLI is taken to be an agent even when the curated
 *   known-apps registry doesn't recognize it.
 *
 * A req

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key