论坛交互工具

一个用于Hardware.fr论坛的Go工具集,提供MCP服务器和独立CLI,支持读取、发布、编辑帖子及私信功能。

  • by ForumHFR
  • Go
  • 本地部署
  • 3 星标
  • 更新于
在 GitHub 查看 XaaT/hfr-mcp

使用说明

hfr mcp

工具去 forum.hardware.fr :服务器 主控程序 对于Claude和独立CLI。

从Claude Code、Claude Desktop或终端阅读主题、发布回复、编辑消息、引用、发送MPS。

功能

操作 MCP工具 CLI
阅读主题 hfr_read hfr read <cat> <post> [page]
在打印模式下读取 hfr_read (打印=真) hfr print <cat> <post> [page]
列出类别的主题 hfr_topics hfr topics <cat> [subcat]
李斯特分类 hfr_cats hfr cats [cat]
发布回复 hfr_reply hfr reply <cat> <post> <content>
更令人毛骨悚然的话题 hfr_create_topic hfr new <cat> <subcat> <subject> <content>
编辑帖子 hfr_edit hfr edit <cat> <post> <numreponse> <content>
引用消息 hfr_quote hfr quote <cat> <post> <numreponse>
多报价 hfr_quote (麻木地) hfr quote <cat> <post> <n1> <n2> ...
发送MP hfr_mp hfr mp <dest> <subject> <content>
活动帐户 hfr_whoami hfr whoami
版本 -- hfr version / hfr-mcp --version

内容使用BBCode HFR([b], [url=], [quotemsg=...],笑脸 :o, [:pseudo]等等)。

快速启动

# Installation
go install github.com/ForumHFR/hfr-mcp/cmd/hfr-mcp@latest   # serveur MCP
go install github.com/ForumHFR/hfr-mcp/cmd/hfr@latest        # CLI

# Ou depuis les sources
go build -o hfr-mcp ./cmd/hfr-mcp/
go build -o hfr ./cmd/hfr/

配置MCP(克劳德代码)

添加到 .mcp.json 在项目的根上,或通过 claude mcp add --scope user :

{
  "mcpServers": {
    "hfr": {
      "command": "/chemin/vers/hfr-mcp",
      "env": {
        "HFR_LOGIN": "pseudo",
        "HFR_PASSWD": "motdepasse"
      }
    }
  }
}

登录是懒惰的:HFR连接仅在第一次工具调用时完成。会话在整个过程期间保持在内存(cookie jar)中。

认证

配置文件(先找到):

  1. ./hfr.conf (曲目库)
  2. ~/.config/hfr/config
login=pseudo
passwd=motdepasse

环境变量 HFR_LOGIN / HFR_PASSWD 接管文件。启动时检查文件权限:如果其他用户可以读取,则会显示警告。

身份保障

为了避免在错误的帐户下发布,经文(hfr_reply, hfr_edit, hfr_create_topic, hfr_mp)是 默认拒绝 只要没有宣布预期账户。我们声明预期账户:

  • 服务器代码: HFR_EXPECT_LOGIN (env)或 expect_login= (配置文件);
  • 每次调用:参数 expect (MCP)ou标志 --pseudo <login> (CLI)。

在pseudo上进行比较(不区分大小写) 或 userId.语法类型: pseudo:<nom>, id:<n> ;一个nu数字指向用户ID。如果连接的会话不匹配,则拒绝写入 前 哎呀。

要查找历史行为(无护栏),请导出 HFR_ALLOW_UNGUARDED_WRITES=1. hfr_whoami / hfr whoami 显示活动帐户和预期帐户。

使用CLI

# Lecture anonyme
hfr read 13 120036 350

# Derniere page
hfr read 13 120036 last

# Range de pages (concurrent)
hfr read 13 120036 340:350

# Dernieres pages relatives (les 5 dernieres)
hfr read 13 120036 last-4:last

# Mode print (~1000 posts/page, sans signatures, ~4x plus leger)
hfr print 13 120036
hfr print 13 120036 --last 20

# Lister les topics d'une categorie
hfr topics 13
hfr topics 13 431

# Lecture authentifiee
hfr --auth read 13 120036 350

# Poster une reponse (auth automatique)
hfr reply 13 120036 "Hello HFR :o"

# Poster en (dés)activant la notification e-mail du sujet (vide = conserver)
hfr reply 13 120036 "Hello" --notify on
hfr reply 13 120036 "Hello" --notify off

# Citer (retourne le BBCode [quotemsg=...])
hfr quote 13 120036 74497677

# Multiquote
hfr quote 13 120036 74497677 74497680 74497685

# Editer un post
hfr edit 13 120036 74497677 "contenu modifie"

# Envoyer un MP
hfr mp pseudo "Sujet" "Corps du message"

# Verifier le compte actif
hfr whoami

# Ecrire en exigeant un compte precis (refus si la session differe)
hfr --pseudo xatelitte reply 13 120036 "Hello"

写作命令(new, reply, edit, mp)et quote/whoami 迫切需要身份验证(自动)。 read, print, topics 和 cats 默认情况下匿名工作, --auth 以连接。圣经适用身份保障(见 身份保障).

MCP工具

输出 描述
hfr_read 阅读主题。 page=0 对于最后一页, page_from/page_to 同时倾倒杜批, print=true pour le模式印象, last=N 发布新的帖子
hfr_topics 用分页列出类别/子类别的主题
hfr_cats 列出类别(以及类别的子类别)
hfr_reply 发布回复(BBCode)。帕拉姆 expect (身份保护);帕拉姆 notify (on/off/空)要(取消)启用主题的电子邮件通知,空=保留当前状态
hfr_create_topic 更令人毛骨悚然的话题。参数 expect 对于身份保护
hfr_edit 编辑现有文章(检测第一篇文章,保留主题)。帕拉姆 expect
hfr_quote 引用一条或多条消息(numreponse 或 numreponses[])
hfr_mp 发送私人消息。帕拉姆 expect 对于身份保护
hfr_whoami 显示活动帐户(昵称+用户ID)和预期帐户

优化令牌

  • 模式打印 : print=true 加载约1000篇文章/页,而不是40篇,无签名(每篇文章轻约4倍)
  • 内容物的清洁 :签名、编辑记录和引用计数器自动删除
  • 批处理并发 :页面行并行加载(GOroutines)
  • 分页 : TotalPages 返回每个响应以导航,无需额外请求

路线图

gantt
    title hfr-mcp roadmap
    dateFormat YYYY-MM-DD
    axisFormat %b %Y

    section v1.0.0
    Core MCP + CLI               :done, v100, 2026-03-28, 2026-04-06

    section v1.1.0
    Liste des topics             :active, v110a, 2026-04-07, 2026-04-15
    Liste des categories         :v110b, after v110a, 5d
    Sortie fichier               :v110c, after v110a, 5d

    section v1.2.0
    Get BBCode (lire avant edit) :v120a, 2026-05-01, 5d
    Creation de topic            :v120b, after v120a, 7d
    Convertisseur Markdown-BBCode:v120c, after v120a, 10d
    Preview avant publication    :v120d, after v120c, 5d
    BBCode avance                :v120e, after v120b, 5d

    section v1.3.0
    Drapeaux (lire/poser/retirer):v130a, 2026-06-01, 7d
    Recherche                    :v130b, after v130a, 7d
    MPs (lire/repondre/lister)   :v130c, after v130a, 10d

    section v1.4.0
    Smileys                      :v140a, 2026-07-01, 7d
    Culture et slang HFR         :v140b, after v140a, 7d
    Skill resume de topic        :v140c, after v140a, 7d
    Documentation du protocole   :v140d, after v140b, 7d

    section v2.0.0
    Transport HTTP Streamable    :crit, v200a, 2026-08-01, 10d
    GitHub OAuth + linking HFR   :crit, v200b, after v200a, 14d
    Sessions multi-utilisateurs  :crit, v200c, after v200b, 7d
    Deploiement (Fly.io)         :crit, v200d, after v200c, 5d
    Sync repos GitHub            :v200e, after v200d, 14d

v1.0.0——核心MCP+CLI (已出版)

功能MCP和CLI服务器:读取、响应、编辑、引用、MP打印模式、并发批处理读取、内容清理、身份验证延迟。

v1.1.0-导航和效率

探索论坛并优化大型阅读的输出。

  • #13 类别中的主题列表
  • #23 类别和子类别列表
  • #22 文件输出(保存到文件而不是上下文)

v1.2.0-内容管理

编辑智能,创建主题,转换Markdown/BBCode,管理第一篇帖子。

  • #25 hfr_get_bbcode, hfr_create_topic, hfr_convert, hfr_preview
  • #16 BBCode高级和输出格式

V1.3.0-发现和通信

搜索、标志和完整的MPS。

  • #14 标志(阅读/放置/删除主题)
  • #7 通过搜索 /search.php
  • #15 MPS:读取接收框,在线程中响应

v1.4.0--文化与智能

论坛知识和自动化技能。

  • #5 表情符号集成
  • #6 文化和俚语HFR
  • #18 技能克劳德代码简历主题
  • #10 HFR协议的完整文档

v2.0.0——MCP远程

可从claude.ai web、claude code web和任何远程MCP客户端访问。

  • #24 HTTP流传输、GitHub OAuth、多用户、Fly.io部署
  • #24 双向同步GitHub休息(回购中的Markdown,HFR上的BBCode)

建筑

cmd/hfr/main.go            CLI : sous-commandes, parsing args, --auth
cmd/hfr-mcp/main.go        Serveur MCP : lazy login, transport stdio
internal/hfr/client.go     Client HTTP, login, hash_check, cookie jar
internal/hfr/reader.go     Lecture de topics, mode print, batch concurrent
internal/hfr/parser.go     Parsing HTML (goquery), nettoyage du contenu
internal/hfr/post.go       Reply + Edit (detection first post)
internal/hfr/mp.go         Messages prives
internal/hfr/models.go     Post, Topic, TopicListItem, EditInfo
internal/hfr/errors.go     Types d'erreurs HFR
internal/hfr/version.go    Constante de version
internal/config/config.go  Fichier de config + env vars + verif permissions
internal/mcp/tools.go      Declaration des outils MCP
internal/mcp/helpers.go    Formatage des resultats

两个独立的二进制文件:CLI(hfr)和MCP服务器(hfr-mcp)具有独立的生命周期和构建目标。

家属

许可证

麻省理工学院