Android Security Analyzer
MCP server for static security analysis of Android application source code. Runs on Cloudflare Workers as a remote MCP server over Streamable HTTP.
What it does
Analyzes Android project source files — without building the project — and returns a structured security report. The analysis covers:
- Manifest analysis — exported components, dangerous permissions, cleartext traffic, debug flags, backup settings, SDK versions
- Gradle/build config — release build misconfigurations, outdated SDKs, suspicious dependencies, hardcoded secrets
- Source code (Java/Kotlin) — insecure WebView, SSL/TLS bypass, weak crypto, SQL injection patterns, process execution, insecure file storage, PendingIntent issues
- XML configuration — network security config weaknesses, overly broad file provider paths
- Secret scanning — API keys, tokens, passwords, private keys, cloud credentials, high-entropy strings
All analysis is regex/pattern-based and runs natively in the Workers runtime with no external tools, Java, or Android SDK required.
Architecture
Key design decisions:
- Stateless — no sessions, no Durable Objects
- Minimal MCP JSON-RPC 2.0 implementation (no heavy SDK dependencies)
- Data-driven rule engine with extensible rule registry
- Independent analyzers with unified Finding type
- Lightweight XML parsing via
fast-xml-parser
- Input validation via
zod
- Bundle size: ~66KB gzipped
MCP Tools
Install
Hosted server (recommended for Cline / MCP clients): no local install needed. The server runs at:
https://android-security-analyzer.ako-labs.workers.dev/mcp
Add this URL to your MCP client configuration (see Connecting from an MCP client below).
Local development:
Development
This starts a local Wrangler dev server. The MCP endpoint is available at http://localhost:8787/mcp.
Deploy
Deploys to Cloudflare Workers. Requires wrangler authentication (npx wrangler login).
Testing
Local MCP Testing
Initialize the connection
Unix:
Windows (PowerShell):
List available tools
Unix:
Windows (PowerShell): ответ приходит в result.tools; чтобы увидеть список как JSON, используйте сырой ответ:
Либо через объект: (Invoke-RestMethod ...).result.tools | ConvertTo-Json -Depth 5
Check health
Unix:
Windows (PowerShell):
Run analysis (minimal example)
Unix:
Windows (PowerShell):
Connecting from an MCP client
Add to your MCP client configuration:
For production (hosted):
Security Rules
The analyzer implements 53 security rules across 5 categories:
Each finding includes:
- Stable rule ID
- Severity (critical/high/medium/low/info) and confidence (high/medium/low)
- File path and line number (when determinable)
- Evidence snippet
- CWE and OWASP Mobile Top 10 mappings
- Actionable recommendation
Scoring
Risk score (0-100) is computed from finding severities:
- Critical: 9 points
- High: 6 points
- Medium: 3 points
- Low: 1 point
- Info: 0 points
The raw sum is normalized against an expected maximum of 50 points.
Limitations
- Not a SAST replacement — pattern/regex-based heuristics, not full AST/dataflow analysis
- No build required — analyzes raw source, so build-time transforms are not visible
- False positives possible — especially for secret scanning and some code patterns
- Workers constraints — 128MB memory limit, CPU time limits, no filesystem access
- No APK/AAB analysis — source code only
- No inter-procedural analysis — patterns are matched per-file, not across call graphs
Project Structure
Adding New Rules
- Define the rule in the appropriate file under
src/rules/
- Add detection logic in the corresponding analyzer under
src/analyzers/
- Add CWE mapping in
src/mappings/cwe.ts if needed
- Add a test case
- The rule is automatically registered via
src/core/registry.ts
License
MIT