About uniprof
uniprof is a universal CPU profiler for developers and AI agents. It profiles applications across several languages and runtimes without code changes or added dependencies, then reports hotspots.
Key features
- 01Supports Python, Node.js, Ruby, JVM, .NET and native binaries
- 02Detects and runs the matching profiler for each command
- 03Normalizes different profiler outputs into one format
- 04Statistical analysis identifies hotspot functions
- 05Container and host modes selectable with --mode
- 06MCP server can be installed for several clients
Use cases
- 01Finding performance bottlenecks in Python or Node.js apps without code changes
- 02Generating flamegraphs for native Linux or macOS programs
- 03Saving profiles as JSON for later analysis
MCP support
The project provides a stdio MCP server started with npx -y uniprof mcp run, letting MCP clients invoke profiling and analysis.
Configuration
Local server config is the same for every client. Copy it into your client’s MCP config file.
Tools
1Saved tool list · updated 2w ago
| Parameter | Type | Required | Description |
|---|---|---|---|
| cwd | string | Yes | REQUIRED: Absolute path to the working directory where the command should run (e.g., "/home/user/myproject"). This is typically your project root directory. The command will be executed with this as the current directory. Must be an absolute path starting with / (Linux/Mac) or a drive letter (Windows). |
| mode | enum | No | OPTIONAL: Profiling execution mode. "auto" (recommended) automatically chooses the best option. "container" runs profiling in Docker for consistency across environments. "host" uses locally installed profilers (requires manual setup). Use "auto" unless you have specific requirements.auto | container | host |
| command | string | Yes | REQUIRED: The exact command line to profile. Examples: "python app.py", "node server.js", "java -jar app.jar", "./my-binary". This must be the complete command as you would type it in a terminal. Do NOT include shell operators like &&, ||, or |. For commands with arguments, include them all in this single string (e.g., "python main.py --port 8080"). |
| platform | string | No | OPTIONAL: Force a specific profiler platform. Valid values: python, nodejs, ruby, php, jvm, dotnet, beam, native. Leave empty to auto-detect based on the command. Only specify if auto-detection fails or you need a specific profiler. |
| output_path | string | No | OPTIONAL: File path where the profile JSON will be saved (e.g., "/tmp/profile.json" or "./my-profile.json"). If not specified, a unique temporary file will be created automatically. The profile is always analyzed after recording. |
| extra_profiler_args | string | No | OPTIONAL: Additional platform-specific profiler arguments as a single string (e.g., "-F 999"). Common examples: "--rate 500" (Python/Ruby), "-F 500" (native/perf), "--interval 1000000" (JVM). Multiple args: "--rate 500 --native" (Python with native extension profiling). See documentation for platform-specific options. |
| enable_host_networking | boolean | No | OPTIONAL: Set to true if your application needs to connect to services on the host machine (default: false). Examples of when to enable: connecting to localhost database, accessing host APIs, inter-process communication. Only affects container mode. Requires Docker Desktop with host networking support. |
Details
From the project READMEuniprof
uniprof simplifies CPU profiling for humans and AI agents. Profile any application without code changes or added dependencies.
# Profile and analyze any app in one step
npx uniprof python script.py
Table of Contents
- Supported Platforms
- System Requirements
- Installation
- Quick Start
- Compiling with Debug Information
- Documentation
- Credits
- License
Supported Platforms
uniprof implements a common interface over multiple profilers that specialize in different platforms and runtimes. It automatically detects which profiler to use based on the command being executed, runs the profiler, transforms the varying output formats into a single format, and runs statistical analysis on the data to identify hotspots.
| Platform | Profiler | Container | Host | Min Version |
|---|---|---|---|---|
| Python | py-spy | ✅ | ✅ | Python 3.7+ |
| Node.js | 0x | ✅ | ✅ | Node 14+ |
| Ruby | rbspy | ✅ | ✅ | Ruby 2.5+ |
| PHP | Excimer | ✅ | ✅ | PHP 7.2+ |
| JVM | async-profiler | ✅ | ✅ | Java 8+ |
| .NET | dotnet-trace | ✅ | ✅ | .NET 5+ |
| BEAM | perf | ✅ | ✅* | OTP 24+ |
| Native (macOS) | Instruments | ❌ | ✅ | Xcode 14.3+ |
| Native (Linux) | perf | ✅ | ✅ | Linux 2.6.31+ |
* Linux only for host mode
System Requirements
tl;dr: macOS or Linux with Docker installed
uniprof is designed to run on macOS and Linux but has primarily been developed & tested on macOS. If you find any bugs when running on Linux, please report them. Running on a Windows host is currenly not supported, but you can run on Linux installed on Windows via WSL2. Note that when using uniprof via WSL2, profiling native Windows executables is not supported, but you can still use the profilers for the higher level language runtimes like Python and Node.js.
Profiling tools are often non-trivial to set up correctly and can require elevated privileges. To simplify set up and provide better isolation for the profiled code, uniprof defaults to using Docker containers for each runtime that are pre-configured to run specific profiling tools. uniprof mounts your workspace in the container and executes the program with the profiler attached. uniprof also supports profiling outside the container if the host system has the profiling tools installed by running with the --mode host flag. The only case where containerized execution is not supported is when profiling a native Mach-O binary on macOS, since Apple Instruments cannot run inside a container.
Installation
npm install -g uniprof
MCP Server
# Install uniprof MCP server automatically
uniprof mcp install claudecode
uniprof mcp install cursor
uniprof mcp install vscode
Supported clients for auto-installation: amp, claudecode, codex, cursor, gemini, vscode, zed
If auto-installation is not supported for your client, add an MCP server using the stdio transport with the command npx -y uniprof mcp run.
For detailed MCP documentation see docs/mcp.md.
Quick Start
Profile and analyze in one step:
# Profile most languages and get immediate analysis
uniprof python app.py
uniprof node server.js
uniprof ruby script.rb
uniprof java -jar myapp.jar
uniprof dotnet MyApp.dll
uniprof ./my-native-app
# Profile and visualize flamegraph in browser
uniprof --visualize python app.py
Save profiles to analyze and visualize later:
# 1. Check environment (optional)
uniprof bootstrap
# 2. Record a profile
uniprof record -o profile.json -- python app.py
uniprof record -o profile.json -- node server.js
uniprof record -o profile.json -- ruby script.rb
uniprof record -o profile.json -- php script.php
uniprof record -o profile.json -- java -jar myapp.jar
uniprof record -o profile.json -- ./gradlew run
uniprof record -o profile.json -- ./mvnw spring-boot:run
uniprof record -o profile.json -- dotnet MyApp.dll
uniprof record -o profile.json -- elixir script.exs
uniprof record -o profile.json -- mix run
uniprof record -o profile.json -- ./my-native-app
uniprof record -o profile.json -- /Applications/MyApp.app
# 3. Analyze profile data to find hotspots
uniprof analyze profile.json
# 4. Visualize flamegraph in the browser
uniprof visualize profile.json
For detailed command line options documentation see docs/cli.md.
Host vs. Container Modes
Use the --mode option to control how profiling runs:
auto(default): Prefer container mode when Docker is available; otherwise use host.- Language runtimes (Python/Node.js/Ruby/PHP/BEAM/JVM/.NET) default to container for zero-setup.
- Native on macOS with Mach-O binaries uses host (Instruments). ELF binaries on macOS are supported in container mode.
- Native on Linux defaults to container; host can be used if you prefer your local perf setup.
host: Force host-installed profilers.container: Force Docker containers (not supported for macOS Instruments/Mach-O binaries).
# Auto mode (default)
uniprof record -o profile.json -- python script.py
# Force host profilers
uniprof record --mode host -o profile.json -- python script.py
# Force container mode
uniprof record --mode container -o profile.json -- ./my-linux-app
Compiling with Debug Information
Native profiling requires debug information for meaningful results. Debug symbols enable the profiler to map memory addresses to function names, providing readable output instead of just hexadecimal addresses. Additionally, frame pointers improve call stack accuracy, especially for optimized code.
| Compiler | DWARF Debug Info | Frame Pointers | Notes |
|---|---|---|---|
| gcc | gcc -g -o myapp main.c | gcc -fno-omit-frame-pointer -o myapp main.c | Use -g3 for maximum debug info, -ggdb for GDB-specific extensions |
| clang | clang -g -o myapp main.cpp | clang -fno-omit-frame-pointer -o myapp main.cpp | Use -gfull on macOS for complete debug info |
| swift | swiftc -g main.swift | swiftc -Xcc -fno-omit-frame-pointer main.swift | Debug builds include symbols by default with swift build |
| cargo | cargo build (debug mode)cargo build --release + [profile.release]debug = true | RUSTFLAGS="-C force-frame-pointers=yes" cargo build | Debug builds include DWARF by default; for release builds, add debug = true to Cargo.toml |
| go | go build -gcflags=all="-N -l" | Built-in, always enabled | Go includes debug info by default; -gcflags disables optimizations for better debugging |
| zig | zig build-exe -O Debug main.zig | zig build-exe -fno-omit-frame-pointer main.zig | Use -O ReleaseSafe with debug info for optimized builds with symbols |
| ghc | ghc -g -rtsopts main.hs | ghc -fno-omit-frame-pointer main.hs | Use -prof for profiling builds; -rtsopts enables runtime profiling options |
Documentation
Credits
- py-spy (MIT) is used for Python profiling. Included in the uniprof-python image.
- 0x (MIT) is used for Node.js profiling. Included in the uniprof-nodejs image.
- rbspy (MIT) is used for Ruby profiling. Included in the uniprof-ruby image.
- Excimer (Apache 2.0) is used for PHP profiling. Included in the uniprof-php image.
- async-profiler (Apache 2.0) is used for JVM profiling. Included in the uniprof-jvm image.
- dotnet-trace (MIT) is used for .NET profiling. Included in the uniprof-dotnet image.
- perf (GPL) is used for native profiling on Linux. Included in the uniprof-native and uniprof-beam images.
- speedscope (MIT) is bundled with uniprof and used for flamegraph visualization
License
All uniprof source code in this repository is licensed under the MIT License. See LICENSE.
uniprof downloads and runs Docker images that bundle third-party software. The Dockerfiles used to build these images can be found in containers/. These images and their contents are not covered by the MIT license and are governed by their own licenses. uniprof does not grant rights to those components and does not relicense them.
Comments
New to MCP?
From what the protocol is to installing your first server, these answers cover most first questions.
An open protocol that defines how AI applications connect to external tools and data in a uniform way. Clients talk to the model; MCP servers provide tools, resources and prompt templates. They exchange standard messages, so one server can be reused by many clients.