Apr 23, 2026 12:37 PM
(This post was last modified: Apr 27, 2026 03:31 PM by NoSuchAgency.)
HF MCP Is Live:
Hack Forums API Tools For Agents
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.
![[Image: divider.gif]](https://i.ibb.co.com/N2NSzmv9/divider.gif)
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:
- Account context - read your own HF account state through `me.read`.
- Users - inspect public user data by UID.
- Root discovery - call `forums.index` / `forums_index` when you do not know any IDs yet.
- Forums - read forum sections by FID.
- Threads - browse threads inside a forum.
- Posts - read posts inside a thread, including post bodies when needed.
- Contracts - inspect contract data available to your authorized account.
- Disputes - inspect dispute records tied to contracts where your token has access.
- B-ratings - read rating history where your token has access.
- Bytes - inspect Byte activity and balances where supported.
- Signature Market (read) - read-side coverage exists in the tool surface, but I am not claiming live-proven success for every Signature Market path yet.
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
{
"tool": "forums.index",
"arguments": {
"view": "tree"
}
}Example flow metadata shape:
Code
structuredContent:
{
"forums_index": [
{
"fid": 375,
"name": "API",
"type": "forum"
}
],
"_hf_flow": {
"entry_tool": "forums.index",
"breadcrumbs": ["forum_catalog", "forums.index"],
"next_actions": [
{
"tool": "forums.read",
"arguments": {
"fid": 375
},
"reason": "Read this forum and discover threads."
}
]
}
}`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:
- Readable by default - tools return a short plain-English summary for the client UI.
- Structured for automation - every read still exposes canonical `structuredContent`, so scripts and agents can parse stable JSON instead of scraping text.
- Raw when you need it - pass `output_mode="raw"` or `include_raw_payload=true` to attach the exact upstream API payload as an MCP resource.
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
{
"tool": "posts.read",
"arguments": {
"tid": 6324346,
"per_page": 1,
"include_post_body": true,
"output_mode": "raw",
"include_raw_payload": true
}
}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
{
"tool": "threads.read",
"arguments": {
"fid": 375,
"tid": 6324346,
"output_mode": "readable"
}
}Example readable output for this launch thread:
Quote:threads.read returned 1 thread(s).
## The HF API MCP server
### Thread fields
- tid: 6324346
- fid: 375
- subject: The HF API MCP server
- dateline: 1776973048
- uid: 2047020
- username: NoSuchAgency
- views: 88
- lastpost: 1776978491
- sticky: 0
### First post fields
- firstpost.pid: 62946370
- firstpost.author.uid: 2047020
- firstpost.author.username: NoSuchAgency
### Thread body
HF MCP Is Live:
Hack Forums API Tools For Agents
[https://raw.githubusercontent.com/CortaL...o/hf_mcp/)
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:
[https://github.com/CortaLabs/hf_mcp](htt...bs/hf_mcp)
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.
The live tool returns the complete formatted thread body in this section. This example stops here only to avoid recursively embedding the launch post inside itself.
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
{
"tool": "posts.read",
"arguments": {
"tid": 6324346,
"per_page": 1,
"include_post_body": true,
"output_mode": "structured"
}
}Example structured output:
Code
content:
- type: text
text: "posts.read returned 1 row(s)."
structuredContent:
{
"posts": [
{
"pid": "62946370",
"tid": "6324346",
"fid": "375",
"subject": "The HF API MCP server",
"message": "[size=xx-large][align=center][css=68]HF MCP Is Live..."
}
]
}Raw mode is for debugging, auditing, or building tooling that needs the exact upstream HF API payload too:
Code
{
"tool": "posts.read",
"arguments": {
"tid": 6324346,
"per_page": 1,
"include_post_body": true,
"output_mode": "raw",
"include_raw_payload": true
}
}Example raw output:
Code
content:
- type: text
text: "posts.read returned 1 row(s)."
- type: resource
resource:
uri: "hf-mcp://raw/posts.read"
mimeType: "application/json"
text: "{\"posts\":[{\"pid\":\"62946370\",\"tid\":\"6324346\",\"subject\":\"The HF API MCP server\",\"message\":\"[size=xx-large][align=center][css=68]HF MCP Is Live...\"}]}"
structuredContent:
{
"posts": [
{
"pid": "62946370",
"tid": "6324346",
"subject": "The HF API MCP server",
"message": "[size=xx-large][align=center][css=68]HF MCP Is Live..."
}
]
}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:
- Thread create (`threads.create`)
- Post reply (`posts.reply`)
- Bytes transfer/deposit/withdraw/bump (`bytes.transfer`, `bytes.deposit`, `bytes.withdraw`, `bytes.bump`)
Write coverage that is not exposed right now is also explicit:
- `contracts.write` stays out of the registered surface until sandbox proof exists.
- Signature Market write operations are unsupported/unexposed in the public tool registry.
- Admin high-risk write surfaces are unsupported/unexposed.
- PM body-management tools are unsupported/unexposed.
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.
![[Image: divider.gif]](https://i.ibb.co.com/N2NSzmv9/divider.gif)
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:
- Write the reply in Markdown, because that is what most agents produce cleanly.
- Run `formatting.preflight` to convert it into HF MyCode and save a local draft artifact.
- Inspect the draft with `drafts.read`, or list/review drafts with `drafts.list`.
- Mark the draft metadata with `drafts.update` when it is ready or approved.
- Publish with `threads.create` or `posts.reply` by passing `draft_id` or `draft_path`, plus `confirm_live=true`.
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-mcp
hf-mcp setup init
hf-mcp auth bootstrap
hf-mcp doctor
hf-mcp serveThe setup flow is:
- Create your own Hack Forums API developer app from the HF user control panel.
- For the OAuth redirect, you can use the hosted GitHub Pages callback at `https://cortalabs.github.io/hf_mcp/oauth_callback.html`, or you can host the included `docs/oauth_callback.html` yourself.
- Put the client ID and client secret in local environment/config only. Do not paste secrets into client prompts or forum posts.
- Run `hf-mcp setup init` to create the local config.
- Run `hf-mcp auth bootstrap` to authorize your account and save the local token.
- Run `hf-mcp doctor` before serving. It checks config path, token path, token presence, and whether the runtime is ready.
- Point your MCP client at `hf-mcp serve`.
Example local `.env` values:
Code
HF_MCP_CLIENT_ID=your_app_client_id
HF_MCP_CLIENT_SECRET=your_app_client_secret
HF_MCP_EXTERNAL_REDIRECT_URI=https://cortalabs.github.io/hf_mcp/oauth_callback.htmlIf 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
{
"command": "hf-mcp",
"args": ["serve"]
}![[Image: divider.gif]](https://i.ibb.co.com/N2NSzmv9/divider.gif)
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:
- A personal HF assistant that can browse threads and summarize what changed.
- A drafting helper that can prepare replies while leaving the final post under your control.
- A marketplace helper that can inspect contracts, b-ratings, Bytes context, and user data before you act.
- A moderation or research helper that can collect thread context without copy-paste work.
- A forum-native agent that stays inside the account scopes you actually authorized.
That last part matters. The tool should not pretend it has more access than your token gives it.
![[Image: divider.gif]](https://i.ibb.co.com/N2NSzmv9/divider.gif)
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:
- A Python package published as `hf-mcp`.
- A CLI entrypoint: `hf-mcp`.
- Setup and auth bootstrap commands.
- A local doctor command to verify config, token state, and runtime readiness.
- A stdio MCP server for MCP clients.
- Docs for configuration, auth, tools, security model, and examples.
- Packaged usage skills for agents and clients that support skills.
- A maintained forum catalog and `_hf_flow.next_actions` contract so tools can feed the next tool call.
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.
![[Image: divider.gif]](https://i.ibb.co.com/N2NSzmv9/divider.gif)
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.
![[Image: divider.gif]](https://i.ibb.co.com/N2NSzmv9/divider.gif)
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.


![[Image: hf_mcp_banner.png]](https://raw.githubusercontent.com/CortaLabs/hf_mcp/main/docs/hf_mcp_banner.png)
