Skip to content

Wire SDK

For teams building agents, harnesses, or AI infrastructure who want Wire container connectivity as a first-class part of the product. Your user authorizes in their browser; you get back a scoped MCP endpoint and API key to hand to your agent.

You don’t run the storage. You don’t build the import flow. You don’t manage user data. Wire owns the connect screen, the auth, and the connection lifecycle. Your agent keeps speaking MCP, now with whatever the user has brought along.

This page covers connect mode, where each user authorizes against their own Wire account. If your product should own the containers and the billing instead, with no end-user Wire account at all, see Provision mode.

Terminal window
npm install @usewire/sdk

Runs on Node 18+, Cloudflare Workers, Deno, and Bun.

Before the SDK can connect on behalf of your users, register your agent from the Agents entry in your account menu in the Wire dashboard. You’ll get a slug (passed as agentId) that the SDK uses to identify your agent on every call.

import { WireClient } from '@usewire/sdk';
const client = new WireClient({ agentId: 'my-agent' });
const connection = await client.connect({ label: 'my-laptop' });
// Hand these to your agent's MCP client:
const mcp = new MCPClient({
url: connection.mcpUrl,
headers: { 'x-api-key': connection.apiKey },
});

connect() shows the user a short code and opens their browser. The user types the code on the connect screen, picks a container, and connect() resolves with the result. That’s the whole happy path.

interface Connection {
mcpUrl: string;
apiUrl: string;
apiKey: string;
containerId: string;
containerName: string;
orgSlug: string | null;
expiresAt: Date | null; // ephemeral containers only
agentId: string;
credentialId: string;
deviceKey: DeviceKey;
connectedAt: Date;
label?: string;
}

The SDK persists nothing. Keep whatever fields you want from the result, however you want. For typical agent use, the only fields you need at runtime are mcpUrl and apiKey.

await client.disconnect(connection.apiKey);
await client.getStatus(connection.apiKey);

disconnect revokes the apiKey but keeps the install identity, so reconnect from the same deviceKey still works. getStatus returns a live snapshot of the container and connection.