Last updated: August 31, 2026

Post to X from OpenCode

Add the hosted OpenTweet MCP server to OpenCode with opencode mcp add or four lines of opencode.json. Your agent then publishes, schedules, and threads on X from the terminal. No X developer account, no OAuth code, flat $11.99 a month.

OpenCode is the largest MCP client by install base, at roughly 194,000 GitHub stars on anomalyco/opencode and more than 6.5 million monthly actives. Its MCP support is first class. Its one rough edge, global rather than per project config, is covered below.

7-day free trial. No X developer account needed.

What OpenCode can do on X

All 36 tools arrive at once. You do not write a tool wrapper 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 for later.

Threads

opentweet_create_thread ships a connected thread in one call.

36 tools

Posts, threads, articles, evergreen, media, and analytics, with no tool code to write.

Analytics

The agent can read what worked and adapt the next post.

No X API

No developer account, no OAuth to build, no per-post billing.

Setup, about two minutes

Connect your X account to OpenTweet, copy the ot_ key from the dashboard, then tell OpenCode about the server.

terminal
# 1. Add the hosted server interactively
opencode mcp add

# 2. Or skip the prompts and edit the config directly
$EDITOR ~/.config/opencode/opencode.json

Hosted server, recommended

Nothing to install, and it tracks the current MCP transport without you upgrading a package.

~/.config/opencode/opencode.json
{
  "$schema": "https://opencode.ai/config.json",
  "mcp": {
    "opentweet": {
      "type": "remote",
      "url": "https://mcp.opentweet.io/mcp",
      "enabled": true,
      "headers": {
        "Authorization": "Bearer ot_your_key"
      }
    }
  }
}

Local stdio, if you want the process on your machine

~/.config/opencode/opencode.json
{
  "$schema": "https://opencode.ai/config.json",
  "mcp": {
    "opentweet": {
      "type": "local",
      "command": ["npx", "-y", "@opentweet/mcp-server"],
      "enabled": true,
      "environment": {
        "OPENTWEET_API_KEY": "ot_your_key"
      }
    }
  }
}

Both forms expose the same tools. The full list and every argument is in the MCP docs.

The global config gotcha, and how to live with it

OpenCode reads MCP servers from global configuration, not per project. Add OpenTweet once and the agent sees it in every repository you open. This is tracked upstream in issues #9931 and #4054, and until it lands, plan around it rather than fighting it.

What this means in practice

A posting tool in every project is fine for most people and wrong for some. If you run client work in one directory and your own product in another, an agent with a single X connection can post the wrong thing from the wrong repo. Two ways out, both cheap.

Toggle enabled

Keep the entry in the global config with "enabled": false and flip it to true only while you are in the repo that posts. One field, no duplication.

Separate the accounts, not the config

On Advanced and Agency plans you can hold several X accounts under one OpenTweet key, and every posting tool takes an x_account_id. Tell the agent which account a repo belongs to in your AGENTS.md and the ambiguity goes away.

The REST fallback

When you want a post out of a script, a git hook, or CI rather than out of an agent turn, skip MCP entirely. Same key, one endpoint.

post.sh
curl -X POST https://opentweet.io/api/v1/posts \
  -H "Authorization: Bearer ot_your_key" \
  -H "Content-Type: application/json" \
  -d '{"text":"Shipped the parser rewrite. 40% faster on the same corpus.","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.

What people actually use it for

Release notes that post themselves

The agent reads the diff since the last tag, writes a human release note, and schedules it for the morning instead of shipping it at 2am.

Build in public without the context switch

You finish the feature, you say "post about this", and the terminal you were already in handles it.

A week of content between sessions

opentweet_batch_schedule fills the queue in one turn, so the account keeps moving while you are heads down.

Long-form on X

opentweet_create_article writes an X Article from markdown you already have in the repo.

The same endpoint works in Claude Code, Cursor, goose, and Kilo Code.

Frequently asked questions

How do I add an MCP server to OpenCode?

Run opencode mcp add and follow the prompts, or write the server into the mcp block of your opencode.json. For OpenTweet, use a remote entry pointing at https://mcp.opentweet.io/mcp with an Authorization header carrying your ot_ key. Restart OpenCode and the 36 OpenTweet tools appear to the agent.

Why does my OpenCode MCP config apply to every project?

Because MCP configuration in OpenCode is global rather than per project. This is tracked in issues #9931 and #4054. Until it changes, an MCP server you add for one repository is visible to the agent in all of them. For a posting tool this is usually what you want, but if it is not, keep the entry disabled in the global config and enable it only in the project where you need it.

Do I need an X developer account to post from OpenCode?

No. OpenTweet holds the X connection, the OAuth flow, and the token refresh. OpenCode authenticates to OpenTweet with one ot_ bearer key. You never create an X developer app and you never touch the pay-per-use X API.

Can the OpenCode agent schedule posts instead of publishing immediately?

Yes. opentweet_schedule_tweet queues a single post for a future time and opentweet_batch_schedule queues many at once. opentweet_create_thread publishes a connected thread in one call. Scheduling is the capability the X API does not give you at all, at any price.

Should I use the hosted MCP server or the npm package?

Use the hosted server at mcp.opentweet.io/mcp unless you have a reason not to. It needs no local install and it stays current without you upgrading anything. The npm package @opentweet/mcp-server runs locally over stdio, which is the right choice if you want the process on your own machine or you are working offline against a local mock.

What does it cost compared with calling the X API from OpenCode directly?

OpenTweet is flat: $11.99/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. If your agent posts links, which most build-in-public and release-note agents do, the flat fee wins past roughly 60 link posts a month.

Does this work with OpenCode running headless or in CI?

Yes. The hosted MCP server is a plain Streamable HTTP endpoint with a bearer key, so it works anywhere OpenCode runs, including a container with no browser. For CI specifically, the REST endpoint is often simpler: one POST to https://opentweet.io/api/v1/posts with the same key.

Give OpenCode an X account it can actually use

Connect X, copy your key, add four lines to opencode.json.

$11.99/month, API included. Cancel anytime.