Skip to main content
Glama
Mfuns MCP Server
by ymltsh

Mfuns MCP Server

喵御宅(Mfuns)社区的开源 MCP(Model Context Protocol)服务器,让 AI Agent 通过标准化工具接口浏览、互动、发布、管理 Mfuns 社区内容,支持多账号组管理与操作留痕。

  • 技术栈:Python 3.10+ / MCP Python SDK 2.0+ / httpx

  • 传输方式:stdio(默认)、Streamable HTTP、SSE

  • 鉴权:多账号组(账密自动登录 / token 缓存 / 官方 API KEY),失效自动重登

  • 工具数:23 个(19 业务 + 4 身份)


功能概览(23 个工具)

Discovery 发现

工具

说明

mfuns_browse

浏览内容流:recommend 推荐 / hot 热门 / feed 全站动态 / category 分类帖子 / latest 最新聚合时间线(动态+视频+文章,LLM 友好 Markdown,来自自建服务 mfuns.wgen.top,支持 content_type 过滤)

mfuns_read

读取内容详情与评论区(resource_type 支持帖子/视频/动态,含二级回复、图片解析、评论 ID)

mfuns_search

搜索内容(文章/视频)或用户

mfuns_get_user

用户资料(互动前判断新人/老用户)

mfuns_categories

投稿分区树(叶子分区可投稿,父级分区自动落叶子)

Interaction 互动

工具

说明

mfuns_comment

评论帖子 / 评论视频 / 评论动态 / 回复评论(纯文本自动转 Quill)

mfuns_create_post

发布文章(Markdown,支持草稿、标签、封面,分区自动解析)

mfuns_create_feed

发布动态(标签、图片)

mfuns_react

点赞 / 取消 / 点踩(文章、视频、评论、动态,type 映射已实测修正)

mfuns_favorite

收藏 / 取消收藏 / 查询收藏状态

mfuns_delete

删除动态 / 评论 / 文章 / 视频投稿(仅本人内容)

mfuns_messages

私信:会话列表 / 聊天记录 / 发送(form+msg 实测可用)

Publishing 投稿

工具

说明

mfuns_publish_video_upload

本地上传视频投稿(阿里云 VOD 断点续传,支持分P;可后台任务化:多P 并行上传 + mfuns_upload_task 查询进度;任务状态落盘,重启自动续传;本地封面自动上传,缺省用平台默认封面)

mfuns_upload_task

视频上传任务查询/管理:status 任务详情(分P进度/投稿结果)/ list 任务列表 / cancel 取消任务

mfuns_publish_video_link

外链视频投稿(视频直链 URL,如复活失效的 B 站外链,支持分P)

mfuns_manage_submission

投稿管理:列表 / 详情 / 更新(文章+视频,分P增改/追加,append_files 本地上传追加分P 走后台任务,draft=true 保持草稿)

Account 账号

工具

说明

mfuns_notifications

通知消息(赞/评论/提及)与未读计数

mfuns_history

浏览历史(避免重复互动)

System 系统

工具

说明

mfuns_account_modify

添加/移除账号(添加支持账密 / Token 导入 / API Key 绑定,自动校验与查重;移除自动回退当前账号)

mfuns_account_list

查看账号组(active 标记当前身份)

mfuns_account_current

查看当前操作身份(发布前确认)

mfuns_account_switch

切换当前账号(校验身份防串号,失败自动回滚)

mfuns_activity_log

查询 Activity Log(按账号与日期隔离,支持指定账号)


Related MCP server: @agentgram/mcp-server

多账号身份管理

业务工具自动使用当前账号,无需传账号参数:

Agent → mfuns_account_switch → current_account → 业务工具 → Mfuns API
  • 每个账号独立:token / api_key / 登录凭据 / Activity Log 目录

  • 防串号:切换时调 /v1/user/info 校验 token 与账号 user_id 一致,不一致拒绝并回滚

  • 懒登录:未配置 token 的账号首次业务调用自动账密登录,token 回写 config

  • 临时 id:未登录账号可用 u_unknown_N,首次登录后自动更新为 u_<user_id>

  • 纯 api_key 账号:身份不可解析(user/info 拒绝 api_key),昵称必填、id 顺序编号(u_1、u_2…),仅用于投稿接口

  • 添加账号可用 mfuns_account_modify(action=add) 在线完成,无需手改配置文件


快速开始

1. 安装依赖

uv sync

2. 配置凭据(多账号组)

复制配置模板并填入账号:

Copy-Item config.json.example config.json
{
  "base_url": "https://api.mfuns.net",
  "accounts": [
    {
      "id": "u_38461",
      "profile": { "user_id": 38461, "user_name": "Sincerely" },
      "auth": {
        "account": "手机号/用户名",
        "password": "密码",
        "token": "登录 token(可选,留空自动登录)",
        "api_key": "官方开放平台密钥 mf_xxx(可选,仅投稿接口用)"
      },
      "enabled": true
    }
  ],
  "runtime": { "current_account": "u_38461" }
}

旧版扁平结构(token/api_key 在顶层)仍兼容:accounts 字段缺失时自动合成为单账号。

3. 启动

uv run main.py                                # stdio(默认,MCP 客户端用)
uv run main.py --transport streamable-http    # Streamable HTTP,默认 127.0.0.1:8000/mcp
uv run main.py --transport streamable-http --host 0.0.0.0 --port 9000
uv run main.py --transport sse                # SSE

启动时向 stderr 打印服务状态与使用说明(stdio 模式下 stdout 仅传输 JSON-RPC 协议)。

4. MCP 客户端接入(opencode 示例)

本地 stdio:

{
  "mcp": {
    "mfuns": {
      "type": "local",
      "command": ["uv", "--directory", "D:\\path\\to\\Mfuns MCP", "run", "main.py"],
      "enabled": true
    }
  }
}

远程 Streamable HTTP:

{
  "mcp": {
    "mfuns-http": {
      "type": "remote",
      "url": "http://127.0.0.1:8000/mcp",
      "enabled": true
    }
  }
}

Activity Log

每次 MCP 工具调用自动记录一条操作日志,按账号与日期隔离为 JSON 文件,不参与 Agent 默认上下文:

logs/activity/
├── u_38461/
│   ├── 2026-08-02.json
│   └── 2026-08-03.json
└── u_17627/
    └── 2026-08-03.json
{
  "time": "02:31:12",
  "tool": "mfuns_read",
  "action": "read",
  "target": { "type": "article", "id": 83888 },
  "params": { "resource_id": 83888 },
  "result": { "status": "success" }
}

通过 mfuns_activity_log(date, tool?, target_id?, account_id?) 按日期 / 工具名 / 对象 ID / 账号查询(默认当前账号)。不存储 LLM 思考与完整上下文;数据量大后可平滑迁移 SQLite / PostgreSQL(结构不变)。


鉴权与限速

机制

说明

会话 token

全局默认鉴权;账密自动登录,token 缓存约 25 天,401 自动重登

官方 API KEY

独立体系,仅用于投稿接口白名单(9 个 /v1/contribute/* + 素材上传);401 自动回退该账号 token

防覆盖

切换/登录只写当前账号字段,不会覆盖其他账号凭证

5 QPS

全局节流(0.25s 最小间隔)

投稿限速

投稿类接口用户级限速(约 2 分钟窗口,与网页端共享),429 消息含剩余等待时间


项目结构

main.py               # 启动入口(stdio / streamable-http / sse)
config.json           # 多账号组配置 + token 缓存(勿提交,已在 .gitignore)
config.json.example   # 配置模板
opencode.json         # opencode 本地 MCP 接入配置示例
mfuns_api_docs.md     # 社区 API 逆向文档(含实测修正标注)
mfuns_mcp/
├── server.py         # MCPServer 构建与入口
├── tools.py          # 23 个 MCP 工具定义
├── upload.py         # 视频上传管线:oss2 断点续传 / 后台任务管理 / 封面与 meta 处理
├── client.py         # HTTP 客户端:多账号上下文 / 自动登录 / 401 重登 / 限速 / 图片上传
├── activity.py       # Activity Log(按账号+日期 JSON 文件 + 工具装饰器)
├── config.py         # 多账号组配置读写与旧结构兼容
└── format.py         # 纯文本↔Quill、HTML→纯文本、时间戳格式化

已知限制

限制

说明

待审核视频不可编辑

video/update 对待审核稿件返回"系统繁忙"(服务端锁定),发布后可更新

视频投稿删除

POST /v1/contribute/video/delete 实测可用(接口未在官方文档公开),mfuns_delete(target_type=video) 已接入

收藏取消需 list_id

收藏夹枚举未暴露为工具,remove 需提供 list_id

官方全站动态流为空

/v1/feeds/list 对该账号无可展示内容,动态流建议用 latest 模式

私信空记录

早期探测产生的空消息无法删除(无删除接口)

上传任务断点续传

任务状态持久化到 logs/upload_tasks/<task_id>/task.json,服务重启后 mfuns_upload_task 首次调用自动恢复未完成任务:已完成分P 跳过、上传中分P 用 update_upload_auth 刷新凭证续传 OSS 检查点、排队分P 继续上传


参考

Available Tools

19 tools
mfuns_activity_logA

查询 Activity Log(每次工具调用的操作记录,按日期隔离的 JSON 文件)。

Args: date: 日期,格式 YYYY-MM-DD(如 2026-08-02) tool: 可选,按工具名过滤(如 mfuns_comment) target_id: 可选,按影响对象 ID 过滤(如帖子/评论 ID 83888)

Inputs: date (required), tool, target_id. Returns: result

mfuns_browseA

浏览 Mfuns 社区内容流:推荐、热门、全站动态、分类帖子或最新动态。

Args: mode: 内容流模式,可选: recommend=首页推荐, hot=热门榜, feed=全站动态, category=分类帖子列表, latest=最新动态(第三方聚合时间线 mfuns.wgen.top,返回 LLM 优化的 Markdown) category_id: 分类 ID,mode=category 时必填(如 51=交友专区,49=站内互动),其它模式忽略 limit: 返回条数上限,默认 20,最大 100 content_type: 内容类型过滤,仅 mode=latest 有效: all=全部(默认), feed=动态, video=视频, article=文章

Inputs: mode, limit, category_id, content_type. Returns: result

mfuns_categoriesA

查询投稿分区树(发布帖子/视频前用 mfuns_categories 选 category_id)。

Args: 无参数:返回完整分区树,叶子分区可投稿,父级分区仅作导航

Inputs: no named parameters. Returns: result

mfuns_commentA

发表评论或回复评论(内容为纯文本,自动转换为论坛格式)。

Args: target_type: 评论对象,可选: article=评论帖子, video=评论视频, feed=评论动态, comment=回复评论 target_id: 文章/视频/动态 ID(target_type=article/video/feed)或评论 ID(target_type=comment) content: 评论/回复内容

Inputs: content (required), target_id (required), target_type (required). Returns: result

mfuns_create_feedA

发布动态(Feed,全站动态流可见)。

Args: content: 动态内容(纯文本,自动转换为论坛格式) images: 图片 URL 列表(可选) tags: 标签列表(可选,最多 10 个)

Inputs: content (required), tags, images. Returns: result

mfuns_create_postA

发布文章帖子(纯文本或 Markdown 正文,服务端自动转换)。

Args: title: 标题(最长 30 字) content: 正文,支持纯文本或 Markdown category_id: 分类 ID(须为叶子分区;传父级分区会自动落到其第一个叶子子分区,缺省则返回可投稿分区提示;如 44=科技综合,51=交友专区) tags: 标签列表,最多 10 个 copyright: 版权,2=原创(默认),1=转载,0=其他 cover: 封面图 https 外链(可选) draft: 是否只存草稿,默认 False 直接投稿

Inputs: title (required), content (required), tags, cover, +3 more. Returns: result

mfuns_deleteA

删除内容(动态或评论,仅限本人内容)。

Args: target_type: 删除对象,可选: feed=动态, comment=评论 target_id: 对象 ID(动态 ID / 评论 ID)

Inputs: target_id (required), target_type (required). Returns: result

mfuns_favoriteA

收藏 / 取消收藏 / 查询收藏状态。

Args: resource_id: 资源 ID resource_type: 资源类型,可选: article=文章, video=视频 action: 操作,可选: add=收藏(默认), remove=取消收藏, check=查询是否已收藏 list_id: 收藏夹 ID;add 时不传则使用默认收藏夹,remove 时必填

Inputs: resource_id (required), action, list_id, resource_type. Returns: result

mfuns_get_userA

获取用户资料(互动前了解对象:判断是新人还是老用户)。

Args: user_id: 用户 ID

Inputs: user_id (required). Returns: result

mfuns_historyA

获取浏览历史(了解自己看过什么,避免重复互动)。

Args: resource_type: 过滤资源类型,可选: article=文章, video=视频;不传返回全部 limit: 返回条数上限,默认 50

Inputs: limit, resource_type. Returns: result

mfuns_manage_submissionA

管理我的投稿:查看列表 / 更新文章投稿 / 删除文章投稿。

Args: type: 稿件类型,可选: article=文章, video=视频 action: 操作,可选: list=列表(默认), update=更新, delete=删除 contribute_id: 投稿 ID(update/delete 必填) page: 页码,默认 1 size: 每页数量,默认 20,最大 100 status: 状态过滤(list 可选): 0草稿 1已发布 2待审核 3锁定 4退回修改 5定时发布 title: 新标题(update 必填) content: 新正文(update 必填,纯文本或 Markdown) category_id: 新分类 ID(update 必填) tags: 新标签(update 可选) cover: 新封面(update 可选) draft: 更新后是否保持草稿(update 可选,不传则进入审核队列;草稿稿件更新建议传 true)

Inputs: page, size, tags, type, +8 more. Returns: result

mfuns_messagesA

查看私信会话列表或与某用户的聊天记录。

Args: action: 操作,可选: list=会话列表(默认), read=读取聊天记录 user_id: 对方用户 ID(action=read 时必填)

Inputs: action, user_id. Returns: result

mfuns_notificationsA

获取通知消息(收到的赞/评论/提及)与未读计数。

Args: type: 通知类型,可选: like=收到的赞, comment=收到的评论/回复(默认), mention=@提及 page: 页码,默认 1

Inputs: page, type. Returns: result

mfuns_publish_videoA

外链视频投稿(视频直链 URL,如复活失效的 B 站外链视频;不含本地上传)。

Args: title: 标题(最长 30 字) video_url: 视频直链 URL(https) content: 简介(纯文本) category_id: 分类 ID(须为叶子分区;传父级分区会自动落到其第一个叶子子分区,缺省默认 1 动画>MMD.3D 请显式指定;如 20=游戏综合) cover: 封面图 https 外链(可选) copyright: 版权,0=其他(默认,适合转载),1=转载,2=原创 tags: 标签列表,最多 10 个

Inputs: title (required), video_url (required), tags, cover, +3 more. Returns: result

mfuns_reactA

对内容点赞 / 取消点赞 / 点踩。

Args: resource_type: 资源类型,可选: article=文章, video=视频, comment=评论, feed=动态 resource_id: 资源 ID action: 操作,可选: like=点赞(默认), cancel=取消点赞, dislike=点踩

Inputs: resource_id (required), resource_type (required), action. Returns: result

mfuns_read_feedA

读取动态详情与评论区。

Args: feed_id: 动态 ID comment_depth: 评论层级,1=只看一楼评论(默认),2=一楼评论加回复 comment_limit: 返回的评论条数上限,默认 30

Inputs: feed_id (required), comment_depth, comment_limit. Returns: result

mfuns_read_threadA

读取帖子详情与评论区(最常用的读取工具,回复前必读)。

Args: article_id: 文章 ID comment_depth: 评论层级,1=只看一楼评论(默认),2=一楼评论加回复 comment_limit: 返回的评论条数上限,默认 30

Inputs: article_id (required), comment_depth, comment_limit. Returns: result

mfuns_read_videoA

读取视频详情与评论区。

Args: video_id: 视频 ID comment_depth: 评论层级,1=只看一楼评论(默认),2=一楼评论加回复 comment_limit: 返回的评论条数上限,默认 30

Inputs: video_id (required), comment_depth, comment_limit. Returns: result

Tool Schema Changelog

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

Loading tool schema changelog…

    TDQS

    A3.9/5.0

    Scored across 19 tools

    Disambiguation4/5

    Most tools have distinct purposes, with three separate read tools clearly scoped by resource type (article/video/feed). The main ambiguity is between mfuns_delete and mfuns_manage_submission's delete action, which could confuse agents about which to use for deleting content.

    Naming Consistency4/5

    All tools share the mfuns_ prefix and mostly follow a verb_noun pattern (e.g., read_thread, create_post, publish_video). A few tools are just nouns (categories, messages, notifications, history, activity_log) and mfuns_delete lacks a noun, which is a minor deviation.

    Tool Count4/5

    19 tools is slightly above the ideal 3-15 range, but the breadth of the community platform (browsing, reading, creating, managing, social interactions, logs) justifies the count. Each tool addresses a distinct functional area, so it does not feel excessive.

    Completeness3/5

    Core workflows like browsing, reading, creating, and interacting are well covered, but private messaging is read-only (no send capability) and there is no way to update a feed post. These gaps could cause agent failures in certain interaction scenarios.

    Maintenance

    ActivityMaintained
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      D
      maintenance
      Provides 13 internet platforms as MCP tools for AI agents, enabling read, search, and interaction with services like web, YouTube, Twitter, and Reddit via a production-grade MCP server.
      1
      MIT
    • A
      license
      A
      quality
      C
      maintenance
      Enables AI agents to interact with AgentGram, the social network for AI agents, through native MCP tools for posting, commenting, voting, and managing identity.
      22
      8 npm
      1
      MIT
    • A
      license
      Not graded
      quality
      B
      maintenance
      Enables AI agents to post, schedule, thread, delete, and analyze social media posts across platforms like X, Bluesky, LinkedIn, and Instagram through a single MCP interface.
      123 npm
      MIT