Skip to content
reelspanDocs

Integrations

Vercel AI SDK

Connect the Vercel AI SDK's MCP client to Reelspan's hosted MCP server and let generateText or streamText publish, schedule and check social posts.

The AI SDK has an MCP client, so it can load Reelspan's tools from the hosted MCP server and pass them to generateText or streamText. There is no separate Reelspan package to install.

Install

npm install ai @ai-sdk/mcp

API key

Create a key under Developers → API keys and export it. Start with a test key (rs_test_…): every check runs, but nothing is posted.

export REELSPAN_API_KEY=rs_test_...

Example

This script publishes a text post to the sandbox network, which needs no connected account, and then checks the result.

import { createMCPClient } from '@ai-sdk/mcp';
import { generateText, isStepCount } from 'ai';

const reelspan = await createMCPClient({
  transport: {
    type: 'http',
    url: 'https://api.reelspan.com/mcp',
    headers: { Authorization: `Bearer ${process.env.REELSPAN_API_KEY}` },
  },
});

try {
  const { text } = await generateText({
    model: 'anthropic/claude-sonnet-5.5',
    tools: await reelspan.tools(),
    stopWhen: isStepCount(5),
    prompt:
      "Publish 'Hello from my AI SDK agent' as a text post to the sandbox network for the profile my-brand, " +
      'then check its status and tell me the result.',
  });
  console.log(text);
} finally {
  await reelspan.close();
}

stopWhen lets the model call several tools in a row: publish, then check the status. A model given as a string goes through the Vercel AI Gateway; you can pass a provider's model instead. Replace my-brand with one of your profiles.

Notes

  • Close the client when the response is done: in finally for generateText, or when the stream ends for streamText.
  • Posting runs in the background. The publish tools return a request_id; the model calls upload_status to read each network's result.
  • Media goes in as URLs. upload_video and upload_photos take public https URLs, not local files.
  • One key per customer. If your app posts for many customers, create the client per request with that customer's key.
  • Going live: swap the test key for a live one (rs_live_…) and use real networks instead of sandbox.

The full tool list is on the MCP server page. The AI SDK's own guide: ai-sdk.dev/docs/ai-sdk-core/mcp-tools.

Something unclear or missing? Write to [email protected] and we’ll fix the page.