MCP for Flarum
This server gives MCP-compatible AI clients comprehensive access to a Flarum forum's API, along with documentation, development references, and optional extension management.
Forum Resource Management (Read)
List/browse resources (
flarum_list): Any Flarum resource collection (discussions, posts, users, tags, groups, etc.) with filtering, sorting, pagination, and relationship includesGet a single resource (
flarum_get): Fetch one resource by type and IDSearch discussions (
flarum_search): Full-text search across discussionsWhoami (
flarum_whoami): Check forum info and the current API key's user/permissions
Forum Resource Management (Write)
Create/update/delete resources (
flarum_create,flarum_update,flarum_delete): Full CRUD on any Flarum resource via JSON:API, including moderation actions (lock, sticky, approve, hide, change groups)Start a discussion (
flarum_create_discussion): Create a new thread with title, content, and optional tagsReply (
flarum_reply): Post a reply to an existing discussionRaw API request (
flarum_request): Make arbitrary HTTP requests to any endpoint, including custom extension routes
Official Documentation Tools
Search, list, and read Flarum 2.0 docs (
flarum_docs_search,flarum_docs_list,flarum_docs_get) — works without an API key, even in read-only mode
Extension Development Reference
Dev guide (
flarum_dev): Comprehensive reference for building Flarum 2.0 extensions — scaffolding, frontend (TypeScript), backend (API/models/migrations), i18n, testing, CI, releasing, and porting from 1.x
Troubleshooting Guide
flarum_troubleshoot: Plain-language guidance for admins on diagnosing issues, reading logs, common errors, and preparing support requests
Optional Extension Management (requires FLARUM_EXTENSIONS=1 and flarum/extension-manager)
Search Packagist, install, update, remove, enable, or disable extensions via Composer; supports dry-run and update checks
Key Constraints
Supports read-only mode (
FLARUM_MODE=read) to block all mutating operationsConfigurable via environment variables (URL, API key, user context, timeouts, HTTP transport)
Provides tools for searching Packagist for installable Flarum extensions, checking compatibility, installing, updating, removing, and managing extensions via Composer.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@MCP for Flarum search for discussions about AI"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
MCP for Flarum
Retired (October 2026). This project is no longer maintained, and the repository is archived and read-only. It gets no updates or security fixes, and issues and pull requests are closed. The code stays here for reference under its license.
A Model Context Protocol server for Flarum.
It gives any MCP-compatible AI client (Claude Code, Claude Desktop, Cursor, VS Code, Windsurf, Zed, and others) full access to a Flarum forum's API: read and search discussions and posts, create threads and replies, manage users, tags and groups, moderate content, change settings, and call any third-party extension endpoint.
Flarum's whole API is uniform JSON:API, so a small set of generic tools covers the entire surface, including extensions, rather than hundreds of hand-written ones.
Tools
Generic (full API coverage):
Tool | What it does |
| List/search any resource type with filters, includes, sort, pagination |
| Fetch one resource by type and id |
| Create any resource |
| Update any resource (also lock/sticky/approve for moderation) |
| Delete any resource |
| Raw escape hatch for any endpoint |
Convenience:
Tool | What it does |
| Forum info + the user the API key acts as |
| Full-text discussion search |
| Start a thread (title + content + optional tags) |
| Reply to a discussion |
Official docs (on by default):
Search and read Flarum's official 2.0 documentation so the AI can check how a setting, permission, extender, or REST endpoint is meant to work before acting. These read the public docs only (never your forum or its key), so they work in any mode, including read-only and with no API key. They read the live docs, so results always reflect the current 2.0 documentation. Turn them off with FLARUM_DOCS=0.
Tool | What it does |
| Search the 2.0 docs; returns ranked pages with snippets |
| Read a full docs page as Markdown (by slug, path, or URL) |
| List/browse the available 2.0 docs pages |
Extension development (on by default):
A development reference for building or reviewing a Flarum 2.0 extension: scaffolding and architecture, composer.json, the TypeScript frontend, backend (API resources/models/migrations), i18n, testing, static analysis & CI, and releasing. Combines the conventions the official docs establish, the de-facto FriendsOfFlarum standard, and patterns that prevent real production bugs. Static content, so it works in any mode, including read-only and with no API key. Turn it off with FLARUM_DEV=0.
Tool | What it does |
| Returns the extension-development reference; optional |
Troubleshooting (on by default):
Plain-language help for a broken or misbehaving forum, aimed at admins rather than developers: safe first-aid fixes, how to run php flarum info and find your logs on typical hosting, what the common errors actually mean, and how to write a redacted support request. Static knowledge that needs no server access, so it works in any mode, including read-only and with no API key. Turn it off with FLARUM_TROUBLESHOOT=0.
Tool | What it does |
| Returns the troubleshooting guide; optional |
Extension management (opt-in, off by default):
Registered only when FLARUM_EXTENSIONS=1 and the forum has the official flarum/extension-manager installed. These drive Composer on the server, so they need an admin key and write mode. See Managing extensions.
Tool | What it does |
| Search Packagist for installable extensions, language packs, or themes |
| Dry-run compatibility check for a package (changes nothing) |
| Install an extension (optionally enable it after) |
| Update one extension ( |
| Uninstall an extension |
| Enable/disable an installed extension (no Composer; instant) |
| Check Packagist for available updates |
| Bulk update: |
| Read/set |
| List install/update job history and Composer output (poll async jobs) |
Control-plane hooks (dormant unless you wire them up):
Two capabilities stay inactive unless you point them at a service that answers them. They are gated on DIAG_URL and SNAPSHOT_URL; with those unset, which is the default, the diagnostic tools never register and the snapshot hook is a no-op. Nothing here is closed off — the code is MIT like the rest, so you can point them at a backend of your own.
Capability | Gate | What it does |
|
| Read-only troubleshooting through a hosting control plane (boot errors, post-update breakage, mail/queue failures), which keeps working even when Flarum itself won't boot. See docs/managed-troubleshooting.md. |
Pre-change snapshot |
| Best-effort restore point taken before the first write of a session. See |
Every other tool above (generic, convenience, docs, dev, and extension management) works out of the box with no such backend.
Related MCP server: flarum-mcp
Prompts
The server also ships prompts: named, ready-made workflows that chain the right tools in the right order, so you don't have to describe the whole job yourself. Clients surface them in their own way (Claude Code lists them as slash commands, Claude Desktop under the prompts menu).
Prompt | What it does |
| Scaffolds and builds a Flarum 2.0 extension, following the |
| Reviews existing extension code against those same contracts |
| Checks an extension against real production stacks (queue drivers, Redis, multi-server, sub-path URLs) |
| Assembles a redacted support request from a forum that still loads |
The first three come with the extension-development reference (FLARUM_DEV), the last with the troubleshooting guide (FLARUM_TROUBLESHOOT); disabling either hides its prompts too.
Configuration
Variable | Required | Description |
| yes | Your forum's base URL, e.g. |
| for writes / private data | A Flarum API key (from the |
| optional | Act as this user id when using a master API key |
| optional |
|
| optional |
|
| optional | On by default. Set |
| optional | On by default. Set |
| optional | On by default. Set |
| optional | Request timeout in ms (default 30000) |
| optional | Override the |
Behind Cloudflare or a WAF
Many Flarum forums sit behind Cloudflare. Some WAF configurations block requests whose User-Agent looks scripted or empty, returning Cloudflare error 1010 (browser_signature_banned) before the request ever reaches Flarum. The server sends a descriptive, identifiable User-Agent by default for exactly this reason, so the common case works out of the box.
If your forum still blocks it, allowlist the tool rather than loosening your firewall:
Allowlist the User-Agent. In Cloudflare, add a WAF rule like
User-Agent contains "mcp-for-flarum"→ Skip / Allow. The default UA ismcp-for-flarum/<version> (+https://github.com/linkrobins/mcp-for-flarum).Or allowlist the server IP (best for a hosted/single-source deployment).
Or set a custom UA with
FLARUM_USER_AGENTto match an existing allow rule.
Do not work around this by spoofing a browser User-Agent: it is fragile and makes the traffic impossible to allowlist or audit.
Getting an API key
Flarum has no admin UI for API keys yet. Create one directly in the database:
INSERT INTO api_keys (`key`, user_id, created_at)
VALUES (REPLACE(UUID(), '-', ''), 1, NOW());Use the resulting key as FLARUM_API_KEY. Setting user_id (or FLARUM_USER_ID) makes the key act as that user, so its permissions are exactly that user's permissions.
Managing extensions
Set FLARUM_EXTENSIONS=1 to let the AI install, update, remove, enable, and disable extensions. This is off by default because it runs Composer on your server and can change what code your forum runs, which is far more powerful than editing content. It requires all of:
The official
flarum/extension-managerinstalled and enabled on the forum.Write mode (not
FLARUM_MODE=read) and an API key whose user is an admin.A server that can actually run Composer: the PHP functions
proc_openandescapeshellargavailable, andvendor/,storage/,composer.json, andcomposer.lockwritable.
How long-running installs are reported depends on your forum's queue:
Background queue (Redis, database, etc. with a running worker): the call returns once the job finishes. The tools poll the manager's task list for you and return the Composer output. If no worker is consuming jobs, the call times out and says so rather than hanging.
Synchronous (
syncqueue, or the manager's "run jobs in background" setting off): the request blocks until Composer finishes and returns the result inline. Very large updates can hit PHP/gateway timeouts even though Composer keeps running.
flarum_ext_install does not enable the extension unless you pass enable: true. Use flarum_ext_why_not first to confirm a package is compatible with your Flarum version. For bulk or major updates, take a backup first.
Enabling can break a forum. The manager refuses to install an extension whose published Flarum compatibility doesn't match your version, but that check is best-effort: it reads the latest stable release's declared flarum/core constraint, is skipped when Packagist is unreachable or the package declares nothing, and the version Composer actually installs can differ from the one it checked. So an extension can pass the check and still fail to boot when enabled, taking the whole site down (every page, including the admin panel and this tool's own API, starts returning a 500). The manager cannot then disable it for you: recovery means removing the extension from the extensions_enabled setting in the database and composer remove-ing it by hand. This is why install does not auto-enable by default, and why a backup before enabling unfamiliar extensions is worth it.
Install & run
Two one-line options, neither of which needs a checkout: a Docker image, or npx pointed straight at this repository. Pick whichever runtime you already have.
Both accept the same configuration. Leave out FLARUM_API_KEY to start with public read-only access, or set FLARUM_MODE=read to guarantee the AI can never change anything.
Option 1: Docker
For a local Claude client (stdio):
docker run -i --rm \
-e FLARUM_URL=https://discuss.example.com \
-e FLARUM_API_KEY=xxxxx \
ghcr.io/linkrobins/mcp-for-flarumClaude Code:
claude mcp add flarum -- docker run -i --rm -e FLARUM_URL=https://discuss.example.com -e FLARUM_API_KEY=xxxxx ghcr.io/linkrobins/mcp-for-flarumClaude Desktop / Cursor / Windsurf (JSON config):
{
"mcpServers": {
"flarum": {
"command": "docker",
"args": ["run", "-i", "--rm", "-e", "FLARUM_URL", "-e", "FLARUM_API_KEY", "ghcr.io/linkrobins/mcp-for-flarum"],
"env": {
"FLARUM_URL": "https://discuss.example.com",
"FLARUM_API_KEY": "xxxxx"
}
}
}
}Option 2: npx, straight from this repo (no Docker)
If you have Node.js 18+ and git, npx can fetch, build, and run it in one step. There is nothing to clone and nothing to install.
Claude Code:
claude mcp add flarum \
-e FLARUM_URL=https://discuss.example.com \
-e FLARUM_API_KEY=xxxxx \
-- npx -y github:linkrobins/mcp-for-flarumClaude Desktop / Cursor / Windsurf / VS Code / Zed (JSON config):
{
"mcpServers": {
"flarum": {
"command": "npx",
"args": ["-y", "github:linkrobins/mcp-for-flarum"],
"env": {
"FLARUM_URL": "https://discuss.example.com",
"FLARUM_API_KEY": "xxxxx"
}
}
}
}The first run compiles the TypeScript, so it takes a few seconds; npx caches the result and later starts are fast. Pin a release by appending a tag, e.g. github:linkrobins/mcp-for-flarum#v0.8.0, which is worth doing for anything long-lived. To install it once instead of resolving on each start:
npm install -g github:linkrobins/mcp-for-flarumand use mcp-for-flarum as the command.
This project is not published to the npm registry, so
npm install mcp-for-flarumwill not find it (and if that name ever does resolve, it is not this project). Use thegithub:form above.
Option 3: From source
git clone https://github.com/linkrobins/mcp-for-flarum.git
cd mcp-for-flarum
npm install && npm run build
FLARUM_URL=https://discuss.example.com FLARUM_API_KEY=xxxxx node dist/index.jsThen point your client's command at node /absolute/path/to/mcp-for-flarum/dist/index.js.
Hosting (HTTP transport)
The same binary can run as a long-lived web service over Streamable HTTP, so you can host it instead of running it locally. This is what web-based clients (which can't spawn a local process) connect to.
Start in HTTP mode with --http (or MCP_TRANSPORT=http):
FLARUM_URL=https://discuss.example.com \
FLARUM_API_KEY=xxxxx \
MCP_AUTH_TOKEN=a-long-random-secret \
PORT=3000 \
npx -y github:linkrobins/mcp-for-flarum --http(From a source checkout, node dist/index.js --http does the same.)
It serves:
POST /mcp, the MCP endpoint (Streamable HTTP, stateless)GET /health, health check for load balancers / uptime monitors
Hosting-specific configuration:
Variable | Default | Description |
|
| Set to |
|
| HTTP port |
|
| Bind address. Fails closed: it refuses to bind a non-localhost address unless |
| (none) | If set, requests must send |
| (none) | Optional control-plane hook. When set, the server fires a best-effort |
|
| Bearer token sent with the |
Security: a hosted instance can read, write, and delete on the forum its key targets. Always run it behind TLS, set
MCP_AUTH_TOKEN(or front it with your own auth/OAuth proxy), and give the API key's user the least privilege it needs. The Flarum API key stays server-side and is never exposed to clients.
Docker (hosted mode)
docker run -p 3000:3000 \
-e MCP_TRANSPORT=http \
-e HOST=0.0.0.0 \
-e FLARUM_URL=https://discuss.example.com \
-e FLARUM_API_KEY=xxxxx \
-e MCP_AUTH_TOKEN=a-long-random-secret \
ghcr.io/linkrobins/mcp-for-flarumHOST=0.0.0.0 is needed so the published port is reachable; the server only allows it because MCP_AUTH_TOKEN is set.
Or use the included docker-compose.yml: set your values and docker compose up -d.
Development
npm install
npm run build
FLARUM_URL=... FLARUM_API_KEY=... node dist/index.jsLicense
MIT © Link Robins. Free and open source — self-host it, modify it, and use it however you like.
Commercial and hosted use is welcome, and needs no permission. Run it for clients, bundle it into a paid product, offer it as a hosted service, fork it, rebrand it: MIT already allows all of that, and there is no separate license to buy, no key to obtain, and no tier that unlocks anything. Nothing in the code is held back — the two control-plane hooks above are dormant integration points, not a paywall, and you are free to point them at infrastructure of your own. The only ask is the one the license makes: keep the copyright notice. If you build something with it, I would love to hear about it.
Trademarks
Flarum is a trademark of the Flarum Foundation. This is an independent project that works with Flarum via its API; it is not affiliated with, endorsed by, or sponsored by the Flarum Foundation.
Available Tools
15 toolsflarum_createCreate a Flarum resourceB
Create any Flarum resource via JSON:API. Provide the resource type, its attributes, and optional relationships. Requires an API key whose user has permission. Example: type="discussions", attributes={ title, content }, relationships={ tags: { data: [{ type: "tags", id: "1" }] } }.
Inputs: type (required), attributes (required), relationships.
flarum_create_discussionCreate a discussionA
Start a new discussion (thread) with a title and first-post content. Optionally attach tag ids (required by forums that use the Tags extension).
Inputs: title (required), content (required), tagIds.
flarum_deleteDelete a Flarum resourceA
Delete any Flarum resource by type and id (e.g. delete a post, discussion, or user). Irreversible. Requires appropriate permissions on the API key's user.
Inputs: id (required), type (required).
flarum_devFlarum extension development referenceA
A development reference for building or reviewing a Flarum 2.0 extension: scaffolding and architecture, composer.json, the TypeScript frontend, backend (API resources/models/migrations), scaling (queue-driver portability, Redis, multi-server file storage), optional ecosystem integrations (realtime, audit, fof widgets, fof sitemap), i18n, testing, static analysis & CI, releasing, and porting a 1.x extension to 2.0. Combines the conventions the official docs establish, the de-facto FriendsOfFlarum standard, and patterns that prevent real production bugs (fail-closed API fields, lazy-chunk-safe extends, atomic creation, the PHPStan/testing setup). Consult it before scaffolding, when adding a feature, or when reviewing extension code. Pair with flarum_docs_search/flarum_docs_get for the authoritative API reference. Omit topic for the full reference, or pass one to narrow it.
Inputs: topic.
flarum_docs_getRead a Flarum docs pageA
Fetch the full Markdown of one Flarum 2.0 documentation page. Accepts a page slug ("rest-api", "extend/api"), a site path ("/2.x/rest-api"), or a full docs URL (any #anchor is ignored). Reads the page's Markdown source, so code blocks and headings are preserved. Pair with flarum_docs_search to find the right page first.
Inputs: page (required), maxChars.
flarum_docs_listList Flarum docs pagesA
List the available Flarum 2.0 documentation pages (paths and URLs), from the live sitemap. Useful to discover what pages exist before reading one with flarum_docs_get. Optionally pass a substring to filter by path, e.g. filter="extend".
Inputs: filter.
flarum_docs_searchSearch Flarum docsA
Search the official Flarum 2.0 documentation (docs.flarum.org/2.x) and return ranked results with their page path and a snippet. Use this to look up how something works -- admin settings, permissions, extenders, REST API usage, extension development -- before acting on a forum. Reads the live docs, so results reflect the current docs. Then call flarum_docs_get with a result's "page" to read the full page. Example: query="approve posts permission".
Inputs: query (required), limit.
flarum_getGet a Flarum resourceA
Fetch a single Flarum resource by type and id, optionally including relationships and narrowing fields. Returns full field values by default (no truncation). Example: type="discussions", id="42", include="posts,user".
Inputs: id (required), type (required), fields, include, +1 more.
flarum_listList Flarum resourcesA
List or search any Flarum resource collection (discussions, posts, users, tags, groups, notifications, flags, etc., including third-party extension resources). Supports JSON:API filter, include, sort, pagination, and sparse fieldsets. Long text fields are truncated by default to protect context -- raise maxFieldChars or use fields/flarum_get to read full content. Example: type="discussions", filter={ q: "search terms" }, include="user,tags".
Inputs: type (required), sort, limit, fields, +4 more.
flarum_replyReply to a discussionB
Post a reply (comment) to an existing discussion by its id.
Inputs: content (required), discussionId (required).
flarum_requestRaw Flarum API requestA
Escape hatch: make an arbitrary request to any Flarum API endpoint, for anything not covered by the typed tools (custom extension routes, non-JSON:API endpoints, etc.). In read-only mode, non-GET methods are refused. Path is relative to the API root, e.g. "/discussions" or "/fof/gamification/ranks".
Inputs: path (required), body, query, method.
flarum_searchSearch discussionsA
Full-text search across discussions using Flarum's gambit/search (filter[q]). Long fields are truncated by default. Example: query="upgrade postgres".
Inputs: query (required), limit, fields, include, +1 more.
flarum_troubleshootFlarum troubleshooting & support-request guideA
A plain-language guide for forum ADMINS and non-developers to diagnose a broken or misbehaving Flarum forum and prepare a request for help (distinct from flarum_dev, which is for building extensions). Covers safe first-aid fixes, how to run php flarum info and find logs on their hosting, what common errors mean, and how to write a redacted support request and where to post it. Use it whenever a user describes a forum problem or asks how to get help, and pair it with the prepare-flarum-support-request prompt to assemble a report from a forum that still loads. Omit topic for the full guide, or pass one to narrow it.
Inputs: topic.
flarum_updateUpdate a Flarum resourceA
Update (PATCH) any Flarum resource by type and id. Used for editing posts/discussions and for moderation: lock/sticky a discussion, approve/hide a post, change user groups, etc. Example: type="discussions", id="42", attributes={ isLocked: true }.
Inputs: id (required), type (required), attributes, relationships.
flarum_whoamiCurrent Flarum userA
Return the forum's basic info and the user the configured API key acts as. Useful to verify connectivity and permissions.
Inputs: no named parameters.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 15 tools
Most tools have clear roles, and the generic CRUD verbs (flarum_create/update/delete) are easy to distinguish from the docs and reference tools. However, flarum_list vs flarum_search and flarum_create vs flarum_create_discussion overlap in behavior, even though the descriptions point to the specialized helper being more convenient.
All tools share the flarum_ prefix and use readable verbs, but the conventions are mixed: core API verbs are single-word (flarum_get, flarum_update), docs tools reverse the order (flarum_docs_get, flarum_docs_search), and flarum_create_discussion follows verb_noun. flarum_whoami, flarum_dev, and flarum_troubleshoot are standalone names that don't fit a verb_noun pattern.
Fifteen tools is within the ideal range and matches a broad purpose: Flarum API CRUD, discussion helpers, documentation lookup, and admin/dev guidance. The generic resource tools plus convenience wrappers and an escape hatch give the set a clear rationale without feeling bloated.
The generic flarum_list/get/create/update/delete tools provide near-complete lifecycle coverage for any Flarum resource, and flarum_request covers any remaining API endpoint. Discussion creation/reply, docs search/get, and whoami cover the main forum-administration and learning workflows, leaving no obvious dead ends.
Maintenance
Related MCP Connectors
Create AI Characters and generate their DM and comment replies from any MCP client.
Search or monitor any Flarum-powered forum for discussions, replies, participants, dates, and…
Official Fibery MCP server: query and update your workspace from any AI client via OAuth.
MCP server for AI dialogue using various LLM models via AceDataCloud
Related MCP Servers
- AlicenseNot gradedqualityBmaintenanceMCP server for NodeBB forums that enables AI assistants to access forum data, search topics, and perform semantic search via the Model Context Protocol.514 npmMIT
- AlicenseAqualityDmaintenanceMCP server for Flarum forums that enables searching, reading, and posting discussions through Flarum's REST API.717 npmMIT
- AlicenseNot gradedqualityDmaintenanceA comprehensive Discord MCP server enabling AI assistants to run a Discord community through 111 tools for messaging, moderation, roles, channels, forums, webhooks, and more, plus a raw REST API passthrough for full Discord API access.MIT
- FlicenseAqualityCmaintenanceEnables an AI agent to read and act on a single Discourse forum as one user, including posting, private messages, likes, reactions, bookmarks, watch/track/mute, and reading its own notifications via a stdio MCP server.8-