Skip to main content

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 name
    • sn (str, optional): Device serial number
    • port (int, optional): Port (default: 8080)

2. end_trace

End a trace section on the device.

  • Arguments:
    • trace_tag (str): Trace tag name
    • sn (str, optional): Device serial number
    • port (int, optional): Port (default: 8080)

3. trace_test_mode

Start traceserver in test mode on the device.

  • Arguments:
    • sn (str, optional): Device serial number
    • port (int, optional): Port (default: 8080)

4. stop_traceserver

Stop the traceserver process and remove port forwarding.

  • Arguments:
    • sn (str, optional): Device serial number
    • port (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 implementations
  • bin/: Prebuilt traceserver binaries for each ABI
  • pyproject.toml: Project configuration for uv/uvx

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

trace_mcp-1.0.1.tar.gz (33.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

trace_mcp-1.0.1-py3-none-any.whl (40.6 kB view details)

Uploaded Python 3

File details

Details for the file trace_mcp-1.0.1.tar.gz.

File metadata

  • Download URL: trace_mcp-1.0.1.tar.gz
  • Upload date:
  • Size: 33.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.6.17

File hashes

Hashes for trace_mcp-1.0.1.tar.gz
Algorithm Hash digest
SHA256 7aa37cffb2c1db0d5b80d206d5da725fc0099bfe5465258ff1744305528cf245
MD5 81e98bedc8ae191260fc74c5681fc227
BLAKE2b-256 1ce76b2d21d3b9f5734e724d0e584efac8069410b6520d027c5df9024f7c3303

See more details on using hashes here.

File details

Details for the file trace_mcp-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: trace_mcp-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 40.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.6.17

File hashes

Hashes for trace_mcp-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 918a2b2dea36fc8c764d8bc0122480801fe912ae8376a0a3f21a20f0b6868c0e
MD5 f143e7d5878727f515329e0beca9cca7
BLAKE2b-256 5ba992bfeac2e7a6d296a420215d87a51c6bfc3edb351e15c792113aac77b8e1

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page