profiler-mcp
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., "@profiler-mcp profile the example workload's compute phase"
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.
profiler-mcp
⚠️ NOT READY FOR USE — EXPERIMENTAL / UNVERIFIED-ON-HARDWARE. ⚠️
This project was built and tested entirely in mock mode on an Apple-Silicon Mac. It has never been run against a real Intel VTune or AMD uProf install, on any CPU. The mock backends are modeled on verbatim captures of real CLI output, but the real-hardware code paths (binary discovery, live collection, actual CSV/summary parsing on your version, permission and driver handling) are unexercised and will likely need fixing. The command-line flag surfaces are reconstructed from documentation and may not match your installed version. There is no released version, no stability guarantee, and no support. Treat this as a design prototype and a starting point to fork — do not point it at production workloads or trust its numbers, and read Status & known limitations before doing anything with it.
Two MCP servers that put CPU profilers in front of coding agents: vtune (Intel VTune Profiler, 7 tools) and uprof (AMD uProf, 9 tools) — one Python package, one shared core. Neither profiler runs on macOS or on machines without the right silicon, so each server ships a byte-realistic mock backend (derived from verbatim captures of the real CLIs) that lets the whole project run, self-test, and even self-optimize anywhere.
MCP client (Claude Code)
│ stdio (default) or streamable-http
▼
vtune-mcp / uprof-mcp server.py — FastMCP tool surface
│ cli.py — argv construction
▼
core/runner.py subprocess ──► real `vtune` / `AMDuProfCLI`
│ └───► or mocks/*_mock.py (picked by core/config.py; auto-mock iff no real binary)
▼
parse.py ──► TypedDicts (core/models.py) ──► core/store.py registry (result_id, e.g. "hs-0000")
core/compare.py ──► verdict ──► fail_on_regression gate for optimize loopsQuickstart
uv sync # Python >=3.11; only runtime dep is the mcp SDK (pinned >=1.28,<2)
uv run pytest # deterministic self-test gate (layers 1-4, see below)
make -C examples/workloads # compile the deterministic example workload (hotspots)Registering with Claude Code: the repo ships a project-scope .mcp.json that starts
both servers with uv run vtune-mcp / uv run uprof-mcp — open Claude Code in this directory and
it works out of the box on any machine (mock mode auto-activates where the real profilers are
absent). To register explicitly instead:
claude mcp add vtune -- uv run vtune-mcp # from inside this repo
claude mcp add uprof -- uv run uprof-mcp
# or from anywhere, at user scope:
claude mcp add --scope user vtune -- uv run --directory /path/to/profiler-mcp vtune-mcpA typical conversation (mock mode shown; identical flow with uprof_*):
> what profiling is available here?
vtune_check() -> mode: "mock", binary: .../mocks/vtune_mock.py, 15 analyses
> profile the example workload's compute phase
vtune_collect(analysis="hotspots",
command=["examples/workloads/hotspots", "--seconds", "5", "--only", "compute"])
-> result_id: "hs-0000"
> where does the time go?
vtune_report_hotspots(result_id="hs-0000") -> hot_compute 95%, main 5%
(notes: "Mock mode: synthetic data — do not treat numbers as real hardware measurements.")Related MCP server: AMS Development MCP Servers
Tool reference
vtune (7 tools)
Tool | Purpose | Key params |
| Probe env: binary, version, platform, active mode, available analyses | — |
| Run a collection; stores the result, returns a |
|
| List stored results: id, analysis, target, mode, created | — |
| Parsed run overview: elapsed/CPU time, metrics, top hotspots |
|
| Top-N hottest functions, CPU time descending |
|
| Escape hatch: any vtune report type as byte-capped text |
|
| Function-by-function baseline-vs-candidate deltas + pass/fail verdict |
|
uprof (9 tools)
Tool | Purpose | Key params |
| Probe env; notes that non-AMD CPUs support only | — |
| Run a collection; stores the session, returns a |
|
| List stored results: id, config, target, mode, created | — |
| Parsed run overview: duration, top hotspots, host details |
|
| Top-N hottest functions, sample share descending |
|
| Escape hatch: generated report CSV as byte-capped text |
|
| Function-by-function baseline-vs-candidate deltas + pass/fail verdict |
|
| Sample power/frequency/thermal counters; per-counter summaries |
|
| Parsed | — |
Results persist server-side under short ids; tools return capped structured summaries, never raw
dumps. Every result is stamped with the mode it was collected in.
Real hardware setup
Linux x86 — VTune (oneAPI Base Toolkit or standalone): source /opt/intel/oneapi/vtune/latest/env/vars.sh puts vtune on PATH, or set VTUNE_MCP_BIN to the
binary; the conventional install paths are probed automatically. Driverless hardware sampling
needs perf_event_paranoid <= 1 (0 for system-wide/uncore, which memory-access requires) —
vtune_check warns when the setting blocks collection. Validate an install with
<install-dir>/bin64/vtune-self-checker.sh.
Linux x86 — uProf: installs land in /opt/AMDuProf_X.Y-ZZZ/; the newest
/opt/AMDuProf_*/bin/AMDuProfCLI is found automatically, or set UPROF_MCP_BIN. timechart and
the energy config additionally need the AMDPowerProfiler kernel driver (auto-installed by
rpm/deb; sudo ./AMDPowerProfilerDriver.sh install for tar installs). On Intel CPUs uProf runs
tbp (timer-based) only — PMC/IBS/energy configs need AMD hardware.
Windows: default install paths are probed (C:\Program Files (x86)\Intel\oneAPI\vtune\latest\bin64\vtune.exe, C:\Program Files\AMD\AMDuProf\bin\AMDuProfCLI.exe); the *_MCP_BIN overrides work the same way.
macOS: mock mode only. VTune dropped macOS support entirely in 2024.0 and uProf never had it,
so there is nothing real to run; auto mode falls back to the mocks.
Mock mode
The mocks (src/profiler_mcp/mocks/) are not stubs. They are byte-realistic emulations of the
vendor CLIs, built from verbatim captured output (docs/research/captures-*.md), strict about
flags (unknown options are errors, so server argv bugs fail loudly), and they actually execute
the profiled command — process lifecycle, exit codes, working dirs, and timeouts are all real.
Sample attribution is synthetic and deterministic, driven by a <binary>.mockprofile.json sidecar
model next to the target (see examples/workloads/hotspots.mockprofile.json); a generic model
applies otherwise.
What they are not: measurements. The weights are fixed, so mock numbers do not respond to your code edits — use mock mode to exercise tooling and workflows, real mode to optimize programs. Every mock-collected result carries an explicit mock-data note.
Fault injection for testing error paths:
Env | Effect |
| permission refusal (perf_event_paranoid-style, verbatim vendor text) |
| wedged collection that ignores duration (exercises timeouts) |
| empty/truncated report output |
| nonzero exit after normal-looking output |
| freezes every emitted timestamp for byte-exact assertions |
Self-testing and self-optimization
The full story is in docs/SELF_TESTING.md. The pyramid:
Layer | Where | Catches |
1 Unit |
| parser/logic regressions against verbatim fixtures |
2 In-memory MCP |
| tool wiring, schemas, error mapping (no subprocess) |
3 Stdio smoke |
| entry points and transport, as a client runs them |
4 Ground-truth e2e |
| compile → collect → report; attribution must match the sidecar model; seeded regression must fail |
5 Agentic |
| LLM-facing quality: probe agents drive both servers over real stdio; failures adversarially verified |
Layers 1–4 are the deterministic gate: uv run pytest. Layer 5 runs via the Workflow tool with
{scriptPath: ".claude/workflows/self-test.js"}; the companion
{scriptPath: ".claude/workflows/optimize-project.js"} is the test-gated self-improvement loop
(find → adversarial verify → apply one at a time → re-gate). Agent skills in .claude/skills/:
profile-hotspots (drive either server and interpret results), optimize-loop (verdict-gated
baseline/change/compare protocol), profiler-selftest (run and extend the pyramid).
Configuration reference
Var | Meaning | Default |
|
|
|
| explicit vtune binary path |
|
| explicit AMDuProfCLI path |
|
| base dir for stored results + registry |
|
| explicit mock script to run instead of the in-package mocks |
|
| seconds added to a collection's duration for the subprocess timeout |
|
Status & known limitations
This is a prototype, honest about what it is:
Never run on real hardware. Everything here was developed and validated in mock mode. The
realmode paths are best-effort and unverified. Expect to fix binary discovery, argument construction, and — most likely — the parsers, which are written against captured samples that may differ from your VTune/uProf version's actual output.CLI surfaces are reconstructed from vendor docs and public captures, not from a live tool. Both vendors change flags across versions (uProf 5.0 "simplified CLI options"; VTune knob names vary by release).
*_checkcurrently reports a hardcoded analysis/config list rather than querying the installed tool.Auto-discovery of the uProf binary sorts install paths lexicographically, so e.g.
AMDuProf_5.9can win overAMDuProf_5.10. SetUPROF_MCP_BINexplicitly.real-mode report tools re-run the CLI on every call (results are only partially cached), and*_report_raw/*_report_hotspotscarry areadOnlyHinteven though the first call may generate a report file as a side effect.uProf stdout parsing keys on marker lines (
Generated data files path:etc.); a profiled program that prints those same strings could in principle confuse session-dir discovery (a newest-directory glob is the fallback).Concurrency is best-effort. Result-id reservation is atomic (via directory creation) and registry writes take a POSIX file lock, but the lock degrades to a no-op on Windows.
The mock's numbers are fixed weights — they do not respond to code changes, so the optimize loop exercises the machinery, not real speedups, in mock mode.
The code passes a 97-test deterministic suite plus an agentic self-test, and a five-lens adversarial review whose nine confirmed findings were fixed and regression-tested — but all of that is against the mocks. Contributions that exercise it on actual VTune/uProf installs are exactly what it needs. See docs/DESIGN.md for the architecture and rationale.
License
MIT (LICENSE). The uProf invocation and stdout-contract knowledge derives from AMDResearch/intellikit (MIT, AMD) — re-implemented, not vendored; see NOTICE.
No warranty. Provided as-is under the MIT license; see the caution at the top.
Available Tools
9 toolsuprof_checkARead-only
Probe the uProf environment: binary, version, platform, active mode, results dir.
Call this before collecting. mode is "real" (actual AMDuProfCLI found), "mock"
(deterministic synthetic backend — numbers are fabricated, useful only for testing
tool plumbing), or "unavailable" (nothing runnable; notes explain how to fix).
available_analyses lists the collect configs uprof_collect accepts; note that
on non-AMD CPUs only 'tbp' actually works.
Inputs: no named parameters. Returns: mode, notes, binary, server, +5 more
uprof_collectA
Run a uProf collection and store the result; returns a result_id handle.
Pass exactly one target: command (argv list, launched under the profiler) or
pid (attach — requires duration_sec, since attach has no natural end).
config is a collect config such as "tbp" or "hotspots" (uprof_check lists
them; only 'tbp' works on non-AMD CPUs; allow_unknown=true forces an unlisted
one). call_graph=true adds call-stack sampling; extra_events are raw -e
event specs; label is a free-form tag for telling results apart later.
timeout_sec caps how long the collection may run before it is killed
(default 300s, or duration_sec when larger); raise it for long workloads.
app_exit_code is the profiled program's own exit — a non-zero value is
surfaced as a warning, so a crashed target does not masquerade as a clean
profile. In mock mode the target command really runs but every profile number
is synthetic. Feed the returned result_id to the report/compare tools.
Inputs: config (required), pid, label, command, +6 more. Returns: mode, target, analysis, warnings, +4 more
uprof_compareA
Compare two stored results function-by-function and issue a pass/fail verdict.
The core of an optimize loop: collect a baseline, change code, collect a
candidate, compare. The verdict fails when the total or any significant
function regresses more than threshold_pct; functions below
noise_floor_pct of both runs never affect the verdict. With
fail_on_regression=true a failing verdict raises a tool error carrying the
reason — use that to gate automated loops.
Inputs: baseline_id (required), candidate_id (required), threshold_pct, noise_floor_pct, +1 more. Returns: rows, notes, metric, verdict, +5 more
uprof_list_resultsARead-only
List stored uProf results: result_id, config, target, mode, creation time.
Use to rediscover result_ids from earlier collections. Entries stamped mode "mock" contain synthetic numbers.
Inputs: no named parameters. Returns: results
uprof_report_hotspotsARead-only
Top-N hottest functions of a stored result, sorted by sample share descending.
top_n is clamped to 100; row_count_total and truncated say whether more
rows exist. ignore_system_modules=true re-runs the report excluding kernel
and system libraries so application code stands out. Start with the defaults.
Inputs: result_id (required), top_n, ignore_system_modules. Returns: rows, notes, metric, result_id, +3 more
uprof_report_rawARead-only
Escape hatch: raw uProf CSV report text for a stored result, byte-capped.
uProf's report subcommand writes CSV files rather than printing to stdout, so
this returns the contents of the generated report.csv (cached after first
use). With extra_args (raw AMDuProfCLI report options, each starting with
"-") the report is regenerated into report-raw.csv using those options.
command is the CLI invocation that produces the file. Long output is
head+tail truncated; read files under result_dir for the full data.
Inputs: result_id (required), extra_args. Returns: text, command, result_id, truncated, +1 more
uprof_report_summaryARead-only
Parsed run overview of a stored result: duration, top hotspots, host details.
Generates the CSV report on first use (cached in the session dir afterwards).
The fastest way to understand a collection before drilling into hotspots.
result_id comes from uprof_collect or uprof_list_results.
Inputs: result_id (required). Returns: notes, metrics, analysis, result_id, +4 more
uprof_system_infoARead-only
Parsed AMDuProfCLI info --system: CPU model/family, core counts, OS details.
Use to decide which collect configs the hardware supports before profiling. In mock mode the fields are synthetic.
Inputs: no named parameters. Returns: mode, notes, fields
uprof_timechartA
Sample system power/frequency/thermal counters over time and summarize them.
events are timechart categories (power, frequency, temperature, voltage,
current, dvfs, energy). Samples every interval_ms (minimum 10) for
duration_sec, optionally while running command. Returns per-counter
min/max/mean/last summaries, not the full series — the CSV stays in
result_dir. Real data needs AMD hardware; in mock mode values are synthetic.
Inputs: events (required), duration_sec (required), command, interval_ms. Returns: mode, notes, samples, counters, +4 more
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 9 tools
Most tools have clearly distinct roles: check, collect, list, report, compare, timechart, system info. The three report variants (raw, summary, hotspots) are similar but their descriptions clarify the output formats, and check vs system_info have some overlap but remain distinguishable.
All tools share the 'uprof_' prefix, but the suffix pattern is inconsistent: some are verbs (check, collect, compare), some are verb_noun (list_results), and some are nouns (timechart, system_info). The report_* subfamily is internally consistent, but overall the naming mixes conventions while remaining readable.
With 9 tools, the set is well-scoped for a profiling server. Each tool covers a distinct part of the workflow (probe, collect, list, report, compare, system stats) without redundancy, and the count is comfortably within the ideal range.
The core profiling lifecycle is covered: environment check, collection, result listing, multiple report views, comparison, and time-series sampling. Minor gaps exist such as no explicit delete-result tool or a direct 'list available events' (though check includes available analyses), but agents can accomplish the main profiling tasks without dead ends.
Maintenance
Related MCP Connectors
MCP server for building and testing AI agents with multi-model experimentation and insights.
MCP Server for an Agent Task Marketplace
A full backend your AI coding agent can set up over MCP
Analytics for MCP servers. Find out which of your tools agents get wrong. MCPulse shows you which tools AI agents retry, which come back empty, and which they never call at all. Two lines inside your own server. It never sees your arguments or your results. getmcpulse.com
Related MCP Servers
AlicenseAqualityBmaintenanceMCP server that gives AI coding agents direct access to evaluation tools.23Apache 2.0- AlicenseNot gradedqualityDmaintenanceMCP servers for real-time development monitoring and interactive pair programming.1MIT
- AlicenseAqualityDmaintenanceAn MCP server that enables coding agents to autonomously test, evaluate, and tune other MCP servers by acting as a proxy and providing linting, trace recording, evaluation, comparison, and reporting tools.7MIT
- AlicenseNot gradedqualityBmaintenanceLocal MCP servers that give Claude Code access to other tools mid-session.GPL 3.0