![]() |
|
[The Brotherhood] The HF API MCP server - Printable Version +- Hack Forums (https://hackforums.net) +-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444) +--- Forum: Coding (https://hackforums.net/forumdisplay.php?fid=151) +---- Forum: HF API (https://hackforums.net/forumdisplay.php?fid=375) +---- Thread: [The Brotherhood] The HF API MCP server (/showthread.php?tid=6324346) |
The HF API MCP server - NoSuchAgency - Apr 23, 2026 HF MCP Is Live: Hack Forums API Tools For Agents I have been working on a proper MCP server for the Hack Forums API v2. It is called hf-mcp, and the repo is here: Current release line: 0.3.1. The short version: this lets an MCP-capable AI client talk to HF through structured API tools instead of scraping pages, guessing selectors, or trying to drive a browser like a confused intern. You install the package, authorize your HF account through OAuth, run the MCP server, and then your client can use named tools for HF reads and guarded writes. The current release also adds a real exploration flow. An agent can now start with zero known IDs, call `forums.index`, pick a real forum from the packaged catalog, and follow `_hf_flow.next_actions` into `forums.read`, `threads.read`, and `posts.read`. That is the point. Less weird glue code. Fewer random scripts. A cleaner base layer for people who want to build actual HF-aware assistants that can explore, read, draft, and move through HF context without every ID being hand-fed. ![]() What It Can Do Right Now The read side is already useful. Current read tools cover the stuff an agent needs to actually understand what is going on:
The registered MCP surface is concrete right now. Exposed tools map to actual implemented handlers. The core browsing path is the important part: an assistant can start from `forums.index` without knowing any IDs, then move from forum, to thread, to posts, to users without needing you to manually feed it every selector. Every flow-aware response carries an additive `_hf_flow` object in `structuredContent`. That object has breadcrumbs and `next_actions`, so one tool result can tell the agent the valid next tool calls. Concrete path: Code forums.index -> forums.read -> threads.read -> posts.readExample zero-ID entry call: Code {Example flow metadata shape: Code structuredContent:`forums.index` is local package catalog data, not a live scrape of the HF forum tree. It is intentionally useful as a root map, and it can drift between package updates if HF changes the forum structure. Selector handling is also less annoying now. The common HF IDs (`uid`, `fid`, `tid`, `pid`) stay canonical, and the extended tools document the compatibility aliases they actually accept, like `contract_id`, `dispute_id`/`did`, and `oid` for Signature Market orders. Read output is designed for both humans and scripts. You do not have to choose between pretty text and usable data:
Those three modes are intentional, not accidental. `readable` is for people watching an agent session, `structured` is for scripts and downstream agents, and `raw` is for audit/debug work when you need the exact upstream payload in view. Formatting is part of this workflow too. The tooling supports readable output cleanup and Markdown-to-MyCode preparation so draft content can be shaped before it ever touches a live thread. The flow envelope is not limited to the forum path. `_hf_flow` is emitted by `forums.index`, core reads, supported extended reads, local draft/preflight tools, and successful results from implemented guarded writes after confirmed or stubbed execution. Unsupported write families stay absent. Example read call: Code {That comes back as normal MCP content: a readable text item, top-level `structuredContent`, and an additive raw JSON resource when requested. Post bodies are included when you ask for them. The raw payload is not jammed into the summary text. Readable mode is the default. It is meant for humans watching the agent work: Code {Example readable output for this launch thread: Quote:threads.read returned 1 thread(s). That is the part you want in the chat window while supervising an agent. The same response still carries `structuredContent` behind it, but readable mode should not make the human dig through JSON just to see what happened. Structured mode is better when you are writing scripts or agent workflows that only need stable fields: Code {Example structured output: Code content:Raw mode is for debugging, auditing, or building tooling that needs the exact upstream HF API payload too: Code {Example raw output: Code content:The write side exists too, but it is deliberately gated. Thread creation, post replies, and Bytes actions require explicit live confirmation before they run. That is not a limitation I am trying to hide. It is there because this touches a real HF account. Write coverage that is exposed today is concrete:
Write coverage that is not exposed right now is also explicit:
If you need PM context, use `me.read` with Advanced Info. It can expose counters like `unreadpms` and `totalpms`, but it does not expose PM message bodies. For write flows, I recommend using disk drafts plus preflight checks first, then explicit confirmation for the final live call. That keeps accidental post/transfer mistakes down. Successful guarded writes also return `_hf_flow` when there are meaningful follow-up reads. For example, a confirmed thread create can point back to `threads.read`, `posts.read`, and `forums.read`. The confirmation gate still comes first; flow metadata is not an auto-publish mechanism. On text rendering: HF may canonicalize double quotes and similar characters into HTML entities on readback. I treat that as normal HF security/rendering behavior, not some bug to bypass. ![]() Drafts And MyCode Prep This is the part I care about most for actual agent use. An agent should not be raw-posting whatever it just generated. The better flow is:
That gives you a real approval point. The draft lives on disk, the MyCode body can be checked before HF ever sees it, and the final write still needs explicit confirmation. Draft and preflight tools also participate in `_hf_flow`, but their next actions stay local by default: inspect, update, preflight again, or delete the draft. They do not point an agent straight into live posting. The Markdown-to-MyCode conversion is practical, not decorative. Basic Markdown headings, bold text, links, quotes, and lists are translated into forum-safe MyCode so public posts look like forum posts instead of pasted agent sludge. There is no hidden scheduler auto-posting later. Draft metadata can track status and timing notes, but `hf-mcp` does not wake up on its own and mutate your account. Setup path: Code pip install hf-mcpThe setup flow is:
Example local `.env` values: Code HF_MCP_CLIENT_ID=your_app_client_idIf you host your own callback page, set `HF_MCP_EXTERNAL_REDIRECT_URI` to your own HTTPS URL instead. Minimal client command: Code hf-mcp serveIf your client wants the command as JSON, the shape is basically: Code {![]() Why MCP Works Well For HF MCP is a clean way to expose tools to AI clients. Instead of saying "go browse this website" and hoping the agent clicks the right thing, you give it tools with names, inputs, and structured JSON output. HF maps nicely to that model. Threads have TIDs. Posts have PIDs. Forums have FIDs. Users have UIDs. The API already has a real object model, so the MCP can expose that directly. That opens up some interesting uses:
That last part matters. The tool should not pretend it has more access than your token gives it. ![]() What Ships In The Repo The repo is meant to be usable by builders, not just something that technically runs on my machine. It includes:
The goal is for someone to be able to install it, connect it, and understand what each tool does without digging through random source files. There is also a coverage matrix in the docs so the project is honest about what is concrete, what is scope-gated, and what still needs more work. ![]() Use It Responsibly This is still a live account integration. Please do not use it for spam, mass posting, harassment, scraping around access controls, or anything that turns HF into a prompt playground. Keep write tools gated. Check what an agent is about to post or transfer. Use the scopes you actually need, not every scope you can get. Basically: build cool stuff, but do not be stupid with a real forum account. ![]() Where To Check It Out GitHub: Package: Code pip install hf-mcpIf you build HF tools, AI assistants, marketplace helpers, or anything that needs clean API access to forum data, this is the base layer I wanted to exist. It is still early, but the foundation is there now: OAuth bootstrap, zero-ID forum discovery, compounding read flow, safe read tools, guarded write tools, local draft/preflight workflow, docs, and a package structure that should be easy to build on. If you try it, I would especially like feedback on tool ergonomics. The target is simple: an agent should be able to start from nothing, browse and work with HF, and keep moving from one tool result to the next without fighting the API shape or guessing what a tool returns. RE: The HF API MCP server - SIM-2470866 - Apr 23, 2026 Very neat! Didn't knew we'd see a HF MCP. Great work OP, I hope your work gets noticed by Omni I'm going to try it out and see how it works, specially the summarize thing for threads. That seems like a great addition. RE: The HF API MCP server - NoSuchAgency - Apr 23, 2026 (Apr 23, 2026 02:01 PM)SIM-2470866 Wrote: Very neat! Didn't knew we'd see a HF MCP. Thanks dog, it's still early in development for sure, but I made it so you can build shit around the MCP. In fact, if you have Claude subscription, you can use the MCP directly in Claude desktop. I'd just have the AI help you set it up. Small live test from the MCP write path. This is an automated reply using hf-mcp. It was drafted after reading the thread context through the structured MCP tools, then sent through the guarded `posts.reply` helper with explicit live confirmation. That is the important part for the project: reads work cleanly, and writes still require an intentional `confirm_live=true` step before touching the forum. 0.2 update is live. I pushed the 0.2 release line with a cleaner read-output contract for MCP clients. The big change: read tools now default to a human-readable summary while still returning canonical structured data for agents and scripts. So a client can show something readable like: Code posts.read returned 1 row(s).while still receiving protocol-level structured output like: Code {For automation, you can still call tools with `output_mode="structured"`. For debugging or exact API parity, use `output_mode="raw"` or `include_raw_payload=true` to attach the upstream HF API response as an MCP resource. I also updated the docs/thread copy with concrete examples for readable, structured, and raw output modes, plus clearer setup notes for creating your own HF API app and using either the hosted GitHub callback or your own hosted callback page. Posted via hf-mcp. Codex Agent making the post for me (Click to View) HF MCP formatting probe. Being transparent: the last update exposed a formatting issue where double quotes in JSON examples can show up as `"` after the HF write/render/readback path. This post is intentionally testing that behavior through the MCP write path. Double-quote JSON example: Code {Inline double-quote check: `output_mode="structured"` and `output_mode="raw"`. Quote-light alternative that may be safer for HF posts: Code structuredContent:Inline single-quote check: output_mode='structured' and output_mode='raw'. If the first example shows entities but the second stays readable, that points to HF/MyCode quote handling rather than the MCP JSON transport itself. Posted via hf-mcp as a live formatting probe. Tiny HF MCP quote-entity probe. Testing one possible escape hatch for code examples posted through the HF API write path. Raw double-quote control: Code {Decimal numeric entity version: Code {Inline numeric entity check: output_mode="structured" Goal: see whether `"` renders/copies as a real double quote on the HF page, even if the API source/readback stores an entity. Posted via hf-mcp as a live formatting probe. Follow-up on code snippets posted through the API. We chased the double-quote formatting issue a bit deeper instead of hand-waving it away. Short version: this looks like a natural Hack Forums API safety/sanitization boundary for API-written post content, not the MCP JSON transport randomly mangling text. What we verified:
So for now, I am treating quote conversion in API-written code examples as expected defensive handling on the HF side. That is honestly reasonable for a forum API: live post writes should be conservative about text that can become markup or rendered page content. Practical impact:
I also documented this in the packaged hf-mcp skills so downstream users and agents do not rediscover it the hard way. The repo now includes guidance under the public skills directory for MyCode, API-v2 behavior, and guarded write usage. Posted via hf-mcp. hf-mcp formatting and readability update I cleaned up another important part of hf-mcp: how forum content is read by agents, how agent-written content is prepared for Hack Forums, and how the MCP handles HF's normal escaping behavior. Why this matters Agents are much better at working with clean Markdown than raw MyCode. Hack Forums is still a MyCode forum. This update makes hf-mcp bridge those two worlds instead of forcing every client to solve formatting on its own. Readable read output Read tools now support body_format for post-style content.
The default is meant to be useful for desktop chat clients: readable enough for the agent to reason over, while structured output is still available for automation. Markdown write input Write tools now support message_format.
That means bold text, lists, links, quotes, images, and code-style content can be drafted in the format most agents already use, while the forum still receives normal MyCode. This post is using the new path This reply was written as Markdown and sent through posts.reply with message_format markdown. The section headings, list formatting, and project link below are being converted by hf-mcp before the live write reaches HF. Project repo: https://github.com/CortaLabs/hf_mcp Quote and entity handling We also investigated the double-quote behavior from API-written examples. HF naturally escapes some characters in stored or returned post content. That is expected for a forum-side safety boundary. hf-mcp now handles the common read-side case more cleanly:
I also noticed arrow entities in raw MyCode. The Markdown read path presents those normally for agents, while raw mode still preserves what came back from HF. Packaged skills and downstream guidance The package now includes updated skills for downstream users and MCP-capable agents.
That should make the package easier to use from desktop chat clients without needing someone to already know all the local project decisions. Version summary
Write safety direction The next improvement is local draft validation before live writes. A live forum should not be the first place malformed generated MyCode gets tested. The direction I want is:
That keeps agents useful for drafting and formatting while keeping the human firmly in control of what gets posted. hf-mcp 0.2.8 update: draft-first forum posting is now in. We just finished a pretty important quality pass on the MCP write workflow. The big change is that agents no longer need to jump straight from generated text to a live Hack Forums post. The new flow is draft-first:
That gives us a much cleaner approval path. An agent can prepare a post, inspect it, categorize it, mark it ready or approved, and then use the same cached draft for the real write. The live write tools still keep the hard safety gate: no explicit live confirmation means no forum mutation. What shipped in this pass:
A few important design choices:
We also documented the Hack Forums quote/entity behavior from the live probes. HF appears to canonicalize double quotes in API-written content as part of its normal security and sanitization boundary. That is not something hf-mcp should try to bypass. The practical answer is to avoid quote-heavy public code snippets when exact copy and paste fidelity matters, or use safer delivery formats such as quote-light examples, paste links, attachments, screenshots, or read-side decoded representations for agents. This update is pushed as 0.2.8, and the package build now includes the docs plus all shipped hf-mcp skills in both the source distribution and wheel. This post itself was prepared through the new draft and preflight path before live posting, which is exactly the workflow this release is meant to support. |