The full upstream README, mirrored here for reference. Install config, tool schemas, adoption signals, and an original overview live on the Discourse MCP Extended listing page.
This is a fork of discourse/discourse-mcp, extended with tools for working the Discourse review queue (
/review) — listing pending/flagged items and approving or rejecting them. Everything else is unchanged from upstream. See What's added in this fork below.
A Model Context Protocol (MCP) stdio server that exposes Discourse forum capabilities as tools and resources for AI agents.
src/index.ts → compiled to dist/index.js (binary name: discourse-mcp)@modelcontextprotocol/sdkdiscourse_list_reviewables — list items in the review queue (as seen at /review?sort_order=score), e.g. new/queued posts awaiting approval and flagged posts. Requires an admin or moderator API key/user API key for the site.discourse_perform_reviewable_action — approve, reject, or otherwise act on a review queue item (only registered when writes are enabled, same as other write tools).Full input/output details are in the Tools section below. Since this build isn't published to npm, run it locally from a build of this repo (pnpm install && pnpm build, then point your MCP client at dist/index.js) instead of npx @discourse/mcp@latest.
Then, in your MCP client, either:
Call the discourse_select_site tool with { "site": "https://try.discourse.org" } to choose a site, or
Start the server tethered to a site using --site https://try.discourse.org (in which case discourse_select_site is hidden).
Enable writes (opt‑in, safe‑guarded)
Alternative: if you prefer a global binary after install, the package exposes
discourse-mcp.
The server registers tools under the MCP server name @discourse/mcp. Choose a target Discourse site either by:
Using the discourse_select_site tool at runtime (validates via /about.json), or
Supplying --site <url> to tether the server to a single site at startup (validates via /about.json and hides discourse_select_site).
Auth
--auth_pairs '[{"site":"https://example.com","api_key":"...","api_username":"system"}]'--auth_pairs '[{"site":"https://example.com","user_api_key":"...","user_api_client_id":"..."}]'http_basic_user and http_basic_pass to any auth_pairs entry. This is useful for Discourse sites protected by HTTP Basic Authentication at the reverse proxy level.auth_pairs; the matching entry is used for the selected site. If both user_api_key and api_key are provided for the same site, user_api_key takes precedence.Write safety
discourse_create_post, discourse_create_topic, discourse_create_category, discourse_update_topic, discourse_create_user, discourse_update_user, discourse_upload_file, discourse_save_draft, discourse_delete_draft, discourse_perform_reviewable_action) are only registered when --allow_writes AND not --read_only.auth_pairs entry for the selected site; otherwise they return an error.Flags & defaults
--read_only (default: true)--allow_writes (default: false)--timeout_ms <number> (default: 15000)--concurrency <number> (default: 4)--log_level <silent|error|info|debug> (default: info)
debug: Shows all HTTP requests, responses, and detailed error informationinfo: Shows retry attempts and general operational messageserror: Shows only errorssilent: No logging output--show_emails (default: false). includes emails in user tools. Requires admin access--tools_mode <auto|discourse_api_only|tool_exec_api> (default: auto)--site <url>: Tether MCP to a single site and hide discourse_select_site.--default-search <prefix>: Unconditionally prefix every search query (e.g., tag:ai order:latest).--max-read-length <number>: Maximum characters returned for post content (default 50000). Applies to discourse_read_post and per-post content in discourse_read_topic. The tools prefer raw content by requesting include_raw=true.--allowed_upload_paths <paths>: Comma-separated list or JSON array of directories allowed for local file uploads. Required to enable local file uploads in discourse_upload_file. Example: --allowed_upload_paths "/home/user/images,/tmp/uploads" or --allowed_upload_paths '["/home/user/images"]'--transport <stdio|http> (default: stdio): Transport type. Use stdio for standard input/output (default), or http for Streamable HTTP transport (stateless mode with JSON responses).--port <number> (default: 3000): Port to listen on when using HTTP transport.--cache_dir <path> (reserved)--profile <path.json> (see below)Profile file (keep secrets off the command line)
Run with:
Flags still override values from the profile.
Remote Tool Execution API (optional)
tools_mode=auto (default) or tool_exec_api, the server discovers remote tools via GET /ai/tools after you select a site (or immediately at startup if --site is provided) and registers them dynamically. Set --tools_mode=discourse_api_only to disable remote tool discovery.Networking & resilience
Privacy
Resources provide static/semi-static read-only data via URI addressing. Use these instead of tools for listing operations.
discourse://site/categories
{ categories: [{id, name, slug, pid, read_restricted, topic_count, post_count, perms}], meta: {total} }perms is array of {gid, perm} where perm: 1=full, 2=create_post, 3=readonlyperms is only populated with admin/moderator auth. Without admin auth, only read_restricted boolean is available.discourse://site/tags
{ tags: [{id, name, count}], meta: {total} }discourse://site/groups
{ groups: [{id, name, automatic, user_count, vis, members_vis, mention, msg, public_admission, public_exit, allow_membership_requests}], meta: {total} }gid values from category permissions to group names, replicate group settings during migrationsdiscourse://chat/channels
{ channels: [{id, title, slug, status, members_count, description}], meta: {total} }discourse://user/chat-channels
{ public_channels: [...], dm_channels: [...], meta: {total} }discourse://user/drafts
{ drafts: [{draft_key, sequence, title, category_id, created_at, reply_preview}], meta: {total} }Built‑in tools (always present unless noted). All tools return strict JSON (no Markdown).
discourse_search
{ query: string; max_results?: number (1–50, default 10) }{ results: [{id, slug, title}], meta: {total, has_more} }discourse_read_topic
{ topic_id: number; post_limit?: number (1–50, default 5); start_post_number?: number }{ id, title, slug, category_id, tags, posts_count, posts: [{id, post_number, username, created_at, raw}], meta }discourse_read_post
{ post_id: number }{ id, topic_id, topic_slug, post_number, username, created_at, raw, truncated }discourse_get_user
{ username: string }{ id, username, name, trust_level, created_at, bio, admin, moderator }discourse_list_user_posts
{ username: string; page?: number (0-based); limit?: number (1–50, default 30) }{ posts: [{id, topic_id, post_number, slug, title, created_at, excerpt, category_id}], meta: {page, limit, has_more} }discourse_filter_topics
{ filter: string; page?: number; per_page?: number (1–50) }{ results: [{id, slug, title}], meta: {page, limit, has_more} }=category = without subcats, - prefix = exclude); tag/tags (comma = OR, + = AND) and tag_group; status:(open|closed|archived|listed|unlisted|public); personal in: (bookmarked|watching|tracking|muted|pinned); dates: created/activity/latest-post-(before|after) with YYYY-MM-DD or relative days N; numeric: likes[-op]-(min|max), posts-(min|max), posters-(min|max), views-(min|max); order: activity|created|latest-post|likes|likes-op|posters|title|views|category with optional -asc; free text terms are matched.discourse_get_chat_messages
{ channel_id: number; page_size?: number (1–50, default 50); target_message_id?: number; direction?: "past" | "future"; target_date?: string (ISO 8601) }{ channel_id, messages: [{id, username, created_at, message, edited, thread_id, in_reply_to_id}], meta }discourse_get_draft
{ draft_key: string; sequence?: number }{ draft_key, sequence, found, data: {title, reply, category_id, tags, action} }discourse_list_reviewables (requires admin/moderator API key)
{ status?: "pending"|"approved"|"rejected"|"ignored"|"deleted"|"reviewed"|"all"; type?: string; priority?: "low"|"medium"|"high"; sort_order?: "score"|"score_asc"|"created_at"|"created_at_asc"; category_id?: number; topic_id?: number; page?: number }{ reviewables: [{id, type, status, score, created_at, topic_id, category_id, post_id, target_user_id, created_by, target_created_by, title, excerpt, version, actions}], meta: {page, limit, total, has_more} }/review?sort_order=score), including new/queued posts awaiting approval and flagged posts. actions is the list of valid action ids for that item (e.g. approve_post, reject_post, agree_and_hide, disagree, delete) to pass to discourse_perform_reviewable_action. 10 items per page (Discourse's fixed page size).discourse_perform_reviewable_action (only when writes enabled; see Write safety)
{ reviewable_id: number; action_id: string; version: number; reject_reason?: string; revise_feedback?: string }{ success, reviewable_id, action_id, version, created_post_id, created_post_topic_id, reviewable_updates }discourse_list_reviewables first to get the reviewable_id, current version, and valid action_id values for that specific item.discourse_save_draft (only when writes enabled; see Write safety)
{ draft_key: string; reply: string; title?: string; category_id?: number; tags?: string[]; sequence?: number (default 0); action?: "createTopic" | "reply" | "edit" | "privateMessage" }{ draft_key, sequence, saved }discourse_delete_draft (only when writes enabled; see Write safety)
{ draft_key: string; sequence: number }{ draft_key, deleted }discourse_create_post (only when writes enabled; see Write safety)
{ topic_id: number; raw: string (<= 30k chars); author_username?: string }{ id, topic_id, post_number }discourse_create_topic (only when writes enabled; see Write safety)
{ title: string; raw: string (<= 30k chars); category_id?: number; tags?: string[]; author_username?: string }{ id, topic_id, slug, title }discourse_update_topic (only when writes enabled; see Write safety)
{ topic_id: number; title?: string; category_id?: number; tags?: string[]; featured_link?: string; original_title?: string; original_tags?: string[] }{ success, topic_id, updated_fields, topic: {id, title, slug, category_id, tags, featured_link} }discourse_list_users (requires admin API key)
{ query?: "active"|"new"|"staff"|"suspended"|"silenced"|"pending"|"staged"; filter?: string; order?: "created"|"last_emailed"|"seen"|"username"|"trust_level"|"days_visited"|"posts"; asc?: boolean; page?: number }{ users: [{id, username, name, email, avatar_template, trust_level, created_at, last_seen_at, admin, moderator, suspended, silenced}], meta: {page, has_more} }avatar_template contains {size} placeholder - replace with pixel size (e.g., 120) to get avatar URLdiscourse_create_user (only when writes enabled; see Write safety)
{ username: string (1-20 chars); email: string; name: string; password: string; active?: boolean; approved?: boolean; upload_id?: number }{ success, username, name, email, active, avatar_updated, message, avatar_error? }upload_id is provided but avatar update fails, avatar_error contains the error messagediscourse_update_user (only when writes enabled; see Write safety)
{ username: string; name?: string; bio_raw?: string; location?: string; website?: string; title?: string; date_of_birth?: string; locale?: string; profile_background_upload_url?: string; card_background_upload_url?: string; upload_id?: number }{ success, username, updated_fields, avatar_updated, user: {...}, avatar_error? }upload_id is provided but avatar update fails, avatar_error contains the error messagediscourse_upload_file (only when writes enabled; see Write safety)
{ upload_type: "avatar"|"profile_background"|"card_background"|"composer"; image_data?: string (base64); url?: string; filename?: string; user_id?: number }{ id, url, short_url, short_path, original_filename, extension, width, height, filesize, human_filesize }image_data (requires filename), remote HTTP(S) URL, or absolute local file pathuser_id is required for avatar/profile_background/card_background uploads--allowed_upload_paths configuration (security: prevents arbitrary file reads)short_url (e.g., upload://abc123.png) to embed images in posts.discourse_create_category (only when writes enabled; see Write safety)
{ name: string; color?: hex; text_color?: hex; emoji?: string; icon?: string; parent_category_id?: number; description?: string }{ id, slug, name }discourse_select_site (hidden when --site is provided)
{ site: string }{ site, title }Requirements: Node >= 24, pnpm.
Install / Build / Typecheck / Test
Project layout
src/index.tssrc/http/client.tssrc/tools/registry.tssrc/resources/registry.tssrc/tools/builtin/*src/tools/remote/tool_exec_api.tssrc/util/json_response.tssrc/util/logger.ts, src/util/redact.tsTesting notes
dist/test/**/*.js). Ensure pnpm build before pnpm test if invoking scripts individually.Publishing (optional)
@discourse/mcp and exposes a bin named discourse-mcp. Prefer npx @discourse/mcp@latest for frictionless usage.Conventions
See AGENTS.md for additional guidance on using this server from agent frameworks.
try.discourse.org:This MCP server supports two types of Discourse API authentication:
Admin API Keys (api_key + api_username)
Api-Key and Api-UsernameUser API Keys (user_api_key + optional user_api_client_id)
User-Api-Key and User-Api-Client-IdThis package includes a convenient command to generate User API Keys:
The command will:
User API Keys require an OAuth-like flow documented at https://meta.discourse.org/t/user-api-keys-specification/48536. Key steps:
/user-api-key/new with your public key, application name, client ID, and requested scopesYou can also manually create User API Keys via the Discourse UI (if enabled by the site):
create_post missing? You're in read‑only mode. Enable writes as described above.--tools_mode=discourse_api_only.discourse_select_site? Yes, start with --site <url> to tether to a single site.--timeout_ms, and note built‑in retry/backoff on 429/5xx.--log_level debug to see detailed error information including: