Skip to content
reelspanDocs

Integrations

Mastra

Connect a Mastra agent to Reelspan's hosted MCP server with MCPClient so it can publish, schedule and check posts on 22 social networks.

Mastra's MCPClient loads tools from remote MCP servers, so a Mastra agent can use Reelspan's hosted MCP server to publish, schedule and read results. There is no separate Reelspan package to install.

Install

npm install @mastra/core @mastra/mcp

API key

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

export REELSPAN_API_KEY=rs_test_...

Example

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

import { Agent } from '@mastra/core/agent';
import { MCPClient } from '@mastra/mcp';

const reelspan = new MCPClient({
  id: 'reelspan',
  servers: {
    reelspan: {
      url: new URL('https://api.reelspan.com/mcp'),
      requestInit: { headers: { Authorization: `Bearer ${process.env.REELSPAN_API_KEY}` } },
    },
  },
});

const publisher = new Agent({
  id: 'publisher',
  name: 'Social publisher',
  instructions: 'You publish and check social media posts with the Reelspan tools.',
  model: 'openai/gpt-6.1-sol',
  tools: await reelspan.listTools(),
});

const response = await publisher.generate(
  "Publish 'Hello from my Mastra 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(response.text);
await reelspan.disconnect();

Replace my-brand with one of your profiles (the agent can find them with list_profiles).

Notes

  • One key per customer. For credentials that change per request, create an MCPClient per request and pass await client.listToolsets() to generate() as toolsets instead of giving the agent fixed tools. Disconnect the client afterwards.
  • Posting runs in the background. The publish tools return a request_id; the agent 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.
  • 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. Mastra's own guide: mastra.ai/docs/mcp/overview.

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