Skip to main content
Glama

habitca-mcp

一个小型模型上下文协议 (MCP) 服务器,将 Habitica v3 API 作为 MCP 工具公开,以便支持 MCP 的 AI 助手(Claude Code、Hermes Agent、Cursor 等)可以读取和更新您的 Habitica 任务、习惯、每日任务、奖励、宠物、库存和通知。

这是对 iBreaker 原版 的纯净重写——界面相同,去除了 axios/zod/i18n,使用单文件 Node,仅输出英文。

安装

git clone https://github.com/hxlair/habitca_mcp.git
cd habitca_mcp
npm install

需要 Node 18 或更高版本(使用内置的 fetch)。

Related MCP server: Habitica MCP

认证

您需要您的 Habitica API 凭据:

  1. 打开 https://habitica.com/user/settings/api

  2. 复制您的 User ID 和 API Token

在启动服务器的 shell 中导出它们:

export HABITICA_USER_ID=...
export HABITICA_API_TOKEN=...

可选:

export HABITICA_APP_ID=my-mcp-client      # sent as x-client header for Habitica analytics

运行

npm start
# or
./index.js

服务器通过 stdio 使用 MCP 协议通信。连接成功后,它会将 habitca-mcp ready 记录到 stderr。

连接到 MCP 客户端

Claude Code / Hermes Agent / Cursor

添加到客户端的 MCP 配置中:

{
  "mcpServers": {
    "habitca": {
      "command": "node",
      "args": ["/absolute/path/to/habitca_mcp/index.js"],
      "env": {
        "HABITICA_USER_ID": "...",
        "HABITICA_API_TOKEN": "..."
      }
    }
  }
}

对于 Hermes 特别说明:

hermes mcp add habitca \
  --env HABITICA_USER_ID=... \
  --env HABITICA_API_TOKEN=... \
  -- node /absolute/path/to/habitca_mcp/index.js

工具

工具

用途

get_user_profile

获取完整的用户文档

get_stats

获取 HP / MP / XP / 等级 / 金币 / 职业

get_tasks

列出任务(可选择按 habits / dailys / todos / rewards / completedTodos 过滤)

get_task

通过 ID 获取单个任务

create_task

创建习惯/每日任务/待办事项/奖励

update_task

更新任务字段

score_task

对任务进行评分 up(默认)或 down

delete_task

删除任务

get_task_checklist

列出任务上的清单项

add_checklist_item

添加清单项

update_checklist_item

编辑清单项的文本/完成状态

score_checklist_item

切换清单项的完成状态

delete_checklist_item

删除清单项

get_tags / create_tag

标签 CRUD(子集)

get_inventory / get_pets / get_mounts

库存视图

feed_pet / hatch_pet / equip_item

宠物与装备操作

buy_reward / get_shop / buy_item

奖励购买

cast_spell

对自己/任务/队伍成员施放职业技能

get_notifications / read_notification

通知处理

run_cron

手动触发每日 cron

与上游版本的区别

  • 单一依赖 — 仅 @modelcontextprotocol/sdk。移除了 axios、zod 和 i18n 层。

  • 仅英文 输出消息。

  • 发送 x-client 请求头,以便 Habitica 可以将流量归因于 MCP。

  • 更好的错误处理 — 直接显示 Habitica API 的 message 字段,而不是将其吞掉。

  • 结构化的成功消息 — score_task 返回金币/经验/等级的变化量,create_task 返回新 ID 等。

  • 添加了 get_task 和 run_cron;进行了微小的模式清理(优先级枚举,completedTodos 过滤器)。

许可证

MIT — 与上游相同。

Available Tools

28 tools
add_checklist_itemC

Add a checklist item to a task.

Inputs: taskId (required), text (required).

buy_itemC

Buy an item from a shop.

Inputs: itemKey (required), quantity.

buy_rewardC

Buy a custom reward by key.

Inputs: key (required).

cast_spellB

Cast a class spell, optionally on a target task or party member.

Inputs: spellId (required), targetId.

create_tagD

Create a tag.

Inputs: name (required).

create_taskB

Create a habit, daily, todo, or reward.

Inputs: type (required), text (required), notes, difficulty, +4 more.

delete_checklist_itemC

Delete a checklist item.

Inputs: taskId (required), itemId (required).

delete_taskC

Delete a task by id.

Inputs: taskId (required).

equip_itemC

Equip a pet, mount, costume piece, or battle gear.

Inputs: type (required), key (required).

feed_petB

Feed a pet a piece of food.

Inputs: pet (required), food (required).

get_inventoryA

Get full inventory (items, eggs, food, hatching potions, special).

Inputs: no named parameters.

get_mountsA

Get owned mounts map.

Inputs: no named parameters.

get_notificationsC

Get unread notifications.

Inputs: no named parameters.

get_petsA

Get owned pets map.

Inputs: no named parameters.

get_shopB

Get items in a shop (default: market).

Inputs: shopType.

get_statsA

Get user stats only (HP, MP, XP, level, gold, class).

Inputs: no named parameters.

get_tagsA

Get all tags.

Inputs: no named parameters.

get_taskC

Get a single task by id.

Inputs: taskId (required).

get_task_checklistC

Get checklist items for a task.

Inputs: taskId (required).

get_tasksC

List tasks. Optionally filter by type.

Inputs: type.

get_user_profileA

Get the authenticated user's full profile (stats, prefs, items, party, etc).

Inputs: no named parameters.

hatch_petC

Hatch a pet from an egg + hatching potion.

Inputs: egg (required), hatchingPotion (required).

read_notificationC

Mark a notification as read.

Inputs: notificationId (required).

run_cronA

Run the daily cron (advance day, apply damage from missed dailies). Normally auto-runs on first action of the day.

Inputs: no named parameters.

score_checklist_itemC

Toggle a checklist item complete/incomplete.

Inputs: taskId (required), itemId (required).

score_taskA

Score a task. direction='up' completes a todo/daily or marks a + habit; 'down' is for negative habits.

Inputs: taskId (required), direction.

update_checklist_itemB

Update text/completed on a checklist item.

Inputs: taskId (required), itemId (required), text, completed.

update_taskC

Update fields on a task (text, notes, difficulty, priority, etc).

Inputs: taskId (required), text, notes, difficulty, +2 more.

Tool Schema Changelog

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

Loading tool schema changelog…

    TDQS

    B3/5.0

    Scored across 28 tools

    Disambiguation4/5

    Most tools have clearly distinct purposes (e.g., get_task vs get_tasks, buy_item vs buy_reward). A few overlaps exist (get_inventory and get_user_profile both return items) but descriptions reduce ambiguity.

    Naming Consistency5/5

    All tool names follow a consistent verb_noun snake_case pattern (e.g., create_task, buy_item, equip_item). No mixing of conventions or chaotic naming.

    Tool Count4/5

    28 tools cover a broad gamification system (tasks, inventory, pets, spells, shop). Slightly high but justified by the feature set; not excessive.

    Completeness3/5

    Core task and checklist operations are complete, but missing CRUD for tags (no delete/update), rewards management beyond buying, and some inventory actions. Notable gaps exist.

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      C
      quality
      D
      maintenance
      Enables AI assistants to interact with the Habitica API to manage tasks, track habits, and engage in gamified productivity features like pet raising and inventory management. It allows users to control their Habitica account through natural language for a personalized and automated productivity experience.
      26
      18 npm
      26
      MIT
    • A
      license
      A
      quality
      C
      maintenance
      MCP server for managing Habitica as a daily execution layer, enabling agents to read and (with explicit confirmation) create, complete, and score tasks via the Habitica API.
      16
      MIT
    • A
      license
      Not graded
      quality
      D
      maintenance
      Enables MCP-compatible clients to read and write a gamified self-improvement RPG character sheet, including quest management, profile viewing, skills, social challenges, and leaderboards.
      1
      MIT