Wire SDK
For teams building agents, harnesses, or AI infrastructure who want Wire container connectivity as a first-class part of the product. Three methods. 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.
Install
Section titled “Install”npm install @usewire/sdkRuns on Node 18+, Cloudflare Workers, Deno, and Bun. connect() assumes your agent runs outside the user’s browser (CLI, IDE plugin, server-side worker) and can show them a code to type on the consent screen.
In a pure browser app, getStatus and disconnect work against an existing apiKey, but a browser-native connect() is not yet supported.
Register your app
Section titled “Register your app”Before the SDK can connect on behalf of your users, register your app from the Apps entry in your account menu in the Wire dashboard. You’ll get an appId (your slug) that the SDK uses to identify itself.
Connect
Section titled “Connect”import { WireClient } from '@usewire/sdk';
const client = new WireClient({ appId: 'my-app' });
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.
If you need to drive the prompt yourself (custom UI, no stdout):
const connection = await client.connect({ onUserPrompt: ({ code, url }) => { myUi.show(`Code: ${code}`); myBrowser.open(url); },});What you get
Section titled “What you get”interface Connection { mcpUrl: string; apiUrl: string; apiKey: string; containerId: string; containerName: string; orgSlug: string | null; expiresAt: Date | null; // ephemeral containers only appId: string; credentialId: string; deviceKey: DeviceKey; connectedAt: Date; label?: string;}The SDK persists nothing. Keep whatever fields you want from the result, however you want.
Reuse the install identity
Section titled “Reuse the install identity”deviceKey identifies the install across reconnects. Persist it if you want the same user and machine to appear as the same install instead of a fresh one every time:
// First runconst conn = await client.connect();saveSomewhere(conn.deviceKey);
// Laterconst client2 = new WireClient({ appId: 'my-app', deviceKey: loadSomewhere(),});const conn2 = await client2.connect();Local file, OS keychain, secrets manager, your call.
Disconnect and status
Section titled “Disconnect and status”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.
Errors
Section titled “Errors”Rejected promises throw WireSdkError with a code and HTTP status when applicable.
Source
Section titled “Source”github.com/usewire/wire-sdk · @usewire/sdk on npm · MIT licensed.