mcdk-mcp-tracy
This server provides CPU performance profiling for Minecraft Bedrock Edition mods by connecting to the game's embedded Tracy profiler. It supports the full optimization workflow: probe → baseline capture → hotspot analysis → code change → re-capture → diff validation.
Probe readiness (
tracy_status): Check connectivity to the native Tracy server (TCP 8086), verify bundled CLI tools (tracy-capture.exe,tracy-csvexport.exe) are present, and optionally inspect the MCDK endpoint. Run this first.Capture function timings (
tracy_native_capture): Record per-function CPU costs (self time, total time, call counts) from the live game over a configurable window (≤60 seconds), with optional mod-name filtering. Returns a top-N hotspot list and stores the full dataset for later queries.Query function costs (
tracy_get_function_costs): Retrieve self/total/call metrics from a stored capture by exact name or substring — no need to re-capture.Diff captures (
tracy_diff_captures): Compare two captures (e.g., before vs. after an optimization) to see improved, regressed, added, or removed functions with delta milliseconds and percentage change.Frame-level health (
tracy_jank_fps): Poll FPS and frame time percentiles (p1, p5, p50) via MCDK, or scrape jank/profile logs to cross-validate perceived performance improvements.List stored captures (
tracy_list_captures): View all saved sessions (id, label, totals, timestamp) to select captures for diffing or further analysis.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@mcdk-mcp-tracyCapture 8 seconds of profiling data filtered by 'my_mod' with label 'before'"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
mcdk-mcp-tracy
一个 MCP 服务器:对运行中的网易我的世界基岩版 MOD 做性能监测——采集每个函数的 CPU 耗时与帧率数据,用来定位热点、review 代码、量化验证优化效果。
三类性能监测能力:
热点定位:函数耗时排行(self / total / 调用次数),直接看到最贵的函数在哪
优化验证:前后两次采样按函数 diff,用毫秒回答"改完真的变快了吗"
帧级健康:FPS 百分位(p1 / p5 / p50)与 jank 日志,交叉验证体验改善
原始逐帧数据在服务端归约,AI 只接收 top-N 排行与 diff 结果,不占上下文。
工作原理
# 函数耗时(主路径)—— 直连游戏内嵌的原生 Tracy server
AI (Claude) --MCP/stdio--> mcdk-mcp-tracy --TCP 8086--> 游戏内嵌原生 Tracy server
└─ bin/tracy-capture.exe + tracy-csvexport.exe
# 帧率 / jank(辅助路径)—— 经 MCDK 注入 get_Fps()
AI --MCP/stdio--> mcdk-mcp-tracy --MCP/SSE--> MCDK(mcdk.exe) --execute_code--> 游戏(Python2)函数耗时直连原生 ModPC Tracy(8086),不管是通过MCDK还是MC Studio启动的游戏:只要游戏启动没关闭就能抓取性能消耗信息。 采集覆盖窗口内全部已插桩 zone(含客户端
MAIN_THREAD与MC_SERVER线程)。采样时建议跑图/搭建场景测压:Tracy 只记录窗口内实际执行的代码,不建议静止不动。
bin/的 CLI 取自 Tracy v0.11.1 官方 Windows 包,版本须与游戏内嵌的 Tracy client 一致(协议版本敏感);换游戏版本时同步替换。
Related MCP server: memorylens-mcp
前置条件
游戏在运行,内嵌原生 Tracy server 监听 8086(用
tracy-profiler.exeGUI 能连上即确认)。bin/tracy-capture.exe、bin/tracy-csvexport.exe存在(随仓库附带;可用TRACY_BIN_DIR指向别处)。(仅
tracy_jank_fps需要) 游戏由 MCDK(mcdk.exe)启动,工程.mcdev.json开了 MCP:{ "mcp_server_config": { "enabled": true, "server_ip": "localhost", "server_port": 19133 } }Python 3.10+(开发用 3.13),推荐
uv。
安装
uv --directory <path>/mcdk-mcp-tracy sync # 装依赖 + 建 .venv
uv --directory <path>/mcdk-mcp-tracy run pytest -q # 自检,应 36 passed(无需游戏)注册到 Claude Code
claude mcp add mcdk-mcp-tracy --scope user -- \
"<path>/mcdk-mcp-tracy/.venv/Scripts/python.exe" -m mcdk_mcp_tracy \
--stdio --mcdk-url http://127.0.0.1:19133直接用 venv 里的
python.exe,不依赖 PATH。--mcdk-url仅tracy_jank_fps用得到;也可换成--project-dir <MOD工程>按其.mcdev.json自动找端口(优先级:--mcdk-url>--mcdev-json>--project-dir>$MCDK_MCDEV_JSON> 从 CWD 向上找)。注册后新开会话才会出现
mcp__mcdk-mcp-tracy__*工具。 卸载:claude mcp remove mcdk-mcp-tracy --scope user。推荐一并安装配套技能:把
skills/mcdk-tracy-profiling/整个目录拷到~/.claude/skills/, AI 会自动按下面的人机协作流程工作(先对齐采样计划,报告后由你拍板再改代码)。
注册到 Codex
codex mcp add mcdk-mcp-tracy -- \
"<path>/mcdk-mcp-tracy/.venv/Scripts/python.exe" -m mcdk_mcp_tracy \
--stdio --mcdk-url http://127.0.0.1:19133Codex 会将服务器写入用户级
~/.codex/config.toml,无需--scope user。参数含义和寻址优先级与上方 Claude Code 配置相同;不需帧率 / jank 采样时可省略
--mcdk-url。运行
codex mcp list确认已注册;注册后新开 Codex 会话(IDE 扩展中需重启扩展) 即可使用mcp__mcdk-mcp-tracy__*工具。卸载:
codex mcp remove mcdk-mcp-tracy。推荐一并安装配套技能:把
skills/mcdk-tracy-profiling/整个目录拷到~/.codex/skills/。
性能监测标准流程工作流
负载要你亲自在游戏里触发,改代码要你拍板——AI 驱动流程,关键节点等你:
探针:
tracy_status(),确认 8086 可达 + CLI 齐全。对齐采样计划:AI 先问你采样时长——10 秒(瞬时逻辑:开 UI、放技能)/30 秒(常规 玩法、跑图)/60 秒(长周期系统、复现偶发卡顿)/自定义(≤60)——以及准备触发的场景 (跑图、刷实体、开打、跑机器……),你就位后才开采。
基线采样:你在游戏里触发玩法,AI 执行
tracy_native_capture(seconds=<约定>, name_contains="YourMod", label="before")。热点报告(对话正文输出):热点排行(self / calls / 每帧均摊 / 单次均摊,必要时
tracy_get_function_costs细查)+ 按性价比排序的优化计划——每条含根因、改法、预期收益 (估算 ms)、风险与改动量;改动小收益高的在前,动底层影响向下兼容的在后。你选定做哪几条。改代码 + 复测:AI 按你选的方案改热点,同场景同时长再抓
label="after"。diff 验收:
tracy_diff_captures(base_id, new_id, metric="self"),delta_ms为负 = 变快, 按毫秒和百分比回报实际收益。(可选:tracy_jank_fpsFPS 百分位交叉验证,仅 MCDK)
采样返回(已按 self 耗时降序):
{ "ok": true, "capture_id": "cap-1", "frames": 2632, "zones": 645899, "unit": "ms",
"total_self_ms": 327.0,
"top": [ { "name": "onRenderTick @ YourMod.Client.Main",
"self_ms": 134.2, "total_ms": 328.1, "calls": 2628 } ] }diff 返回:
{ "ok": true, "metric": "self",
"summary": { "base_total_ms": 86.4, "new_total_ms": 61.0, "delta_ms": -25.4, "pct": -29.4 },
"improved": [ { "name": "YourMod.combat.update", "delta_ms": -16.8, "base_ms": 21.3, "new_ms": 4.5 } ],
"regressed": [], "added": [], "removed": [] }目标函数出现在 improved、summary.pct 下降,即优化生效。
内置优化模式参考库
技能自带四份按症状索引的优化模式参考(AI 生成第 4 步优化计划时按需查阅;你也可以直接翻着看)。 所有模式按"采样症状 → 改法"组织、附可移植代码骨架,来自官方性能优化指南与已上线大型 MOD 的 实战验证——例如负缓存实测省 ~720ms/10s、配置存储改造内存 715MB → 224MB。
参考文件 | 覆盖模式 | 对应症状 |
组件全局缓存、降频+加盐+质数间隔、事件化替代轮询、分帧、单播替代广播、Python 微优化、调色板批量放置方块、配置内存与加载 | tick / 组件创建 / 通信热点;批量摆方块尖峰、启动慢、内存高 | |
负缓存、脏驱动 O(dirty)、值比对早退、同 tick 快照短路、有序调度池(定时器)、lazyTick 分频、frame-drain 分帧、静止短路、超距休眠、dead-reckoning、节流广播、落盘节流 | 多实体联动 / 渲染同步 / 持久化 / 高频定时器类热点 | |
可视区格子池+分页虚拟化、控件句柄缓存、显隐替代增删、值比对刷新、轻重分离+防抖、搜索索引预建、懒加载+分帧注册 | UI 打开慢 / 翻页搜索卡顿 / 界面常驻掉帧 | |
step/mix 消分支、精度限定符(含 iOS/Android 真机差异)、计算下移顶点/CPU、减 inverse/纹理/噪声、全屏后处理与 Bloom 降载、GLSL ES 兼容写法、#ifdef 多档位、热重载+帧率验证 | MOD 函数不贵但 FPS 低、引擎渲染 zone 占大头 | |
特效 Mesh 减面、移动端模型分级、透明残影+overdraw 控制 | 特效/模型一多就掉帧、近距离看角色掉帧 |
工具速查表
工具 | 作用 | 关键参数 |
| 先跑。探测 8086 可达性、bundled CLI、MCDK 端点(信息性) |
|
| 核心。抓函数耗时 top-N,存为 |
|
| 从某次 capture 查函数成本(self/total/calls) |
|
| 前后两次 capture 按函数对比 |
|
| 帧级健康(仅 MCDK,MCStudio启动不可用):FPS 百分位 / jank 日志 |
|
| 列出已存 capture,方便挑 id 做 diff | 无 |
统一返回:成功 {"ok": true, ...},失败 {"ok": false, "reason": "...", "error": "..."}。
性能监测要点
采样期间制造真实负载:站到卡顿场景、开打、刷实体、跑机器——要测什么就让游戏跑什么。
用
name_contains聚焦自己的 MOD:函数显示为"函数名 @ 源文件",按脚本包前缀过滤; 过滤只影响 inline 返回,全量数据仍存进 capture,事后可再查。diff 要可比:前后两次用尽量一致的玩法 + 相同
seconds,否则 delta 不可信。结论用数字说话:优化是否生效看
improved/summary.pct,不凭体感。Tracy 版本匹配:换游戏版本时同步替换
bin/的 CLI(当前 v0.11.1)。
排查表
现象 | 含义 | 怎么修 |
| 连不上 8086 | 确认游戏在跑且内嵌 Tracy;用 tracy-profiler GUI 验证;查 |
| 缺 bundled CLI | 确认 |
capture 返回空 + | 窗口内没负载 | 采样时让游戏真的跑要测的逻辑 |
| 连不上 MCDK | 确认游戏由 MCDK 启动、19133 在跑 |
| capture 已淘汰(只留最近 ~20 个) | 重新抓样拿新 id |
| 参数非法(如 | 按文档改参数 |
开发
uv --directory mcdk-mcp-tracy run pytest -q # 36 passed,无需游戏
# 若 uv 在中文路径下报 trampoline 错误,改用:
./.venv/Scripts/python.exe -m pytest -qAI 工作流策略见 skills/mcdk-tracy-profiling/SKILL.md
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- Alicense-qualityBmaintenanceProvides comprehensive monitoring and observability for MCP server ecosystems with real-time health checks, performance metrics, distributed tracing, anomaly detection, and automated performance reports using OpenTelemetry and Prometheus.Last updated1MIT
- AlicenseAqualityAmaintenanceMCP server for .NET memory profiling with AI-actionable code fix suggestions, powered by JetBrains dotMemoryLast updated69MIT
- Alicense-qualityBmaintenanceAn MCP server that converts Windows WPR .etl performance traces into structured JSON summaries and flamegraph-ready data for LLM analysis. It bridges Windows Performance Analyzer automation with LLM reasoning capabilities for performance troubleshooting.Last updated1MIT
- AlicenseAqualityCmaintenanceMCP server for profiling Java applications via JDK utilities (jcmd, jfr, jps). Enables AI assistants to diagnose performance, analyze threads, and inspect JFR recordings without manual CLI usage.Last updated26878MIT
Related MCP Connectors
Cloud-hosted MCP server for durable AI memory
MCP server for AI dialogue using various LLM models via AceDataCloud
MCP server for Grok Imagine AI video generation
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/lovelyXiaoQi/mcdk-mcp-tracy'
If you have feedback or need assistance with the MCP directory API, please join our Discord server