Skip to main content
Glama
kafen-mcp

kafen-mcp

by ChrAlpha

kafen-mcp

An MCP server that lets AI agents read 卡粉论坛 DocOfCard, a Discourse forum about credit cards, banking and payments.

The forum requires an account to read anything. kafen-mcp signs in with a Discourse User API key issued through the forum's own device authorization page: you approve it once in your browser, and the key is limited to the read scope, so the server can browse but never post, like, or change settings.

Tools

Tool

What it does

list_topics

Latest / new / unread / top / hot feeds, optionally filtered by category and tag, paginated

read_topic

A topic's posts as Markdown (author, time, reply target, likes, reactions, polls); accepts ids or URLs and pages by post number

search

Full-text search with Discourse filters (@user, #category, tags:, in:title, status:solved, after:, order:latest …)

list_categories

Category tree with slugs, ids, topic counts and descriptions

get_user

Profile, stats, bio and recent topics/replies of a user

list_notifications

The signed-in account's notifications (does not mark them read)

view_image

Fetches a screenshot or image from a post and returns it to the model

login / auth_status

Start the browser authorization from inside the agent and check which account is active

Post HTML is converted to compact Markdown: images link to the original upload (with the forum's AI caption as alt text when available), quotes name their source post, and oneboxes collapse to a titled link.

Related MCP server: Discourse MCP

Setup

Requires Node.js 22 or newer.

git clone https://github.com/ChrAlpha/kafen-mcp.git
cd kafen-mcp
pnpm install
pnpm build

Authorize

node dist/cli.mjs login

The command prints a link and a confirmation code. Open the link in a browser where you are logged in to the forum, check the code, and click Authorize. The key is stored in $XDG_CONFIG_HOME/kafen-mcp/credentials.json (usually ~/.config/kafen-mcp/, %APPDATA%\kafen-mcp\ on Windows) with 0600 permissions.

You can skip this step and let the agent call the login tool instead; it returns the same link and code for you to open, and auth_status waits for the approval.

node dist/cli.mjs status   # which account is active
node dist/cli.mjs logout   # revoke the key on the forum and delete it locally

The key also appears under Preferences → Apps on your forum profile (/my/preferences/apps), where it can be revoked at any time.

Register with an MCP client

Claude Code:

claude mcp add kafen -- node /absolute/path/to/kafen-mcp/dist/cli.mjs

Claude Desktop, Cursor and other clients that use an mcpServers JSON block:

{
  "mcpServers": {
    "kafen": {
      "command": "node",
      "args": ["/absolute/path/to/kafen-mcp/dist/cli.mjs"]
    }
  }
}

Codex (~/.codex/config.toml):

[mcp_servers.kafen]
command = "node"
args = ["/absolute/path/to/kafen-mcp/dist/cli.mjs"]

Configuration

Variable

Default

Purpose

KAFEN_BASE_URL

https://forum.docofcard.com

Forum to read; any Discourse site with user API keys enabled works

KAFEN_MCP_CONFIG_DIR

$XDG_CONFIG_HOME/kafen-mcp

Where credentials.json lives

KAFEN_USER_API_KEY

—

Use this key instead of the credential store (for CI or containers)

KAFEN_USER_API_CLIENT_ID

kafen-mcp

Client id the key in KAFEN_USER_API_KEY was issued to

Rate limits

Discourse allows about 50 requests per minute and 4,000 per day for each User API key. The client keeps itself under 45 requests per minute, waits out short 429 responses once, and reports longer waits to the agent instead of blocking. Most tools cost one request; read_topic with a large limit and get_user cost up to three.

Development

pnpm typecheck
pnpm test                 # unit tests
pnpm build && KAFEN_E2E=1 KAFEN_BASE_URL=https://meta.discourse.org pnpm test e2e

The end-to-end suite drives the built server over stdio against a live forum. To run it against DocOfCard, log in first and pass the same KAFEN_MCP_CONFIG_DIR.

License

MIT

Available Tools

9 tools
auth_statusAuthorization statusA
Read-onlyIdempotent

Report whether the server can read the forum and as which user. With wait_seconds, first waits for a pending login to be approved.

Inputs: wait_seconds.

get_userGet user profileA
Read-onlyIdempotent

Show a user's profile, activity stats, bio, and their most recent topics and replies.

Inputs: username (required), recent.

list_categoriesList categoriesA
Read-onlyIdempotent

List all forum categories and subcategories with slugs, ids, topic counts and descriptions.

Inputs: no named parameters.

list_notificationsList notificationsA
Read-onlyIdempotent

List the logged-in account's notifications (replies, mentions, quotes, likes, messages, badges), newest first. Reading them does not mark them as read.

Inputs: limit, unread_only.

list_topicsList topicsA
Read-onlyIdempotent

List topics from a feed, optionally limited to a category and/or tag. Returns titles, ids, stats and last activity; use read_topic for content.

Inputs: tag, feed, page, order, +3 more.

loginLog in to the forumA
Idempotent

Start a browser-based authorization that issues a read-only API key for this server. Returns an approval link and confirmation code that the user must open while logged in to the forum. Reuses an in-flight request; does nothing if a working key is already present.

Inputs: no named parameters.

read_topicRead topicA
Read-onlyIdempotent

Read a topic's posts as Markdown, with author, time, reply target, likes and polls. Accepts a topic id or any topic URL (a post number in the URL becomes the starting post).

Inputs: topic (required), limit, post_number.

view_imageView imageA
Read-onlyIdempotent

Fetch an image referenced in a post (forum uploads or external links) and return it so it can be looked at. PNG, JPEG, GIF and WebP up to 10 MB.

Inputs: url (required).

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A4/5.0

    Scored across 9 tools

    Disambiguation5/5

    Each tool targets a distinct resource or action: categories, topic feeds, topic content, full-text search, users, notifications, images, and the two auth operations. The only potential overlap (list_topics vs. search) is clearly resolved by the descriptions distinguishing feed browsing from full-text querying. login vs. auth_status are cleanly split into 'start' and 'check status'.

    Naming Consistency4/5

    All names are consistent snake_case with meaningful verbs (list_categories, read_topic, get_user, view_image, list_notifications). Minor deviations exist where a bare verb is used without an object noun (login, search, auth_status), but the pattern remains predictable overall.

    Tool Count5/5

    Nine tools is well within the ideal 3-15 range and every tool earns its place in a read-only forum client. No redundant or filler tools are present, and auth is handled with just two tools.

    Completeness4/5

    For a deliberately read-only forum surface, coverage is strong: categories, feeds, topic reading, search with rich filters, user profiles, notifications, images, and auth lifecycle. Minor gaps remain (e.g. no standalone tag listing or direct single-post fetch), and write operations are absent by design rather than omission.

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      A
      quality
      C
      maintenance
      Enables AI agents to interact with Discourse forums through search, reading topics/posts, managing categories and users. Supports secure authentication and optional write operations with rate limiting.
      14
      11,259 npm
      79
      MIT
    • A
      license
      A
      quality
      D
      maintenance
      Enables AI agents to interact with Discourse forums through search, reading topics/posts, managing categories and tags, chat channels, and optionally creating content with safeguarded write operations.
      15
      11,259 npm
      MIT
    • F
      license
      A
      quality
      C
      maintenance
      Enables an AI agent to read and act on a single Discourse forum as one user, including posting, private messages, likes, reactions, bookmarks, watch/track/mute, and reading its own notifications via a stdio MCP server.
      8
      -