Post to social media from OpenHands CLI
The OpenHands CLI is a terminal coding agent, and once you add iHatePosting to it the agent can post to your social accounts without leaving the terminal. It reads its MCP servers from ~/.openhands/mcp.json when a conversation starts, so every new conversation on that machine gets the server. What the agent writes is saved as a draft unless you ask for it to go out now or at a set time.
Set it up
1. Create an iHatePosting API key
Sign in, open Settings → Developers and create a key. It starts with pk_live_ and is shown in full only once, so copy it before you leave the page.
2. Add iHatePosting to OpenHands CLI
Add to ~/.openhands/mcp.json. On Windows, use the file inside WSL. Or run this command: openhands mcp add ihateposting --transport http --header "Authorization: Bearer YOUR_API_KEY" https://ihateposting.com/mcp Replace YOUR_API_KEY with your key.
{ "mcpServers": { "ihateposting": { "url": "https://ihateposting.com/mcp", "transport": "http", "headers": { "Authorization": "Bearer YOUR_API_KEY" } } } }3. Ask it to post
Tell OpenHands CLI what you want to say and where. It saves a draft in iHatePosting unless you ask for the post to go out now or at a set time.
What is different about OpenHands CLI
- Put the block in ~/.openhands/mcp.json, inside its mcpServers object. That file belongs to the OpenHands CLI. The OpenHands web UI and OpenHands Cloud keep their MCP servers on the Settings, then MCP page, where a remote server takes a url and an api_key rather than a headers block. Agent Canvas keeps them under Customize, then MCP Servers. Adding it in one place does not add it in the other.
- The field is called transport and its value is http. In the file, a remote server's transport can also read streamable-http or sse; the openhands mcp add command takes only http, sse or stdio. That command writes url, transport and headers, the three fields in the block on this page, and it also writes enabled: true — a block you type by hand without that field still counts as enabled.
- If you use the command, put --header before the URL. openhands mcp add reads the server name and then the URL, and everything after the URL is collected as arguments for a stdio server, which an http server never uses. The entry is then saved with no Authorization header: it still connects, it still lists its tools, and every tool answers iHatePosting API 401.
- Restart the conversation after you change mcp.json. A running conversation keeps the servers it started with. Press Ctrl+P (or Ctrl+\) inside the conversation and choose MCP: the panel lists Current Agent Servers, and when mcp.json has changed it adds an Incoming on Restart section with New and Updated. openhands mcp remove, enable and disable each print Restart your OpenHands session to apply the changes.
- openhands mcp get ihateposting prints the Authorization header with its middle replaced by stars: you see Bear at the front and the last four characters of your key, so it shows that a key is stored and not that it is the right one. Our server lists its tools to anyone who asks. Ask OpenHands to run whoami: it answers with the iHatePosting account your key belongs to, and a wrong key comes back as iHatePosting API 401.
- openhands mcp add will not overwrite a name that is already in the file — it stops with an error and changes nothing — so run openhands mcp remove ihateposting first when you replace your key. If you are coming from a release before 1.0.0 you have to redo your MCP configuration, because the format changed from TOML to JSON.
Limits. On Windows, OpenHands runs under WSL: its installation page tells Windows users to run the install commands inside the WSL terminal (Ubuntu), so ~/.openhands/mcp.json is in your WSL home folder, not your Windows user folder.
OpenHands's own documentation: MCP servers in the OpenHands CLI
Nothing goes out unless you say so
Every post OpenHands CLI writes is saved as a draft in iHatePosting unless you ask for it to be published now or at a set time. Publishing, rescheduling, retrying and deleting are marked as actions that change things, so clients that honour those markings ask you before they run them. Deleting a post in iHatePosting never removes one that is already live on a network.
Frequently asked questions
Where does the iHatePosting entry go?
In ~/.openhands/mcp.json, inside its mcpServers object. On Windows that is your WSL home folder, because OpenHands tells Windows users to run its install commands inside the WSL terminal. The web UI and OpenHands Cloud do not read this file; they keep MCP servers on the Settings, then MCP page, and Agent Canvas keeps them under Customize, then MCP Servers.
Why does every tool answer iHatePosting API 401?
Your key is wrong, or the Authorization header never reached the file. If you added the server with openhands mcp add and put --header after the URL, OpenHands read it as arguments for a stdio server and dropped it. Our server answers and lists its tools either way, so run openhands mcp get ihateposting to see whether a header is stored, and ask OpenHands to run whoami to check the key.
Do I have to restart after editing mcp.json?
Yes. A conversation keeps the servers it started with. Press Ctrl+P and choose MCP to see Current Agent Servers and what is Incoming on Restart, then start a new conversation.
Should I use --auth oauth?
No. Our server takes an API key in an Authorization header, so use --header "Authorization: Bearer YOUR_API_KEY" and leave --auth out. The --auth oauth flag is for servers that sign you in through OAuth.
Ready to post everywhere from OpenHands CLI?
Start your 90-day free trial — no credit card, about a minute to your first post.
Sign Up