Connecting agents with MCP
Give an agent a bash tool on your workspaces through the Model Context Protocol.
Origami is an MCP server at /v1/mcp. An agent that speaks MCP gets two tools, and needs nothing else to work in your workspaces.
| Tool | What it does |
|---|---|
list_workspaces | Lists the organization's workspaces, oldest first, with id, name and creation time |
bash | Runs a command line in a workspace, by its name or id, and returns its output and exit code. The same as exec |
bash takes workspace, command, and optionally cwd and timeoutMs, and answers with stdout, stderr, exitCode, cwd, timedOut and truncated. Its description tells the model what the shell is: where the files are, that nothing can be installed, that each call is a fresh shell, and the limits.
With an API key
For an agent you run yourself, the simplest way is a key in a header.
Claude Code:
claude mcp add --transport http origami https://api-next.origamidb.xyz/v1/mcp \
--header "Authorization: Bearer $ORIGAMI_API_KEY"Any client that reads a JSON configuration of remote servers:
{
"mcpServers": {
"origami": {
"type": "http",
"url": "https://api-next.origamidb.xyz/v1/mcp",
"headers": { "Authorization": "Bearer og_sk_..." }
}
}
}In your own code, with the official TypeScript SDK:
import { Client, StreamableHTTPClientTransport } from '@modelcontextprotocol/client';
const client = new Client({ name: 'my-agent', version: '1.0.0' });
await client.connect(
new StreamableHTTPClientTransport(new URL('https://api-next.origamidb.xyz/v1/mcp'), {
requestInit: { headers: { authorization: `Bearer ${process.env.ORIGAMI_API_KEY}` } },
}),
);
const result = await client.callTool({
name: 'bash',
arguments: { workspace: 'notes', command: 'ls -la' },
});The key decides the organization: the agent sees that organization's workspaces and no others.
Without a key, as a person
An app that supports MCP's sign-in, such as Claude, needs only the URL:
https://api-next.origamidb.xyz/v1/mcpWhen you add it, the app sends you to the Origami console:
- Sign in, as you do to the console.
- Choose the organization whose workspaces the app may use.
- Choose Allow. The app gets a token for that organization alone.
The app then works as you, in that organization. Its token stops working when you leave the organization. There's no page yet to see or revoke the apps you've allowed; that comes later.
How it works
- Transport: MCP's streamable HTTP, without sessions. Every request stands alone, so a client never has to reconnect after a restart.
- Versions: clients of MCP 2026-07-28 and of the 2025 revisions.
- Sign-in: OAuth 2.1, with the server's metadata where MCP says to look for it. Apps can register themselves, or identify themselves with a metadata document at their own URL.
- Timing: every answer has a
Server-Timingheader, as in the rest of the API.
Tips
- Name the workspace in the prompt, or let the agent call
list_workspacesfirst. - Give each agent its own workspace, or a shared one when they should see each other's files. See Concepts.
- Use the files API alongside it for what an agent shouldn't do through a shell: uploading its inputs, downloading its results.