aindrive/docs

MCP — Model Context Protocol

Each drive is a remote MCP server (Streamable HTTP, stateless):

https://aindrive.ainetwork.ai/mcp/d/<driveId>

Tools are scoped to that one drive (no drive_id argument). A read token gets list_files, read_file, stat, search; a write token adds write_file and delete_path. An account grant with drives:sell also gets the sale tools (share links, payout wallets, token policy, receipts) on drives the user created. Full argument list: Skills.

Connect

claude.ai / ChatGPT / any OAuth-capable host — add a custom connector with the URL. The host discovers aindrive's OAuth server from the 401 + WWW-Authenticate: resource_metadata=… response, registers itself, and sends the user to approve. No token to copy.

Claude Code

claude mcp add --transport http aindrive https://aindrive.ainetwork.ai/mcp/d/<driveId> \
  --header "Authorization: Bearer aind_pat_…"

Cursor / VS Code / other clients (mcp.json)

{
  "mcpServers": {
    "aindrive": {
      "url": "https://aindrive.ainetwork.ai/mcp/d/<driveId>",
      "headers": { "Authorization": "Bearer aind_pat_…" }
    }
  }
}

TypeScript SDK

import { Client } from "@modelcontextprotocol/sdk/client/index.js";
import { StreamableHTTPClientTransport } from "@modelcontextprotocol/sdk/client/streamableHttp.js";

const client = new Client({ name: "my-app", version: "1.0.0" });
await client.connect(new StreamableHTTPClientTransport(
  new URL("https://aindrive.ainetwork.ai/mcp/d/<driveId>"),
  { requestInit: { headers: { Authorization: `Bearer ${token}` } } },
));
const { tools } = await client.listTools();
const res = await client.callTool({ name: "list_files", arguments: { path: "" } });

Built-in UI (MCP Apps)

aindrive ships an MCP Apps view, so hosts that support the extension (io.modelcontextprotocol/ui — Claude, ChatGPT, VS Code, Goose, …) render tool results as an interactive file browser, preview and search screen instead of raw JSON:

UI resourceui://aindrive/browser (text/html;profile=mcp-app)
Tool metadataevery tool: _meta.ui = { resourceUri: "ui://aindrive/browser", visibility: ["model","app"] }
Result payloadresult._meta["ai.aindrive/a2ui"] — the A2UI surface for that result (UI-only; the model sees the normal text)
Clicksthe view calls the app-only tool a2ui_action with the A2UI action; the host forwards it over your already-authenticated MCP session

You don't need to do anything to enable it — hosts without MCP Apps support simply ignore the metadata.

A2UI over MCP

If your client renders A2UI natively, ask for the surface inline: send X-A2UI: 1 (or append ?a2ui=1 to the URL). Every tool result then also contains an embedded resource:

{ "type": "resource", "resource": {
    "uri": "a2ui://aindrive/aindrive-browser-k3j2…",
    "mimeType": "application/a2ui+json",
    "text": "[{\"version\":\"1.0\",\"createSurface\":…}, …]" } }

Send user clicks back with tools/call a2ui_action {"action": <A2UI action>}.

Errors

SituationResponse
no / invalid tokenHTTP 401 + WWW-Authenticate: Bearer … resource_metadata="…/.well-known/oauth-protected-resource/mcp/d/<id>"
token for another drive, missing scopeHTTP 403 insufficient_scope
permission / path / payment problemtool result isError: true, text [forbidden] …