LlamaIndex turns an MCP server's tools into LlamaIndex tools, so an agent can use Reelspan's hosted MCP server to publish, schedule and read results. There is no separate Reelspan package to install.
Install
pip install llama-index-tools-mcp llama-index-llms-openaiAPI key
Create a key under Developers → API keys and export it with your OpenAI key. Start with a test key (rs_test_…): every check runs, but nothing is posted.
export REELSPAN_API_KEY=rs_test_...
export OPENAI_API_KEY=sk-...Example
This agent publishes a text post to the sandbox network, which needs no connected account, and then checks the result.
import asyncio
import os
from llama_index.core.agent.workflow import FunctionAgent
from llama_index.llms.openai import OpenAI
from llama_index.tools.mcp import BasicMCPClient, McpToolSpec
async def main():
client = BasicMCPClient(
"https://api.reelspan.com/mcp",
headers={"Authorization": f"Bearer {os.environ['REELSPAN_API_KEY']}"},
)
# only the tools this agent needs
spec = McpToolSpec(client=client, allowed_tools=["list_profiles", "upload_text", "upload_status"])
tools = await spec.to_tool_list_async()
agent = FunctionAgent(
tools=tools,
llm=OpenAI(model="gpt-5-mini"),
system_prompt="You publish and check social media posts with the Reelspan tools.",
)
response = await agent.run(
"Publish 'Hello from my LlamaIndex agent' as a text post to the sandbox network for the profile my-brand, "
"then check its status and tell me the result."
)
print(response)
asyncio.run(main())Replace my-brand with one of your profiles (the agent can find them with list_profiles).
Notes
allowed_toolskeeps the agent to the tools you list. Leave it out to load all of them.- 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. LlamaIndex's own guide: developers.llamaindex.ai.