mastodon-mcp
Provides 95 tools covering the Mastodon client and REST API up to Mastodon 5.0: reading home, public, hashtag and list timelines; creating, editing, deleting, boosting, favouriting, bookmarking, scheduling, quoting and threading statuses; searching; managing notifications, lists, filters, mutes and blocks; looking up accounts and managing follow relationships; and curating the authenticated profile. Accounts are connected via Mastodon's own OAuth flow and multiple accounts across different instances can be used side by side.
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
Give your AI assistant a Mastodon account. mastodon-mcp is a Model Context Protocol server that lets Claude, or any other MCP client, read timelines, post, search, manage notifications and curate your profile on any Mastodon instance.
95 tools covering the Mastodon client API, up to date with Mastodon 5.0
Multiple accounts across different instances, side by side
stdio and streamable HTTP transports
No API keys to paste: accounts are added through Mastodon's own OAuth flow
One runtime dependency: the official MCP SDK
You: What have I missed on Mastodon this morning? Skip the boosts.
Claude: (calls mastodon_get_timeline_home with exclude_reblogs)
Here's a summary of the 23 new posts on your home timeline…
You: Reply to the one about the Forgejo release and say thanks.
Claude: (calls mastodon_create_status with in_reply_to_id)
Posted: https://mastodon.social/@you/1155…Contents
Related MCP server: ActivityPub MCP Server
Quick start
You need Node.js 22.12 or newer.
The server is published on npm as @ric_/mastodon-mcp. The simplest way to run it is to let your MCP client start it with npx:
npx -y @ric_/mastodon-mcpOr install it once, which gives you a mastodon-mcp command to use in place of npx -y @ric_/mastodon-mcp:
npm install -g @ric_/mastodon-mcpThen point your MCP client at it (next section) and ask the assistant to add your Mastodon account.
From source
git clone https://code.squarecows.com/ric/mastodon-mcp.git
cd mastodon-mcp
npm install
npm run buildThat produces dist/index.js, which is the server. In the examples below, use node /path/to/mastodon-mcp/dist/index.js in place of npx -y @ric_/mastodon-mcp.
Connecting to an MCP client
Claude Code
claude mcp add mastodon -- npx -y @ric_/mastodon-mcpClaude Desktop and other stdio clients
Add the server to the client's MCP configuration (for Claude Desktop, claude_desktop_config.json):
{
"mcpServers": {
"mastodon": {
"command": "npx",
"args": ["-y", "@ric_/mastodon-mcp"]
}
}
}Streamable HTTP
Start the server yourself and connect clients to its /mcp endpoint:
npx -y @ric_/mastodon-mcp --transport http --port 3000
# listening on http://localhost:3000/mcpclaude mcp add --transport http mastodon http://localhost:3000/mcpThe HTTP transport has no authentication of its own. Read Security before exposing it beyond your own machine.
Adding a Mastodon account
Accounts are added from inside the conversation. Ask your assistant something like "add my Mastodon account on mastodon.social" and it will walk through these steps:
mastodon_add_accountregisters the app on your instance and returns an authorization link.You open the link, log in, approve access, and copy the code Mastodon shows you.
mastodon_complete_authexchanges that code for an access token and stores the account.
After that the account is remembered between sessions. mastodon_list_accounts shows what is configured, and mastodon_remove_account revokes the token and forgets the account.
Don't have an account yet? On Mastodon 5.0+ instances, mastodon_add_account with signup: true sends you to the instance's sign-up page instead of the log-in page. The account can be added straight away, and the server tells you if it is still waiting for e-mail confirmation or moderator approval.
The app requests the read, write, follow and push scopes.
Things to try
"Summarise my home timeline since yesterday, without boosts or replies."
"Who mentioned me this week? Group the notifications."
"Post this photo with alt text describing it, visible to followers only."
"Quote that post and add my thoughts, but only let followers quote mine."
"Find people posting about #selfhosting and put the interesting ones in a list."
"Create a collection called 'Rust folks' with these five accounts."
"Mute any post that mentions the election for the next 7 days."
"Update my bio and add my blog to my profile fields."
"Schedule this announcement for 9am on Monday."
Using several accounts
Every tool that talks to Mastodon accepts an optional account parameter in username@instance form, for example ric@mastodon.social.
With one account configured, it is used automatically.
With several, a call without
accountreturns an error listing the available handles, so the assistant can ask you which one you mean rather than guess.
Accounts can live on any Mastodon-compatible instance; nothing is tied to a particular server.
Command-line options
Option | Default | Description |
|
| How clients connect to the server. |
|
| Port for the HTTP transport. |
| built-in default | Passphrase used to encrypt stored credentials. See Security. |
Tool reference
All 95 tools, grouped by area. Each returns the Mastodon API's JSON response, so entity fields are the ones in the Mastodon API documentation.
Tool | What it does |
| Start the OAuth flow for an instance ( |
| Finish the OAuth flow with the authorization code |
| List configured accounts |
| Revoke the token and remove an account |
Tool | What it does |
| Post a status: text, media, polls, content warnings, scheduling, replies and quotes |
| Get a status by ID |
| Edit a status |
| Delete a status, optionally with its media |
| Get the thread around a status |
| Boost or undo a boost |
| Favourite or undo a favourite |
| Bookmark or remove a bookmark |
| List scheduled statuses |
| Cancel a scheduled status |
| List statuses quoting one of yours (4.5+) |
| Detach someone's quote from your status (4.5+) |
| Change who may quote a status (4.5+) |
Tool | What it does |
| Home timeline, with server-side filters for boosts, replies, quotes and direct posts (5.0+) |
| Local or federated public timeline |
| Posts for a hashtag |
| Posts from a list |
Tool | What it does |
| The authenticated account, including its state on 5.0+ |
| Get an account by ID |
| Find an account by handle |
| Posts by an account |
| Who follows an account, and who it follows |
| Your relationship to one or more accounts |
| Follow or unfollow |
| Mute or unmute |
| Block or unblock |
Tool | What it does |
| Your profile as raw text, ready for editing (4.6+) |
| Update name, bio, fields, avatar, header and profile settings (4.6+) |
| Remove the avatar or header (4.6+) |
| Accounts featured on a profile |
| Feature an account on your profile, or stop (4.4+) |
| Hashtags featured on your profile |
| Feature a hashtag on your profile, or stop (4.4+) |
Tool | What it does |
| List notifications, filtered by type |
| Get one notification |
| Dismiss one notification |
| Clear all notifications |
| Notifications grouped as the web interface shows them (4.3+) |
| Get one group (4.3+) |
| Everyone behind a group (4.3+) |
| Dismiss a whole group (4.3+) |
| Number of unread notification groups (4.3+) |
Tool | What it does |
| Collections created by an account |
| Collections an account is featured in |
| A collection with its accounts |
| Manage your collections |
| Add or remove an account |
| Take yourself out of someone else's collection |
Tool | What it does |
| List your lists, or get one |
| Manage lists |
| Accounts in a list |
| Add or remove accounts |
Tool | What it does |
| Search accounts, statuses and hashtags |
| Upload a local file, with alt text and focal point |
| Manage an uploaded attachment |
| List content filters, or get one |
| Manage filters that warn, hide or blur |
| Direct message conversations |
| Mark a conversation read, or remove it |
Tool | What it does |
| Instance details, limits and API version |
| What is trending |
| The instance's custom emoji |
| Announcements from the admins |
| The profile directory |
| Whether a year-in-review report exists or can be generated (4.6+) |
| Request generation of a report (4.6+) |
| Get a generated report (4.6+) |
Mastodon compatibility
The server targets the Mastodon 5.0.0 API (API version 12) and stays usable on older 4.x instances:
Parameters marked with a minimum version are ignored by older servers.
Tools marked with a minimum version return the instance's own error there, usually a 404.
Accounts added with an earlier version of this server keep working. The scopes they were granted already cover the newer endpoints.
Other software that implements the Mastodon API should work for the endpoints it supports.
Not covered: the admin API, the streaming API, and push subscriptions.
Security
Stored credentials. OAuth tokens and app credentials are kept in ~/.mastodon-mcp/accounts.json, readable only by your user and encrypted with AES-256-GCM using a key derived from the passphrase.
Without--passphrase, the file is encrypted with a default passphrase that is in this repository's source code. That keeps tokens out of plain text but does not protect them from anyone who can read the file. Set your own passphrase if that matters to you, and use the same one every time: the store cannot be read with a different one.
A passphrase given on the command line is visible in the process list and in your client's configuration file.
HTTP transport. The HTTP server has no authentication and listens on all network interfaces. Anyone who can reach the port can act as every configured Mastodon account. Keep it on a trusted machine, or put it behind a firewall or an authenticating reverse proxy.
What the assistant can do. Once an account is connected, the assistant can post, follow, block and delete on your behalf. Use your client's tool-approval settings if you want to confirm those actions.
Revoking access. mastodon_remove_account revokes the token. You can also revoke it yourself under Preferences → Account → Authorized apps on your instance.
Development
npm install
npm run dev # recompile on change
npm run build # one-off build into dist/
npm start # run the built server on stdiosrc/
├── index.ts entry point
├── cli.ts command-line options and transports
├── server.ts builds the MCP server and registers the tools
├── auth/store.ts encrypted account storage
├── lib/
│ ├── mastodon-client.ts HTTP client for the Mastodon API
│ ├── account-resolver.ts picks the account for each tool call
│ └── tool-result.ts helpers for building tool results
└── tools/ one file per group of toolsAdding a tool means registering it with server.tool(...) in the matching file under src/tools/; a new group also needs registering in src/server.ts. The test suite fails until the new tool has a request test and an entry in this README.
Testing
Command | What it checks |
| ESLint over the source, tests and scripts |
| TypeScript, including the tests |
| Unit and tool tests: every tool's request to Mastodon, the OAuth flow, the encrypted store, error handling |
| The same, failing if coverage drops below the thresholds in |
| Builds the server, runs it as a real process and talks MCP to it over stdio and HTTP, against a mock Mastodon instance |
| Packs the npm tarball, checks its contents, installs it in an empty project and runs the installed command |
| Lockfile sources, |
| Everything above |
No test talks to a real Mastodon instance or touches your real ~/.mastodon-mcp.
The same checks run in Forgejo Actions on every push and pull request, on Node 22 and 24. A separate security workflow also runs weekly and scans the git history for committed secrets with gitleaks.
Changes are recorded in the changelog.
Releasing
Releases are published to npm from GitHub, because npm's trusted publishing only accepts GitHub, GitLab and CircleCI's hosted runners. No npm token is stored anywhere: the publish job proves who it is to npm with a short-lived OIDC token, and npm attaches a provenance attestation to each release.
Bump the version in
package.json,package-lock.json(npm version --no-git-tag-version <version>),SERVER_VERSIONinsrc/server.tsand both versions inserver.json, and add aCHANGELOG.mdentry. The tests fail if these disagree.Commit, then tag and push the tag to code.squarecows.com:
git tag v1.2.0 git push origin main v1.2.0The push mirror copies the tag to github.com/richarvey/mastodon-mcp, where
.github/workflows/publish.ymlchecks the tag matches the version, runsnpm run test:all, publishes to npm, then lists the new version in the official MCP Registry asio.github.richarvey/mastodon-mcp.
License
Mastodon and the Mastodon logo are trade marks of Mastodon GmbH. This project is not affiliated with or endorsed by Mastodon GmbH.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
This server cannot be deployed
Maintenance
Related MCP Connectors
Hosted X (Twitter) MCP server for Claude, ChatGPT and Cursor, with each action switched per account.
Mastodon MCP — public Mastodon data via mastodon.social (no auth required)
Nifty's MCP server — exposes tasks, projects, messages, and files as tools for AI agents.
Hosted MCP server for AI agents to post to LinkedIn profiles and X and upload to YouTube.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceA fully working MCP server built from scratch in plain Node.js, implementing tools, resources, prompts, notifications, and sampling according to the MCP specification, designed to connect to Claude Desktop or any MCP client.37MIT
- AlicenseBqualityCmaintenanceA comprehensive MCP server that enables LLMs like Claude to explore and interact with the existing Fediverse through standardized MCP tools, resources, and prompts.1891 npm17MIT
- AlicenseCqualityBmaintenanceComprehensive MCP server for Mastodon integration, enabling AI assistants to read timelines, post statuses, manage accounts, search, and more on any Mastodon instance.543MIT
- FlicenseAqualityBmaintenanceLets AI agents schedule and publish social media posts through LazyRelay, then check that each post is really live and return a public proof link. Works with Claude, ChatGPT, Gemini and Cursor. 27 tools; the MCP server and REST API are on every plan, including the free one.27-