LangChain loads tools from any MCP server, so a LangChain agent can use Reelspan's hosted MCP server directly: publish, schedule, write captions and read results. There is no separate Reelspan package to install.
Install
pip install "langchain[mcp]>=1.4.0" langchain-anthropicLangChain marks its langchain.mcp module as beta, so its API may still change. Swap langchain-anthropic for the provider package of the model you use.
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 agent publishes a text post to the sandbox network, which needs no connected account, and then checks the result.
import asyncio
import os
from fastmcp.client import Client
from langchain.agents import create_agent
from langchain.mcp import MCPAdapter
async def main():
# auth=<key> sends Authorization: Bearer <key>
reelspan = Client("https://api.reelspan.com/mcp", auth=os.environ["REELSPAN_API_KEY"])
async with MCPAdapter(reelspan) as adapter:
tools = await adapter.list_tools()
agent = create_agent("claude-sonnet-5", tools)
result = await agent.ainvoke({
"messages": [{
"role": "user",
"content": "Publish 'Hello from my LangChain agent' as a text post to the sandbox network "
"for the profile my-brand, then check its status and tell me the result.",
}]
})
print(result["messages"][-1].content)
asyncio.run(main())Replace my-brand with one of your profiles (the agent can find them with list_profiles).
Notes
- 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. - Scope the key. The agent can do whatever the key allows. A key with only Publish and Read can't create or delete profiles.
- 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. LangChain's own guide: docs.langchain.com/oss/python/langchain/mcp.