Android Security Analyzer

io.github.ako2345由 GitHub 账号 ako2345 发布v1.0.0更新于 Oct 24, 2026

MCP server for static security analysis of Android source code

已验证Streamable HTTP可网页运行开发者工具安全与监控

概览

AI 生成的概览

远程 MCP 服务器,对 Android 项目源码做静态安全扫描,返回带风险评分的结构化报告与修复建议。

可以做什么
  • 分析 Android 项目文件(清单、Gradle、Java/Kotlin 源码、XML 配置),返回含问题、严重级别、置信度、CWE/OWASP 映射和建议的安全报告
  • 列出已实现的安全检查规则及其 ID、类别、严重级别和说明
  • 按规则 ID 解释单条发现,说明风险原因、修复方式和误报注意事项
  • 查询服务器健康状态、版本和规则引擎统计
适用场景
适合在审查 Android 应用源码中的常见安全问题时使用,例如导出组件、调试开关、明文流量、不安全的 WebView 或 SSL 设置、弱加密、硬编码密钥以及有风险的 Gradle 发布配置,且无需构建项目或安装 Android SDK。
运行要求
需要一个远程 Streamable HTTP 端点;未声明本地安装、账号、API 密钥或请求头。README 另说明可用 Node.js 与 Wrangler 在本地运行,部署到 Cloudflare Workers 需要 wrangler 登录认证。
安装前请注意
项目源码(包括其中可能硬编码的密钥)会被发送到第三方托管端点进行分析。结果基于正则/模式启发式规则,并非完整 SAST,误报和漏报都可能出现,也不支持 APK/AAB 或跨过程分析。发现应作为起点,而非安全结论。

安装

在 SourceWeft 中

  1. 打开 控制台中的 Android Security Analyzer,将其添加到工作区。
  2. 为需要使用其工具的对话启用该服务。

Web executable,通过 Streamable HTTP。 远程服务在工作区中配置后即可从网页运行时运行。

交给智能体安装

把这段提示词粘贴到 Claude Code、Codex、Cursor 等智能体,或 SourceWeft 对话中。智能体会读取该服务器的安装指南,先向你展示发布者、端点和登录方式,经你同意后再把它添加到你的客户端。密钥不会写进任何命令。

阅读 https://sourceweft.com/mcp/io.github.ako2345%2Fandroid-security-analyzer/install.md,并按其中说明把这个 MCP 服务器接入我的客户端。修改任何配置之前,先告诉我它的发布者、端点和登录方式,等我确认。不要把 API 密钥写进命令或我会提交的文件;问我密钥应从哪里获取。

查看智能体所依据的安装指南

其他 MCP 客户端

把它添加到你客户端的 mcpServers 配置中。

{
  "mcpServers": {
    "android-security-analyzer": {
      "type": "http",
      "url": "https://android-security-analyzer.ako-labs.workers.dev/mcp"
    }
  }
}

README

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

POST /mcp ──► McpServer (JSON-RPC 2.0) ──► Tool Router                                              │              ┌───────────────────────────────┘              ▼         Orchestrator              │    ┌─────────┼─────────┬─────────────┬──────────────┐    ▼         ▼         ▼             ▼              ▼ Manifest  Gradle   Source Code   XML Config    Secret Analyzer  Analyzer  Analyzer     Analyzer     Scanner    │         │         │             │              │    └─────────┴─────────┴─────────────┴──────────────┘              │              ▼     Scoring + Deduplication ──► AnalysisReport

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

ToolDescription
analyze_android_projectFull security analysis of project files
list_android_security_checksList all implemented security rules
explain_findingDetailed explanation of a specific rule
healthServer status and rule engine stats

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:

bash
npm install

Development

bash
npm run dev

This starts a local Wrangler dev server. The MCP endpoint is available at http://localhost:8787/mcp.

Deploy

bash
npm run deploy

Deploys to Cloudflare Workers. Requires wrangler authentication (npx wrangler login).

Testing

bash
npm test              # Run all testsnpm run test:watch    # Watch modenpm run typecheck     # TypeScript type checking

Local MCP Testing

Initialize the connection

Unix:

bash
curl -X POST http://localhost:8787/mcp \  -H "Content-Type: application/json" \  -d '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2025-03-26","capabilities":{},"clientInfo":{"name":"test","version":"1.0"}}}'

Windows (PowerShell):

powershell
(Invoke-WebRequest -Method Post -Uri "http://localhost:8787/mcp" -ContentType "application/json" -Body '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2025-03-26","capabilities":{},"clientInfo":{"name":"test","version":"1.0"}}}' -UseBasicParsing).Content

List available tools

Unix:

bash
curl -X POST http://localhost:8787/mcp \  -H "Content-Type: application/json" \  -d '{"jsonrpc":"2.0","id":2,"method":"tools/list"}'

Windows (PowerShell): ответ приходит в result.tools; чтобы увидеть список как JSON, используйте сырой ответ:

powershell
(Invoke-WebRequest -Method Post -Uri "http://localhost:8787/mcp" -ContentType "application/json" -Body '{"jsonrpc":"2.0","id":2,"method":"tools/list"}' -UseBasicParsing).Content

Либо через объект: (Invoke-RestMethod ...).result.tools | ConvertTo-Json -Depth 5

Check health

Unix:

bash
curl -X POST http://localhost:8787/mcp \  -H "Content-Type: application/json" \  -d '{"jsonrpc":"2.0","id":3,"method":"tools/call","params":{"name":"health","arguments":{}}}'

Windows (PowerShell):

powershell
(Invoke-WebRequest -Method Post -Uri "http://localhost:8787/mcp" -ContentType "application/json" -Body '{"jsonrpc":"2.0","id":3,"method":"tools/call","params":{"name":"health","arguments":{}}}' -UseBasicParsing).Content

Run analysis (minimal example)

Unix:

bash
curl -X POST http://localhost:8787/mcp \  -H "Content-Type: application/json" \  -d '{    "jsonrpc": "2.0",    "id": 4,    "method": "tools/call",    "params": {      "name": "analyze_android_project",      "arguments": {        "projectName": "TestApp",        "files": [          {            "path": "app/src/main/AndroidManifest.xml",            "content": "<manifest><application android:debuggable=\"true\" android:allowBackup=\"true\"></application></manifest>"          }        ]      }    }  }'

Windows (PowerShell):

powershell
$body = @{  jsonrpc = "2.0"  id = 4  method = "tools/call"  params = @{    name = "analyze_android_project"    arguments = @{      projectName = "TestApp"      files = @(        @{          path = "app/src/main/AndroidManifest.xml"          content = "<manifest><application android:debuggable=`"true`" android:allowBackup=`"true`"></application></manifest>"        }      )    }  }} | ConvertTo-Json -Depth 10(Invoke-WebRequest -Method Post -Uri "http://localhost:8787/mcp" -ContentType "application/json" -Body $body -UseBasicParsing).Content

Connecting from an MCP client

Add to your MCP client configuration:

json
{  "mcpServers": {    "android-security-analyzer": {      "url": "http://localhost:8787/mcp"    }  }}

For production (hosted):

json
{  "mcpServers": {    "android-security-analyzer": {      "url": "https://android-security-analyzer.ako-labs.workers.dev/mcp"    }  }}

Security Rules

The analyzer implements 53 security rules across 5 categories:

CategoryPrefixRulesExamples
ManifestMAN-*17debuggable, allowBackup, exported components, permissions
GradleGRD-*9release config, SDK versions, dependencies, secrets
SourceSRC-*17WebView, SSL/TLS, crypto, injection, file storage
XML ConfigXML-*4network security config, file provider paths
SecretSEC-*7API keys, tokens, passwords, cloud credentials

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

src/├── index.ts                          # Worker entry point├── server/│   ├── mcp.ts                        # MCP JSON-RPC 2.0 handler│   └── tools/                        # MCP tool implementations│       ├── analyzeAndroidProject.ts│       ├── listAndroidSecurityChecks.ts│       ├── explainFinding.ts│       └── health.ts├── core/│   ├── types.ts                      # TypeScript types & Zod schemas│   ├── scoring.ts                    # Risk score computation│   ├── registry.ts                   # Rule registry│   └── orchestrator.ts              # Analysis orchestrator├── analyzers/│   ├── manifestAnalyzer.ts│   ├── gradleAnalyzer.ts│   ├── sourceAnalyzer.ts│   ├── xmlConfigAnalyzer.ts│   └── secretScanner.ts├── parsers/│   ├── xml.ts                        # XML parser wrapper│   ├── gradle.ts                     # Gradle file parser│   ├── source.ts                     # Source code pattern matcher│   └── files.ts                      # File classifier├── rules/│   ├── manifestRules.ts│   ├── gradleRules.ts│   ├── sourceRules.ts│   ├── xmlRules.ts│   └── secretRules.ts├── mappings/│   ├── cwe.ts                        # CWE descriptions│   └── owaspMobile.ts               # OWASP Mobile Top 10└── utils/    ├── lines.ts                      # Line number utilities    ├── paths.ts                      # Path classification    └── text.ts                       # Text utilitiestest/├── fixtures/                         # Sample Android project files├── unit/                             # Unit tests per module└── integration/                      # Full analysis integration tests

Adding New Rules

  1. Define the rule in the appropriate file under src/rules/
  2. Add detection logic in the corresponding analyzer under src/analyzers/
  3. Add CWE mapping in src/mappings/cwe.ts if needed
  4. Add a test case
  5. The rule is automatically registered via src/core/registry.ts

License

MIT

来源:README.md,提交 a14bd0d

工具

4

analyze_android_project

Analyzes an Android project's source code for security vulnerabilities. Accepts project files (AndroidManifest.xml, build.gradle, Java/Kotlin sources, XML configs) and returns a structured security report with findings, severity scores, and recommendations.

输入参数files必填optionsprojectName必填

list_android_security_checks

Returns the list of all implemented security checks/rules with their IDs, categories, severity levels, and descriptions.

输入参数category

explain_finding

Explains a specific security finding by its rule ID. Returns why it is a risk, how to fix it, and false positive considerations.

输入参数findingId必填

health

Returns the server health status, version, and rule engine statistics.

无需输入参数。

版本历史

1
  1. v1.0.0最新Sep 16, 2026

评分

已满足适用检查项的 90%

该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。

  • 近 30 天内可连通必需25 分
  • 已声明认证方式必需10 分
  • 已列出工具必需15 分
  • 描述必需15 分
  • 图标10 分
  • 文档15 分
  • 许可证10 分

    请在仓库或注册中心条目中声明许可证。