vtune-mcp-server
Provides tools to analyze performance data using Intel VTune Profiler, including generating reports, listing results, comparing results, and getting hotspots.
Click on "Deploy 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., "@vtune-mcp-serverCompare r010hs and r354hs performance"
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.
VTune MCP Server for Claude Code
将 Intel VTune Profiler CLI 封装为 MCP 工具,让 Claude Code 直接分析 VTune 采集结果、定位函数级性能热点、生成可交互的 HTML 对比报告。
前置条件
Python 3.10+
Intel VTune Profiler(默认路径
C:\Program Files (x86)\Intel\oneAPI\vtune\2026.1)
Related MCP server: perf-mcp
初始化虚拟环境
首次使用时执行一次:
cd E:\Git\vtune-mcp-server
python -m venv venv
venv\Scripts\python.exe -m pip install -r requirements.txt验证安装:
venv\Scripts\python.exe -c "from mcp.server.fastmcp import FastMCP; print('OK')"注册到 Claude Code
推荐使用项目自带的
venv/虚拟环境,依赖隔离,避免与系统 Python 冲突。
方式 1:本地路径注册(推荐)
claude mcp add --scope user vtune-profiler -- "E:\Git\vtune-mcp-server\venv\Scripts\python.exe" "E:\Git\vtune-mcp-server\server.py"方式 2:手动编辑配置文件
编辑 ~/.claude.json(即 C:\Users\<你的用户名>\.claude.json),找到 mcpServers 节点,添加:
"vtune-profiler": {
"type": "stdio",
"command": "E:/Git/vtune-mcp-server/venv/Scripts/python.exe",
"args": ["E:/Git/vtune-mcp-server/server.py"],
"env": {}
}方式 3:项目级配置(.mcp.json)
在项目根目录创建 .mcp.json:
{
"mcpServers": {
"vtune-profiler": {
"command": "E:/Git/vtune-mcp-server/venv/Scripts/python.exe",
"args": ["E:/Git/vtune-mcp-server/server.py"],
"env": {}
}
}
}注册后需要重启 Claude Code才能生效。
自定义 VTune 路径(VTUNE_PATH)
默认路径为 C:\Program Files (x86)\Intel\oneAPI\vtune\2026.1\bin64\vtune.exe。如果你的 VTune 安装在其他位置,通过 MCP 配置的 env 字段设置 VTUNE_PATH 环境变量即可覆盖:
claude mcp add --scope user vtune-profiler -e VTUNE_PATH="D:/Intel/vtune/bin64/vtune.exe" -- "E:\Git\vtune-mcp-server\venv\Scripts\python.exe" "E:\Git\vtune-mcp-server\server.py"或手动配置:
"vtune-profiler": {
"type": "stdio",
"command": "python",
"args": ["E:/Git/vtune-mcp-server/server.py"],
"env": {
"VTUNE_PATH": "D:/Intel/vtune/bin64/vtune.exe"
}
}
VTUNE_PATH必须指向vtune.exe的完整路径,不是目录。
提供的工具
工具 | 用途 |
| 通用报告生成(支持 hotspots/summary/top-down/callstacks/hw-events,CSV/text 格式) |
| 列出项目文件夹下所有 VTune 结果目录 |
| 对比两次采集结果的性能差异 |
| 快捷获取单次结果的摘要 |
| 获取 Top N 热点函数(CSV 格式,AI 分析友好) |
| 核心工具:对比两个 VTune 结果中指定函数的 top-down 调用树,生成交互式 HTML 报告 |
核心用法 — 函数级性能热点对比
这是本项目的核心场景:给定两次 VTune 采集结果,分析某个函数在两版之间的性能变化及其调用树差异。
示例 1:对比两个版本中的 OnPhysScenePreStep
在 Claude Code 中直接说:
C:\Users\Ambition\Desktop\VTun\GSTM_DS_vtune r354hs r361hs OnPhysScenePreStep函数的性能热点是什么Claude 会自动调用 vtune_function_tree,生成 HTML 报告到:
C:\Users\Ambition\Desktop\VTun\GSTM_DS_vtune\r354hs\r354hs_vs_r361hs_tree.html打开后你可以看到:
Total%:函数在整体 CPU 时间中的占比
Self%:函数自身的 CPU 消耗(不含子调用)
Diff(Total/Self):r361hs 相对于 r354hs 的变化量
可折叠调用树:点击 ▼/▶ 展开或收起子函数
暗色主题自适应:跟随系统 dark mode
红绿高亮:红色 = 消耗增加,绿色 = 消耗降低
示例 2:直接列出所有 VTune 结果
列出 C:\Users\Ambition\Desktop\VTun\GSTM_DS_vtune 下的所有 VTune 结果示例 3:分析单次采集的热点函数
分析 C:\Users\Ambition\Desktop\VTun\GSTM_DS_vtune\r354hs 的热点函数,给出优化建议示例 4:对比两次采集的性能差异
对比 r354hs 和 r361hs 的性能差异路径简写
如果 MCP 配置了 VTUNE_PROJECT_DIR 环境变量(如 C:\Users\Ambition\Desktop\VTun\GSTM_DS_vtune),你可以只写 r354hs 而不用写完整路径。
例如设置环境变量后:
"env": {
"VTUNE_PROJECT_DIR": "C:/Users/Ambition/Desktop/VTun/GSTM_DS_vtune"
}然后直接说:
r354hs r361hs OnPhysScenePreStep 的性能热点是什么验证安装
重启 Claude Code 后,输入:
/mcp应该能看到 vtune-profiler 服务器及其 6 个工具。
项目结构
vtune-mcp-server/
├── server.py # MCP Server 主文件(单文件,无抽象层)
├── pyproject.toml # 项目配置
├── templates/
│ └── function_tree.html # 交互式调用树对比报告的 HTML 模板
└── tests/
├── test_server.py # 测试套件
└── fixtures/ # (空,测试使用 mock 数据)This server cannot be deployed
Maintenance
Related MCP Connectors
Source-checked CLI guides and model-aware planning for Claude Code, Codex, and Grok Build.
AI Visibility and Content Intelligence tools for Claude and MCP-compatible agents.
Run UX research from Claude — create card sort studies, list studies, pull headline stats.
WHOOP recovery, strain, sleep and workouts in Claude via official WHOOP OAuth. Free, open source.
Related MCP Servers
- AlicenseAqualityDmaintenanceWraps Anthropic Claude Code CLI as tools, allowing MCP clients to invoke headless Claude Code sessions.2945 npmMIT
- FlicenseAqualityCmaintenanceEnables LLMs to analyze Linux perf data files using 26 perf analysis commands, including report, script, annotate, and more, through typed tool parameters.26-
- FlicenseNot gradedqualityCmaintenanceExposes Claude Code's file editing, command execution, and test running capabilities as composable MCP tools for any MCP-compatible host, enabling code operations via a stateless bridge.-
- FlicenseNot gradedqualityCmaintenanceEnables ISLI agents and MCP clients to dispatch natural-language coding and terminal tasks to a locally-installed Claude Code CLI, supporting both one-shot execution and persistent sessions with workspace and security controls.-