How to Use the Ayrshare MCP in LangChain
Connect Ayrshare to your LangChain agents to auto-publish posts and pull live social analytics inside your multi-step chains.
Works with every AI agent you already use
…and any MCP-compatible client
Connect Ayrshare MCP to LangChain
Create your Vinkius account to connect Ayrshare to LangChain and route execution through our secure gateway. The platform manages server hosting, runtime updates, and security layers. Configuration requires no manual server provisioning.
Build social feedback loops with LangChain
This Ayrshare MCP Server exposes tools like `get_post_analytics` and `get_social_analytics` directly to your LangChain ReAct agents. Your agent reads performance metrics, decides which content performs best, and immediately drafts the next update based on real numbers. Every step runs through your LangChain chains. When a post falls below a target engagement threshold, the agent triggers `schedule_post` with a revised copy variant, tracking the entire execution inside LangSmith.
Multi-profile social routing in chains
This Ayrshare MCP Server provides profile management tools to handle complex routing across multiple client brands in your LangChain workflows. Your agent calls `list_profiles` to isolate the target brand account before running any publishing actions. Once the correct profile ID is isolated, the LangChain chain passes that context directly to `create_post`. If a profile needs onboarding, the agent invokes `create_profile` and verifies the connection instantly using `get_account_check`.
Automated queue management via LangGraph
This Ayrshare MCP Server lets your LangChain agents inspect and control social queues dynamically instead of relying on rigid cron jobs. The agent uses `list_auto_schedules` to check current queue slots and adjusts posting times on the fly. If a slot conflicts with a holiday or high-traffic window, the LangChain agent runs `set_auto_schedule` or cleans up old queues with `delete_auto_schedule` to keep your posting schedule optimized.
Set up Ayrshare MCP in LangChain
Prerequisites
- Python 3.10+ installed
-
langchain-mcp-adapters+langgraphpackages - Active Vinkius subscription with a valid endpoint token
- 1
Install dependencies
Run
pip install langchain-mcp-adapters langgraph langchain-openai. The MCP adapters package converts MCP tools into native LangChainBaseToolobjects. - 2
Connect via HTTP transport
Use
MultiServerMCPClientwith"transport": "http"pointing to your Vinkius endpoint. Replace[YOUR_TOKEN_HERE]with your token from cloud.vinkius.com. - 3
Create a ReAct agent
Pass the discovered tools to
create_react_agent()from LangGraph. The agent automatically routes Ayrshare tool calls through the MCP protocol. - 4
Run with any LLM
Swap
ChatOpenAIforChatAnthropic,ChatGoogleGenerativeAI, or any LangChain-compatible model. The MCP tools work identically across all providers.
from langchain_mcp_adapters.client import MultiServerMCPClient
from langgraph.prebuilt import create_react_agent
from langchain_openai import ChatOpenAI
async with MultiServerMCPClient({
"ayrshare-mcp": {
"transport": "http",
"url": "https://edge.vinkius.com/[YOUR_TOKEN_HERE]/mcp",
}
}) as client:
tools = client.get_tools()
agent = create_react_agent(
ChatOpenAI(model="gpt-4o"),
tools,
)
result = await agent.ainvoke({
"messages": "List recent Ayrshare transactions"
})
print(result["messages"][-1].content) Independent Platform Disclaimer: Vinkius is an independent platform and is not affiliated with, endorsed by, sponsored by, verified by, or otherwise authorized by Ayrshare. All third-party trademarks, logos, and brand names are the property of their respective owners. Their use on this website is strictly for informational purposes to identify service compatibility and interoperability.
Why Choose Vinkius
Vinkius connects your tools to AI with real-time monitoring and automatic cost savings — all from one dashboard.
Real-time monitoring
Live
visibility into every interaction
Connect your favorite tools to your AI and see exactly what's happening — every request, every response, in real time.
Built-in savings
60%
lower AI costs
Vinkius compresses data between your apps and your AI automatically. Lower bills every month — no configuration required.
Single dashboard
One
place for every integration
Every tool your AI connects to, managed from a single screen. One account, complete control.
Common questions about Ayrshare MCP in LangChain
Use it with your favorite AI tools
Connect this server to Cursor, Claude, VS Code, and more.
Start using the Ayrshare MCP today
We host it, we monitor it, we maintain it. You just paste one token.