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 分

    請在儲存庫或註冊中心條目中宣告授權條款。