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.
Project description
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
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file trace_mcp-1.0.0.tar.gz.
File metadata
- Download URL: trace_mcp-1.0.0.tar.gz
- Upload date:
- Size: 3.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.6.17
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d9f6d4225703790f4f664be36b2363d07bc1fa4e5ffae7d61b4dc747ec56a352
|
|
| MD5 |
3f42d705818583130cb1c1db40e7b2d1
|
|
| BLAKE2b-256 |
1653cb31351fc4a9688fd173ee19fb39fdce4d189e8ec849303df0c3b6b8abee
|
File details
Details for the file trace_mcp-1.0.0-py3-none-any.whl.
File metadata
- Download URL: trace_mcp-1.0.0-py3-none-any.whl
- Upload date:
- Size: 3.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.6.17
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
835cfae4efa17a2f83be5e794c3c49854a97aae0e1f88654957a86a4bd7c14e6
|
|
| MD5 |
f26f8d61335cb5b76b5a476463bc3a32
|
|
| BLAKE2b-256 |
23a0be234e907c9f502bb1ebacddcf0901233c06509c00e0de5287f7e1efb78d
|