Last updated: August 31, 2026
Post to X from Microsoft Agent Framework
Agent Framework 1.0 shipped on April 3, 2026 for .NET and Python, merging Semantic Kernel and AutoGen, with MCP support built in. Point MCPStreamableHTTPTool at https://mcp.opentweet.io/mcp and your agent gets 36 X tools. No X developer account, flat $11.99 a month.
This is the Microsoft stack, so the interesting part is that you do not have to write an X connector at all. MCP is a first class citizen in 1.0: the tool list is discovered at connect time and the model picks from it.
7-day free trial. No X developer account needed.
What your agent can do on X
All 36 tools arrive at once. You do not write an AIFunction for any of them.
Post now
opentweet_create_tweet publishes the moment the agent decides to.
Schedule
opentweet_schedule_tweet and opentweet_batch_schedule queue posts server side.
Threads
opentweet_create_thread ships a connected thread in one call.
36 tools
Posts, threads, articles, evergreen, media and analytics, discovered automatically.
Analytics
The agent reads what worked and adapts the next post.
No X API
No developer account, no OAuth to build, no per-post billing.
Install
The Python distribution is agent-framework on PyPI and the .NET one is Microsoft.Agents.AI on NuGet. On a slim Python install the MCP tool classes need the optional mcp package, which the Microsoft docs call out explicitly.
# Python
pip install agent-framework
pip install mcp --pre # needed on minimal installs for the MCP tool classes
# .NET
dotnet add package Microsoft.Agents.AI
dotnet add package ModelContextProtocol --prereleasePython: the hosted server in one tool
MCPStreamableHTTPTool is an async context manager. Pass it as tools on the agent and the framework handles connect, discovery and dispatch.
import asyncio
import os
from agent_framework import Agent, MCPStreamableHTTPTool
from agent_framework.openai import OpenAIChatClient
OPENTWEET_KEY = os.environ["OPENTWEET_API_KEY"] # ot_...
async def main() -> None:
async with Agent(
client=OpenAIChatClient(),
name="XPoster",
instructions=(
"You publish and schedule posts on X. "
"Prefer scheduling for the next weekday morning unless told otherwise."
),
tools=MCPStreamableHTTPTool(
name="opentweet",
description="Publish, schedule and thread on X.",
url="https://mcp.opentweet.io/mcp",
header_provider=lambda _kwargs: {"Authorization": f"Bearer {OPENTWEET_KEY}"},
),
) as agent:
result = await agent.run(
"Draft a post about the 1.0 release and schedule it for tomorrow at 09:00 UTC."
)
print(result.text)
if __name__ == "__main__":
asyncio.run(main())Use header_provider, not a static headers dict
Both work, but Microsoft's guidance for authenticated endpoints isheader_provider, because credentials are then attached only to same-origin requests. The provider is called for tool calls and for ambient traffic such as the initialize handshake and tool discovery, so return the header in both cases and the connection authenticates cleanly.Every tool and argument is listed in the MCP docs.
.NET: the MCP C# SDK alongside the agent
On .NET, Agent Framework is used together with the official MCP C# SDK. You build a client, call ListToolsAsync, and hand the results to the agent as AITool objects. Because McpClientTool derives from AIFunction, discovered tools drop straight into function calling with no adapter.
// The npm package is the same server over stdio, which matches the
// StdioClientTransport shape the Agent Framework docs use for .NET.
await using var mcpClient = await McpClientFactory.CreateAsync(new StdioClientTransport(new()
{
Name = "opentweet",
Command = "npx",
Arguments = ["-y", "@opentweet/mcp-server"],
EnvironmentVariables = new() { ["OPENTWEET_API_KEY"] = Environment.GetEnvironmentVariable("OPENTWEET_API_KEY")! },
}));
var mcpTools = await mcpClient.ListToolsAsync().ConfigureAwait(false);
AIAgent agent = chatClient.AsAIAgent(
instructions: "You publish and schedule posts on X.",
tools: [.. mcpTools.Cast<AITool>()]);
Console.WriteLine(await agent.RunAsync("Schedule a release note for tomorrow at 09:00 UTC."));Note the await using. An MCP client holds a process or a socket open, and disposal is asynchronous. The hosted HTTPS endpoint is the same server if you would rather not spawn a local process, and the arguments to every tool are identical either way.
Why an X tool and not an HTTP call
You could give the agent a hand-written AIFunction that POSTs to X. Three things you would then own yourself: the OAuth 1.0a signing and refresh, the per-post X billing, and scheduling. The first two are work. The third is not available from the X API at any price.
With the MCP server, opentweet_schedule_tweet returns immediately with a post id and the publish happens later on our infrastructure. A batch call fills a week in one turn and the process can exit. That is the difference between an agent that can act while it is running and one that can leave instructions behind.
The REST fallback
For a release pipeline, an Azure Function or a background worker, skip MCP entirely. Same key, one endpoint.
curl -X POST https://opentweet.io/api/v1/posts \
-H "Authorization: Bearer ot_your_key" \
-H "Content-Type: application/json" \
-d '{"text":"Shipped 1.0. Migration guide in the replies.","publish_now":true}'
# Schedule instead of publishing now:
# {"text":"...","scheduled_date":"2026-09-02T09:00:00Z"}The route is /api/v1/posts. Full field reference in the API docs, and the GitHub Actions guide shows the CI shape.
Coming from Semantic Kernel or AutoGen
Your X code does not migrate
If you had a Semantic Kernel plugin or an AutoGen tool wrapping the X API, the migration is a good moment to delete it rather than port it. An MCP server is one constructor and it keeps working as the framework moves.
One tool, several surfaces
1.0 lists A2A for cross-runtime collaboration and AG-UI in preview with CopilotKit and ChatKit adapters. An X tool attached at the agent level is reachable from whichever of those you end up fronting.
The same endpoint works from the OpenAI Agents SDK, LangGraph, Pydantic AI, and Google ADK.
Frequently asked questions
What is Microsoft Agent Framework, and does it replace Semantic Kernel and AutoGen?
It is Microsoft's agent SDK, announced in October 2025 and released as version 1.0 on April 3, 2026 for .NET and Python. It unifies the enterprise foundations of Semantic Kernel with the orchestration work from AutoGen into one open source framework. Microsoft positions it as the successor for new agent work, and publishes migration guides from both. AutoGen still receives bug fixes and critical security patches.
Does Agent Framework support MCP natively?
Yes. MCP support ships in 1.0 so agents can discover and invoke tools exposed by MCP servers. In Python the classes are MCPStdioTool, MCPStreamableHTTPTool and MCPWebsocketTool. In .NET you use the official MCP C# SDK alongside the framework, retrieve tools with ListToolsAsync and pass them to the agent as AITool objects.
How do I connect Agent Framework to the OpenTweet MCP server?
In Python, construct MCPStreamableHTTPTool with name, url set to https://mcp.opentweet.io/mcp, and a header_provider that returns an Authorization header carrying your ot_ key, then pass it as tools on the Agent. Microsoft recommends header_provider over static headers because credentials are then added only to same-origin requests.
What packages do I install?
Python is pip install agent-framework, and on a minimal install you also need pip install mcp --pre for the MCP tool classes. .NET is dotnet add package Microsoft.Agents.AI, plus the ModelContextProtocol package for the MCP client.
Do I need an X developer account?
No. OpenTweet holds the X connection, the OAuth flow and the token refresh. Your agent authenticates to OpenTweet with a single ot_ bearer key. You never create an X developer app and you never touch the pay-per-use X API.
Does Agent Framework support A2A and AG-UI as well as MCP?
The 1.0 announcement lists A2A for cross-runtime agent collaboration, noting that A2A 1.0 support was still to come at the time of the post, and AG-UI in preview with adapters for CopilotKit and ChatKit. None of that changes the OpenTweet setup, which is a plain MCP server, but it means an X posting tool added once is reachable from whichever surface your agent ends up fronting.
What does it cost compared with calling the X API from the agent directly?
OpenTweet is flat: $11.99 a month on Pro with the API included and a 7-day free trial. The X API bills pay-per-use at $0.015 per post and $0.20 per post that contains a link. An agent that posts release links crosses the break-even at roughly 60 link posts a month.
Wire any agent to X
Agent Framework is one client of many. The same hosted MCP server works everywhere.
OpenTweet vs the X API
Post, schedule, and automate X without a developer account or the $200/mo minimum.
X DM outreach, human-approved
Find and qualify leads, AI-draft DMs, approve each one, and drip-send from your own account via API or MCP.
Post to X without an API
The clean, account-safe way to post to X from your code or an AI agent.
Twitter MCP Server
Give Claude, Cursor, and OpenClaw the ability to post to X. 36 tools included.
Developer docs
Quickstart, API keys, MCP setup, and the REST reference for posting to X from code or an agent.
XMCP vs OpenTweet
X's official MCP server bills per API call and cannot schedule. Compare it with the flat-fee hosted MCP.
MCP for AI agents
Connect your AI client to X in under two minutes, no X developer account.
Developer API and keys
REST endpoints, one bearer key, and usage tracking. Build on OpenTweet.
OpenTweet for AI agents
The posting layer for autonomous agents and automations that live on X.
Build an AI Twitter persona
Give your AI agent its own X account. Setup, cadence, and the rules that keep it safe.
Best MCP servers for social media
The 2026 ranked list. How the hosted OpenTweet MCP compares with the official X MCP and others.
Cheapest way to post to X via code
Flat fee vs pay-per-use. Why the $0.20 per-link fee flips the math past ~60 posts a month.
Give your Agent Framework agent an X account
Connect X, copy your key, add one MCP tool.
$11.99/month, API included. Cancel anytime.