mcp-server
v0.2.0续境 (xujing) MCP server — 让 WorkBuddy / Claude 等 AI 客户端直接创作互动故事
These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.
whoami
查看当前连接的续境账号(用户名、角色)以及服务端地址,用于确认登录状态是否正常
register
注册一个新的续境账号,邀请码已内置、用户无需提供。注册成功后凭据自动保存到本机 ~/.xujing/credentials.json,之后无需再配置。若服务端未开放注册,会提示联系管理员开通
| Parameter | Type | Description |
|---|---|---|
password * | string | 密码,至少 8 位 |
username * | string | 用户名,3–32 位,建议用手机号或英文昵称 |
inviteCode | string | 邀请码。一般不需要填——留空会自动使用内置邀请码;只有注册被拒且提示邀请码无效时才需要手动指定 |
logout
退出登录并清除本机保存的凭据(~/.xujing/credentials.json)。会使该账号已有令牌全部失效
login
使用续境账号密码登录。通常不需要手动调用——配置了 XUJING_USERNAME/XUJING_PASSWORD 时会自动登录;只有在只配置了 token 且已过期时才需要
| Parameter | Type | Description |
|---|---|---|
password * | string | 密码 |
username * | string | 续境账号 |
list_stories
列出当前账号下所有互动故事(标题、题材、进度、最近更新时间)。创作续写前先用它找到目标故事 id
| Parameter | Type | Description |
|---|---|---|
limit | integer | 最多返回条数,默认 20 |
status | string | 按状态过滤,默认 all |
story_get
读取一篇故事的完整内容:设定、角色、已确认的正文章节、当前场景和状态
| Parameter | Type | Description |
|---|---|---|
storyId * | string | 故事 id,可从 list_stories 获取 |
includeDrafts | boolean | 是否包含未确认的草稿章节,默认 false |
maxSegments | integer | 最多返回多少章正文(从最新往前取),默认 20 |
story_state
查看故事的当前世界状态:地点、时间、在场角色、进行中的任务、已知线索、人物关系、最近一次状态变化。续写前建议先读,避免前后矛盾
| Parameter | Type | Description |
|---|---|---|
storyId * | string | 故事 id |
story_create
新建一篇互动故事。只需给题材、主角和设定,服务端会用 AI 生成世界观和人物;之后用 story_opening 生成开篇,或用 story_continue 直接推进
| Parameter | Type | Description |
|---|---|---|
genre * | string | 题材:fantasy 奇幻 / urban 都市 / mystery_supernatural 悬疑灵异 / mystery_detective 悬疑推理 / science_fiction 科幻 / romance 言情 / history 历史 |
premise * | string | 故事核心设定,一两句话说清世界与冲突 |
protagonistName * | string | 主角名字 |
contentRating | string | 内容分级,默认 all_ages |
direction | string | 主角性别 male/female,默认 female |
interactionMode | string | 互动方式:free 自由输入 / choices 只选选项 / mixed 混合(默认) |
protagonistAbilities | string | 主角能力 |
protagonistGoal | string | 主角目标 |
protagonistIdentity | string | 主角身份 |
protagonistPersonality | string | 主角性格 |
protagonistSecret | string | 主角的秘密 |
tone | string | 叙事基调,如「克制的第三人称、阴冷潮湿」 |
story_opening
为一篇已创建但还没有开篇的故事生成第一章。耗时较长(约 30–120 秒),超时后可用 story_get 查看是否已生成完成
| Parameter | Type | Description |
|---|---|---|
storyId * | string | 故事 id |
story_continue
【核心】以主角身份做出行动,让故事继续写下一章。传入你的行动描述即可;不传则用自动行动模式由 AI 决定主角做什么。若上一章草稿未确认,会自动确认后继续(确认不消耗额度)。耗时约 30–180 秒
| Parameter | Type | Description |
|---|---|---|
storyId * | string | 故事 id |
action | string | 主角的行动或要说的话,如「我不进门,先问守夜人:十二年前最后离开这里的是谁?」。留空则自动行动 |
mode | string | user 手动行动 / auto 自动推进,默认根据 action 自动判断 |
story_end
为一篇故事生成结局并完结它
| Parameter | Type | Description |
|---|---|---|
storyId * | string | 故事 id |
story_add_character
给故事添加一个新角色。可先只写一句话描述,由 AI 补全身份、性格、目标;也可直接指定字段
| Parameter | Type | Description |
|---|---|---|
name * | string | 角色名字 |
storyId * | string | 故事 id |
appearanceCondition | string | 出场条件,如「主角进入后院时」 |
description | string | 一句话描述,如「总在雨夜出现的女记者,追查十二年前的失踪案」 |
goal | string | 目标 |
identity | string | 身份 |
location | string | 所在地点 |
personality | string | 性格 |
secret | string | 秘密 |
story_add_event
给故事安排一个后续会触发的事件(如「三天后警察回到旧宅」),可指定触发时机
| Parameter | Type | Description |
|---|---|---|
name * | string | 事件名称 |
storyId * | string | 故事 id |
description | string | 一句话说明事件内容 |
impactScope | string | 影响范围,如「仅主角」「整个小镇」 |
triggerTime | string | 触发时机,如「三天后」「主角离开旧宅时」 |
story_add_rule
为故事添加世界规则或禁止项,AI 写作时会遵守。适用于固定世界观设定、人物行为底线、内容边界
| Parameter | Type | Description |
|---|---|---|
content * | string | 规则内容,如「这个世界没有超自然力量,一切怪事必须有物理解释」 |
storyId * | string | 故事 id |
category | string | world 世界设定 / faction 势力 / prohibition 禁止项 / character 角色约定 / content_boundary 内容边界,默认 world |
priority | integer | 优先级 0–100,越高越强,默认 50 |
story_add_foreshadow
埋一个伏笔,指定它在后续如何回收。适合长线故事,让后面章节能自然呼应
| Parameter | Type | Description |
|---|---|---|
content * | string | 伏笔内容,如「井底刻着一个名字,主角当时没看清」 |
storyId * | string | 故事 id |
payoffHint | string | 期望的回收方式 |
story_add_quest
给主角添加一个任务/目标,AI 会围绕它推进剧情
| Parameter | Type | Description |
|---|---|---|
name * | string | 任务名称 |
storyId * | string | 故事 id |
objective | string | 任务目标 |
story_console
查看某篇故事的完整控制台数据:规则、角色、任务、伏笔、关系、时间线。用于排查剧情或了解故事全貌
| Parameter | Type | Description |
|---|---|---|
storyId * | string | 故事 id |
story_timeline
按时间倒序分页读取故事章节列表(含摘要),适合长篇故事回顾
| Parameter | Type | Description |
|---|---|---|
storyId * | string | 故事 id |
cursor | string | 分页游标,上一页返回的 cursor |
limit | integer | 每页条数,默认 20 |
story_regenerate
重写最近一章:对不满意的生成结果做一次重新生成(会消耗 AI 额度)
| Parameter | Type | Description |
|---|---|---|
segmentId * | string | 章节 id,可从 story_get 的 segments 或 story_timeline 获取 |
storyId * | string | 故事 id |
instruction | string | 重写要求,如「节奏再快一点,结尾留悬念」 |