NWN MCP服务器

特性
- 装载并检查
.mod文件——区域、生物、项目、对话框、脚本、可放置对象等 - 创建和编辑 区域、放置对象、编写对话框、构建任务
- 编译脚本、管理日志、链接区域转换和验证模块
- 批量操作 --重命名标签,跨区域移动或删除对象,并用自然语言编排复杂的多步更改
- 搜索蓝图 跨整个资源堆栈(基础游戏+HAKs+模块)
- 空间意识 --用于AI推理的平铺网格、可步行区域和放置对象的JSON有效载荷
- 查询和更新 NWN SQLite活动数据库
- HTML区域报告 --供人类审查的交互式可视化区域地图
奖金: 一个完全自主的单次冒险创作者。给它一个提示,坐下来,得到一个可玩的模块——绘制区域,放置NPC,编写任务,平衡战利品,全部免提。使用 /create-adventure 玩得开心。(警告:设计上没有扰流板——DM也会感到惊讶。)
专为两种工作流程而设计:
- 人工智能辅助模块设计 --当人工智能通过自然语言帮助构建、修改和扩展模块时,您可以保持创造性控制。
- 人工智能驱动的冒险创造 --一个小型的概念验证工具,可以让LLM自主地为您和您的朋友生成一次冒险——任务、对话、区域和来自高级提示的放置内容。设计上没有扰流板,所以DM也会感到惊讶。 *警告:完全由人工智能生成的内容是最好的努力,尤其是自主区域绘画。可能有龙!*
先决条件
- v18+
- neverinter.nim工具 —
nwn_erf,nwn_gff,nwn_script_comp,nwn_twoda,nwn_resman_cat - 无冬之夜:增强版(用于基础游戏数据)
- MCP兼容的AI客户端(克劳德代码、克劳德桌面、VS代码等)
安装
1.克隆和构建
git clone https://github.com/Txpple/nwn-mcp.git
cd nwn-mcp
npm install
npm run build2.下载neverwinter.nim工具
从以下网址下载适用于您平台的最新版本 neverinter.nim发布 并将二进制文件解压缩到下面将引用的文件夹中。
3.配置您的MCP客户端
将服务器添加到MCP客户端配置中。配置位置取决于您的客户端:
| 客户端 | 配置文件 |
|---|---|
| 克劳德代码 | .claude/settings.json 或 .mcp.json 在您的项目中 |
| 克劳德桌面 | claude_desktop_config.json |
| VS代码 | MCP设置 .vscode/mcp.json |
{
"mcpServers": {
"nwn-mcp": {
"command": "node",
"args": ["dist/index.js"],
"cwd": "/path/to/nwn-mcp",
"env": {
"NIM_FOLDER_NWTOOLS": "/path/to/neverwinter-nim-tools",
"NWN_FOLDER_DATA": "/path/to/Neverwinter Nights",
"NWN_FOLDER_USER": "/path/to/Documents/Neverwinter Nights"
}
}
}
}Windows路径示例:
{
"NIM_FOLDER_NWTOOLS": "C:/tools/neverwinter.nim/bin",
"NWN_FOLDER_DATA": "C:/Program Files (x86)/Steam/steamapps/common/Neverwinter Nights",
"NWN_FOLDER_USER": "C:/Users/you/Documents/Neverwinter Nights"
}环境变量
| 变量 | 必填 | 默认 | 描述 |
|---|---|---|---|
NIM_FOLDER_NWTOOLS | 是 | neverinter.nim二进制文件的路径 | |
NWN_FOLDER_DATA | 是 | NWN游戏安装目录(基础游戏2DA/TLK) | |
NWN_FOLDER_USER | 是 | NWN用户文档目录(HAK、覆盖、模块) | |
MCP_FOLDER_TEMP | 没有 | %TEMP%/nwn-mcp | 提取模块的临时目录 |
MCP_FOLDER_USERREPORTS | 否 | 导出报告的目录 |
用法
连接后,呼叫 load_module 以模块文件名开头:
load_module("mymodule.mod")然后使用110多种工具中的任何一种来检查和修改模块。问你的AI助手一些事情,比如:
- “加载我的模块并显示摘要”
- “创造一个有河流穿过的森林地区”
- “在酒馆门口放一个商人NPC,给她一家店”
- “编写一个任务,玩家从地精洞穴中取回被盗的护身符”
- “在荒野地区增加狼和熊的遭遇”
- “浏览我的自定义类并更新描述”
- “为我的自定义技能添加一些新的力量脚本”
- “验证模块并检查是否有损坏的引用”
更改将写回 .mod 文件通过 repack_module.
特殊指令
export_area_report/export_module_report--生成单个区域或整个模块的交互式HTML地图,以便在浏览器中进行可视化查看。/create-adventure--根据创意提示生成完整的单次冒险模块。使用子代理自主构建区域、放置NPC、编写任务和填充世界。
示例 /create-adventure 提示
/create-adventure I'd like to play an adventure in the wilderness where I fight off
animals and survive the elements. Give a somber tone. I'll be playing solo with a single level 2 character./create-adventure I'd like to play an adventure with city streets and thieves' guild
intrigue — sneaking, double-crosses, maybe a heist. Make it fun and cheeky. We'll be playing with a party of
3 level 5 characters./create-adventure I'd like to play an adventure where I'm an agent of a wizard society
sent to investigate the society's latest crisis. Classic tabletop style. Solo player,
level 4, lots of investigation and a climactic magical battle./create-adventure I'd like a classic dungeon crawl — an old crypt full of undead with
a powerful lich at the end. Make it old school classic gold box style. Party of 4 players around level 6./create-adventure Surprise me — you pick the setting, tone, and story. Solo player, level 3.只需描述你想玩的冒险类型以及你的团队规模和水平——技能就是从那里开始的。
可用工具
区域
create_area--使用地形图块创建新区域get_area_details--区域属性、照明、天气、音乐set_area_properties--调整灯光、雾、音乐、天气paint_tiles--在特定位置设置精确的图块ID(直接放置)paint_group--放置多瓷砖组(寺庙、小屋等)adventure_apply_layout--原子化地应用完整布局:通过区域求解器(冒险工具)实现区域+交叉点+特征get_tileset_details--具有摘要模式(~2KB)或完整磁贴目录(~60-100KB)的磁贴集信息
注: 地形绘制是最好的努力——始终打开工具集中的模块,查看绘制的区域并根据需要进行修补。
visualize_area--用于AI推理的空间JSON有效载荷export_area_report/export_module_report--用于人工审核的HTML可视化
对象放置
place_creature/place_placeable/place_door/place_waypoint--在区域中放置对象place_encounter/place_trigger/place_sound/place_store--遭遇、触发、声音、储存move_object/remove_object/bulk_remove_objects--重新定位或删除对象
蓝图
list_blueprints--搜索基础游戏+HAK+模块蓝图create_creature_blueprint/create_item_blueprint--创建新蓝图create_encounter_blueprint/create_store_blueprint/create_trap_blueprint--遭遇、储存、陷阱
对话和任务
create_dialog/flatten_dialog/add_dialog_node--撰写和检查对话add_journal_quest/add_journal_entry--构建任务日志verify_quest_completability--从对话框到日志结束条目跟踪任务
脚本
write_script/compile_script/read_script_source--NWScript编写search_scripts/list_script_references--查找和跟踪脚本使用情况
分析
validate_module--检查整个模块中是否有损坏的引用check_area_connectivity--验证所有区域都可以通过转换到达get_balance_report--生物难度和每个区域的物品价值suggest_encounter--政党层面遭遇组合咨询工具
模块管理
load_module/repack_module--加载和保存模块get_module_info/get_module_summary--模块元数据和概述undo_last_change/undo_history--还原最近的更改
冒险创造者
特定于的工具 /create-adventure 自主模块构建流程:
adventure_generate_layout--生成带有特征建议的程序区域布局(地牢、洞穴、住宅、森林、农村、城市、平原、沙漠、城堡、苔原)adventure_apply_layout--通过区域求解器原子地应用生成的布局(区域+交叉点+特征)adventure_list_features--枚举倾斜集和样式的与求解器兼容的特征组adventure_find_walkable--在一个区域内找到有保证的可步行坐标adventure_create_transition--双向入口转换(单呼叫点灯+两个区域的航路点)
建筑
.mod file --> nwn_erf (extract) --> temp dir --> nwn_gff (parse GFF to JSON)
--> in-memory ModuleIndex (tags, scripts, areas, dialogs, creatures, items)
--> MCP tool handlers serve queries & modifications
--> nwn_gff (serialize back) --> nwn_erf (repack) --> .mod file一次加载一个模块。服务器在负载时构建一个完整的资源管理器堆栈——基于游戏BIF、模块HAK、用户覆盖和模块资源——使工具能够访问完整的数据层次结构。
所有工具携带 MCP注释 (readOnlyHint, destructiveHint, idempotentHint)因此客户可以理解工具行为。冒险创作者专用工具分为 src/tools/adventure-tools.ts;所有其他工具都是通用模块编辑的基础工具。
范围
目标 非持久世界模块 --单人和小型合作活动。专注于放置在区域中的实例化对象(GIT内容)。蓝图修改、调色板级别更改和深度2DA/规则集创作不在范围内。话虽如此,只要仔细提示,这些都是可能的。
发展
npm run dev # Run with tsx (hot reload)
npm run build # Compile TypeScript
npm run start # Run compiled output
npm run test # Run tests (vitest)
npm run lint # Lint with Biome
npm run format # Format with Biome故障排除
- 找不到neverinter.nim工具 --验证
NIM_FOLDER_NWTOOLS指向包含二进制文件的目录,而不是父文件夹。
支持
- 问题:
致谢
- NWN Discord和Zulip社区
许可证
MIT许可证——见 许可证 了解详情。
