trace-mcp
A Python MCP server for controlling Android system tracing via a native traceserver binary, supporting device selection and custom port forwarding. Designed for use with the uv/uvx toolchain.
Prerequisites
- Python 3.12+
- uv (for dependency management and running scripts)
- Android Debug Bridge (adb) in your PATH
- Android device (API 21+), with USB debugging enabled
- Prebuilt traceserver binaries in the
bin/directory for all supported ABIs
Installation
uv pip install -e .
Usage
Start the MCP server (with uvx)
uvx trace-mcp --port 12345
--port(optional): Specify the port for traceserver and forwarding (default: 12345)
MCP Tool Functions
All tool functions accept an optional sn (device serial number) and port argument.
1. begin_trace
Begin a trace section on the device.
- Arguments:
trace_tag(str): Trace tag namesn(str, optional): Device serial numberport(int, optional): Port (default: 8080)
2. end_trace
End a trace section on the device.
- Arguments:
trace_tag(str): Trace tag namesn(str, optional): Device serial numberport(int, optional): Port (default: 8080)
3. trace_test_mode
Start traceserver in test mode on the device.
- Arguments:
sn(str, optional): Device serial numberport(int, optional): Port (default: 8080)
4. stop_traceserver
Stop the traceserver process and remove port forwarding.
- Arguments:
sn(str, optional): Device serial numberport(int, optional): Port (default: 8080)
Example
uvx trace-mcp --port 9000
Then, use your MCP client to call the tool functions with the appropriate arguments.
Project Structure
main.py: MCP server and tool function implementationsbin/: Prebuilt traceserver binaries for each ABIpyproject.toml: Project configuration for uv/uvx
License
MIT
Metadata
Release files for trace-mcp 1.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| trace_mcp-1.0.1.tar.gz | 33.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| trace_mcp-1.0.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 74.3 kB
Release files / trace_mcp-1.0.1.tar.gz
| Download URL | trace_mcp-1.0.1.tar.gz |
|---|---|
| Size | 33.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7aa37cffb2c1db0d5b80d206d5da725fc0099bfe5465258ff1744305528cf245
|
|
BLAKE2b-256 checksum How to use checksums |
1ce76b2d21d3b9f5734e724d0e584efac8069410b6520d027c5df9024f7c3303
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.6.17
|
Release files / trace_mcp-1.0.1-py3-none-any.whl
| Download URL | trace_mcp-1.0.1-py3-none-any.whl |
|---|---|
| Size | 40.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
918a2b2dea36fc8c764d8bc0122480801fe912ae8376a0a3f21a20f0b6868c0e
|
|
BLAKE2b-256 checksum How to use checksums |
5ba992bfeac2e7a6d296a420215d87a51c6bfc3edb351e15c792113aac77b8e1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.6.17
|