Custom Integrations

The recommended integration path is MCP through @dcprotocol/agent. Use the lower-level TypeScript client only when you are building DCP runtime code or a custom service integration.

Recommended: MCP

{
  "command": "npx",
  "args": ["-y", "@dcprotocol/agent", "run", "--mode", "mcp", "--agent", "my_agent"]
}

HTTP MCP

dcp-agent run --mode http-mcp --agent my_agent --host 127.0.0.1 --port 8420

Low-level TypeScript Client

@dcprotocol/client is published, but it is primarily a runtime client used by DCP packages. If you use it directly, expect to handle pairing, service identity, and relay/local mode correctly.

npm install @dcprotocol/client

Local mode

import { DcpClient } from "@dcprotocol/client";

const dcp = new DcpClient({
  mode: "local",
  localUrl: "http://127.0.0.1:8420",
  agentName: "my_service",
});

const address = await dcp.getAddress("solana");

Auto mode

Auto mode checks the local vault first. If the local vault is unavailable and relay credentials are configured, it falls back to relay mode.

const dcp = new DcpClient({ mode: "auto" });

Relay mode

const dcp = new DcpClient({
  mode: "relay",
  relayUrl: "wss://relay.dcp.1ly.store",
  vaultId: "vault_...",
  vaultHpkePublicKey: "base64-hpke-public-key",
  serviceId: "service_...",
  servicePrivateKey: "base64-ed25519-private-key",
});

Non-TypeScript Runtimes

Python, Go, Rust, and other runtimes should connect through MCP or HTTP MCP. The Python SDK folder exists in the main repo, but it is not the recommended public quickstart path yet.