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/mcpAPI 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
MCPClientper request and passawait client.listToolsets()togenerate()astoolsetsinstead of giving the agent fixedtools. Disconnect the client afterwards. - Posting runs in the background. The publish tools return a
request_id; the agent callsupload_statusto read each network's result. - Media goes in as URLs.
upload_videoandupload_photostake publichttpsURLs, not local files. - Going live: swap the test key for a live one (
rs_live_…) and use real networks instead ofsandbox.
The full tool list is on the MCP server page. Mastra's own guide: mastra.ai/docs/mcp/overview.