android-mcp-toolkit 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +125 -0
- package/dist/index.js +1489 -0
- package/package.json +37 -0
package/README.md
ADDED
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
# Android MCP Toolkit for AI Agents
|
|
2
|
+
|
|
3
|
+
Small MCP server with two tools:
|
|
4
|
+
- Fast SVG → Android VectorDrawable conversion (cached, file or inline).
|
|
5
|
+
- adb logcat reader with package/pid/tag filters for quick crash triage.
|
|
6
|
+
|
|
7
|
+
## Why this exists
|
|
8
|
+
**The Mission: Bringing Native Android to the AI Agent Era**
|
|
9
|
+
|
|
10
|
+
While the AI ecosystem flourishes with web-first tools, Android development often feels left behind. This MCP server is my answer to that gap—a dedicated bridge connecting AI Agents directly to the Android toolchain.
|
|
11
|
+
|
|
12
|
+
⚡ Zero-Friction Asset Conversion: Convert SVGs to VectorDrawables instantly without the overhead of launching Android Studio.
|
|
13
|
+
|
|
14
|
+
🔍 Direct Diagnostic Access: Empower agents to pull, filter, and analyze adb logcat streams (by package, PID, or tag) in real-time.
|
|
15
|
+
|
|
16
|
+
🤖 Agent-Native Architecture: Deliver structured, scriptable outputs that LLMs can parse and act upon efficiently.
|
|
17
|
+
|
|
18
|
+
🚀 Built for Extensibility: A solid foundation designed to grow, paving the way for future utilities like bitmap helpers and asset validation.
|
|
19
|
+
|
|
20
|
+
## Pairing ideas
|
|
21
|
+
- **Figma MCP**: grab SVGs from designs, feed to `convert-svg-to-android-drawable` to get XML for Android resources.
|
|
22
|
+
- **Debugging**: while running the app, call `read-adb-logcat` with package name or tag to capture crashes and filtered logs without leaving the MCP client.
|
|
23
|
+
|
|
24
|
+
### Previews
|
|
25
|
+
**SVG to VectorDrawable**
|
|
26
|
+
- Figma request → SVG extraction
|
|
27
|
+

|
|
28
|
+
- Flag conversion preview (single)
|
|
29
|
+

|
|
30
|
+
- Batch flag review (side-by-side)
|
|
31
|
+

|
|
32
|
+
- Batch run via MCP (console)
|
|
33
|
+

|
|
34
|
+
|
|
35
|
+
**ADB logcat tool**
|
|
36
|
+
- Crash capture prompt (inputs + filters)
|
|
37
|
+

|
|
38
|
+
- Response preview (summarized logcat)
|
|
39
|
+

|
|
40
|
+
|
|
41
|
+
## Current tools
|
|
42
|
+
- `convert-svg-to-android-drawable`
|
|
43
|
+
- Inputs: `svg` (inline) **or** `svgPath` (file path). Optional: `outputPath`, `floatPrecision` (default 2), `fillBlack` (default false), `xmlTag` (default false), `tint`, `cache` (default true).
|
|
44
|
+
- Output: VectorDrawable XML text; also writes to disk when `outputPath` is provided.
|
|
45
|
+
- Performance: LRU cache (32 entries) keyed by SVG + options plus fast reuse in-session.
|
|
46
|
+
- Converter: vendored fork in `vendor/svg2vectordrawable` with fixes for `rgb()/rgba()`, `hsl()/hsla()`, and named colors. Upstream license: `vendor/svg2vectordrawable/LICENSE` (MIT).
|
|
47
|
+
|
|
48
|
+
- `read-adb-logcat`
|
|
49
|
+
- Inputs: `packageName` (resolve pid via `adb shell pidof -s`), `pid` (explicit), `tag`, `priority` (`V|D|I|W|E|F|S`, default `V`), `maxLines` (tail count, default `200`, max `2000`), `timeoutMs` (default `5000`, max `15000`).
|
|
50
|
+
- Behavior: Runs `adb logcat -d -t <maxLines>` with optional `--pid=<pid>` and `-s tag:priority`.
|
|
51
|
+
- Output: Returns the logcat text; if no lines are returned, responds with a short message.
|
|
52
|
+
- Notes: Requires `adb` available in PATH and a connected device/emulator. Provide at least one of `packageName`, `pid`, or `tag` to scope logs.
|
|
53
|
+
|
|
54
|
+
- `get-pid-by-package`
|
|
55
|
+
- Inputs: `packageName` (required), `timeoutMs` (default `5000`, max `15000`).
|
|
56
|
+
- Behavior: Resolves pid via `adb shell pidof -s <package>`.
|
|
57
|
+
- Notes: Use this first, then pass pid to other logcat tools for noise-free filtering.
|
|
58
|
+
|
|
59
|
+
- `get-current-activity`
|
|
60
|
+
- Inputs: `timeoutMs` (default `5000`, max `15000`).
|
|
61
|
+
- Behavior: Parses `adb shell dumpsys window` for `mCurrentFocus` / `mFocusedApp` to reveal the currently focused window (useful even in single-activity setups to confirm top window).
|
|
62
|
+
|
|
63
|
+
- `fetch-crash-stacktrace`
|
|
64
|
+
- Inputs: `packageName` (optional, resolves pid), `maxLines` (default `400`, max `2000`), `timeoutMs` (default `5000`, max `15000`).
|
|
65
|
+
- Behavior: Pulls crash buffer via `adb logcat -b crash -d -t <maxLines>`; filters by `--pid` when package is provided.
|
|
66
|
+
|
|
67
|
+
- `check-anr-state`
|
|
68
|
+
- Inputs: `maxLines` (default `400`, max `2000`), `timeoutMs` (default `5000`, max `15000`).
|
|
69
|
+
- Behavior: Fetches `ActivityManager:E *:S` (recent ANR logs) and best-effort reads `/data/anr/traces.txt` (stat + tail 200 lines). May require root/debuggable.
|
|
70
|
+
|
|
71
|
+
- `clear-logcat-buffer`
|
|
72
|
+
- Inputs: `timeoutMs` (default `5000`, max `15000`).
|
|
73
|
+
- Behavior: Runs `adb logcat -c` to clear buffers before a new scenario.
|
|
74
|
+
|
|
75
|
+
## Roadmap (planned)
|
|
76
|
+
- Additional MCP tools for Android assets (e.g., batch conversions, validations, optimizers).
|
|
77
|
+
- Optional resource prompts for common Android drawables/templates.
|
|
78
|
+
- Upcoming MCP utilities (planned):
|
|
79
|
+
- Logcat reader: stream and filter Android logcat output via MCP.
|
|
80
|
+
- Asset checkers: flag common drawable issues (size, alpha, color profile).
|
|
81
|
+
- Batch conversions: multi-SVG to VectorDrawable with consistent options.
|
|
82
|
+
- Template prompts: quick-start drawable/XML snippets for common patterns.
|
|
83
|
+
|
|
84
|
+
## Quick start
|
|
85
|
+
- `npm install`
|
|
86
|
+
- `npm start` (keeps running on stdio; point your MCP client at `node src/index.js`)
|
|
87
|
+
|
|
88
|
+
## Run via npx
|
|
89
|
+
- From repo root: `npx .` (uses `svg-to-drawable-mcp` bin; runs on stdio)
|
|
90
|
+
|
|
91
|
+
## Run with Docker
|
|
92
|
+
- Build: `docker build -t svg-to-drawable-mcp .`
|
|
93
|
+
- Run: `docker run --rm -it svg-to-drawable-mcp`
|
|
94
|
+
- The container prints to stdio; point your MCP client at `docker run --rm -i svg-to-drawable-mcp`.
|
|
95
|
+
|
|
96
|
+
## Use in Cursor (MCP config)
|
|
97
|
+
Add to your Cursor settings JSON:
|
|
98
|
+
```json
|
|
99
|
+
{
|
|
100
|
+
"mcpServers": {
|
|
101
|
+
"figma-desktop": {
|
|
102
|
+
"url": "http://127.0.0.1:3845/mcp"
|
|
103
|
+
},
|
|
104
|
+
"svg-to-android-drawable": {
|
|
105
|
+
"command": "npx",
|
|
106
|
+
"args": [
|
|
107
|
+
"-y",
|
|
108
|
+
"/Users/admin/code/android_util_mcp_server"
|
|
109
|
+
]
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
```
|
|
114
|
+
Adjust the local path if your repo lives elsewhere.
|
|
115
|
+
|
|
116
|
+
## Examples
|
|
117
|
+
- Input SVG: `sample_svg.svg`
|
|
118
|
+
- Output VectorDrawable: `examples/sample_svg.xml`
|
|
119
|
+
|
|
120
|
+
## Notes
|
|
121
|
+
- Transport: stdio via `@modelcontextprotocol/sdk`.
|
|
122
|
+
- Base deps kept minimal; everything needed to convert SVGs is vendored/included.
|
|
123
|
+
|
|
124
|
+
## Contact
|
|
125
|
+
- nam.nv205106@gmail.com
|