← Blog
2026-11-12

Agent-first: one key for REST, MCP, and the CLI

'Agent-first' means the machine surface is the primary one. In AllTwitter that plays out as a single API key — at_… — that authenticates three different transports: the REST API at /api/v1, the hosted MCP server at /mcp, and the CLI on your laptop. Same scopes, same rate limits, same service layer behind all three.

Why it matters

Your CI pipeline curls /api/v1/posts to announce a release. Claude Code calls the MCP tool post_create for the same thing. You run atw post create from a terminal. All three produce identical Post rows in identical statuses — which means the approval flow, the queue, and the analytics all see agent writes exactly like human ones.

Keys are boring on purpose

A key is minted once, shown once, and stored as a hash. The list view only ever shows the prefix — at_ plus seven characters — because a prefix is all an operator needs to find and revoke the right key. Scopes are coarse (posts:write, accounts:read, …) because fine-grained scope matrices are where key hygiene goes to die.

The guardrail is the product

Because agents are first-class callers, the guardrails live in the service layer, not the UI: programmatic replies are refused, unapproved DM sends are refused, and every write lands in a status a human can veto. 'Agent-first' without that isn't a feature — it's a spam cannon.

Published by the AllTwitter team — the publish-via-official-APIs people.