DD

discourse/discourse-mcp

开发工具

本页由 AI 翻译,技术细节请以原文为准。 查看原文

81 stars 46 forks 质量 84 趋势 14MIT

discourse/discourse-mcp 是从 https://github.com/discourse/discourse-mcp. 导入的 MCP 服务器候选

概览

discourse/discourse-mcp 是从 https://github.com/discourse/discourse-mcp. 导入的 MCP 服务器候选

概述(AI 翻译)

话语MCP

一个模型上下文协议(MCP)标准服务器,将 Discourse 论坛的功能作为 AI 代理的工具和资源提供展示。

  • 入口点:src/index.ts →编译为dist/index.js(二进制名称:discourse-mcp)
  • SDK: @modelcontextprotocol/sdk
  • 节点:>= 24
  • 版本:0.3.1(简化写入选择,使--allow_writes足够,并淘汰read_only=false];0.3.0增加了操作员可选工具集、结构化目录输出和扩展的自愿管理功能;0.2.x引入了自0.1.x以来的重大变更,包括仅JSON工具输出;类别/组资源仍保留弃用兼容性面,与规范列表工具并列)

快速入门(发行)

  • 运行(只读,建议启动)

然后,在你的MCP客户端中,可以选择:

  • 调用discourse_select_site工具中的{ "site": "https://try.discourse.org" }来选择网站,或

  • 通过--site https://try.discourse.org启动服务器,连接至一个站点(此时discourse_select_site隐藏)。

  • 启用写入(选择加入,受保护)

  • 仅使用内置数据资源管理器工具运行

本页由 AI 翻译,技术细节请以原文为准。

README

以下为原文 README 节选,完整内容请查看原文。

Discourse MCP

A Model Context Protocol (MCP) stdio server that exposes Discourse forum capabilities as tools and resources for AI agents.

  • Entry point: src/index.ts → compiled to dist/index.js (binary name: discourse-mcp)
  • SDK: @modelcontextprotocol/sdk
  • Node: >= 24
  • Version: 0.3.1 (simplifies write opt-in so --allow_writes is sufficient and deprecates read_only=false; 0.3.0 added operator-selectable toolsets, structured directory output, and expanded opt-in administration capabilities; 0.2.x introduced breaking changes from 0.1.x, including JSON-only tool output; category/group resources remain deprecated compatibility surfaces alongside canonical list tools)

Quick start (release)

  • Run (read‑only, recommended to start)
npx -y @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)

npx -y @discourse/mcp@latest --allow_writes --auth_pairs '[{"site":"https://try.discourse.org","api_key":"'$DISCOURSE_API_KEY'","api_username":"system"}]'
  • Run with only Data Explorer built-in tools
npx -y @discourse/mcp@latest --toolsets data_explorer --tools_mode discourse_api_only

This exposes discourse_select_site plus the read-only Data Explorer tools. Add --site, authentication, and the write flags as needed; see Built-in toolsets.

  • Use in an MCP client (example: Claude Desktop) — via npx
{
  "mcpServers": {
    "discourse": {
      "command": "npx",
      "args": ["-y", "@discourse/mcp@latest"],
      "env": {}
    }
  }
}

Alternative: if you prefer a global binary after install, the package exposes discourse-mcp.

{
  "mcpServers": {
    "discourse": { "command": "discourse-mcp", "args": [] }
  }
}

Configuration

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 to tether the server to a single site at startup (validates via /about.json and hides discourse_select_site).

  • Auth

    • None by default.
    • Admin API Keys (require admin permissions): --auth_pairs '[{"site":"https://example.com","api_key":"...","api_username":"system"}]'
    • User API Keys (any user can generate): --auth_pairs '[{"site":"https://example.com","user_api_key":"...","user_api_client_id":"..."}]'
    • HTTP Basic Auth (for sites behind a reverse proxy): Add 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.
在 GitHub 查看完整 README

安装

npx -y @discourse/mcp@latest
新手?先看 mcpskill.org 教程 →

配置

{ "mcpServers": { "discourse": { "command": "npx", "args": ["-y", "@discourse/mcp@latest"], "env": {} } } }