androjack-mcp 1.5.1 โ 1.6.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 +104 -51
- package/build/cache.js +30 -5
- package/build/constants.js +1 -1
- package/build/http-server.js +2 -2
- package/build/http.js +17 -2
- package/build/index.js +1 -1
- package/build/install.js +74 -74
- package/build/serve.js +59 -59
- package/config/antigravity_mcp.json +32 -0
- package/config/claude_desktop_config.json +17 -0
- package/config/cursor_mcp.json +21 -0
- package/config/jetbrains_mcp.json +28 -0
- package/config/kiro_mcp.json +40 -0
- package/config/vscode_mcp.json +24 -0
- package/config/windsurf_mcp.json +18 -0
- package/manifest.json +21 -0
- package/package.json +27 -15
- package/server.json +21 -0
- package/src/cache.ts +82 -48
- package/src/constants.ts +3 -3
- package/src/http-server.ts +12 -12
- package/src/http.ts +44 -25
- package/src/index.ts +4 -4
- package/src/install.ts +84 -84
- package/src/serve.ts +63 -63
package/README.md
CHANGED
|
@@ -8,8 +8,9 @@
|
|
|
8
8
|
|
|
9
9
|

|
|
10
10
|
|
|
11
|
-
### ๐ฌ
|
|
11
|
+
### ๐ฌ Discover AndroJack
|
|
12
12
|
|
|
13
|
+
[](https://androjack-web.netlify.app/)
|
|
13
14
|
[](https://youtu.be/O2aFyObV-B0)
|
|
14
15
|
|
|
15
16
|
### *An MCP server that equips your AI coding assistant with live, verified Android knowledge โ so it builds from official sources, not from memory.*
|
|
@@ -17,6 +18,7 @@
|
|
|
17
18
|
<br/>
|
|
18
19
|
|
|
19
20
|
[](https://www.npmjs.com/package/androjack-mcp)
|
|
21
|
+
[](https://marketplace.visualstudio.com/items?itemName=VIKAS9793.androjack-vscode)
|
|
20
22
|
[](https://github.com/VIKAS9793/AndroJack-mcp/stargazers)
|
|
21
23
|
[](https://nodejs.org)
|
|
22
24
|
[](https://modelcontextprotocol.io)
|
|
@@ -27,11 +29,16 @@
|
|
|
27
29
|
|
|
28
30
|
### ๐ One-Click Install
|
|
29
31
|
|
|
30
|
-
[](https://marketplace.visualstudio.com/items?itemName=VIKAS9793.androjack-vscode)
|
|
33
|
+
[](https://claude.ai/integrations/install-mcp?params=eyJuYW1lIjoiYW5kcm9qYWNrIiwiY29tbWFuZCI6Im5weCIsImFyZ3MiOlsiLXkiLCJhbmRyb2phY2stbWNwQDEuNi4wIl19)
|
|
34
|
+
[](https://cursor.com/install-mcp?name=androjack&config=eyJjb21tYW5kIjoibnB4IiwiYXJncyI6WyIteSIsImFuZHJvamFjay1tY3BAMS42LjAiXX0=)
|
|
35
|
+
[](https://kiro.dev/launch/mcp/add?name=androjack&config=%7B%22command%22%3A%22npx%22%2C%22args%22%3A%5B%22-y%22%2C%22androjack-mcp%401.6.0%22%5D%7D)
|
|
33
36
|
[](https://www.npmjs.com/package/androjack-mcp)
|
|
34
37
|
|
|
38
|
+
**VS Code distribution:** AndroJack MCP is also live on the VS Code Marketplace as [AndroJack MCP for VS Code](https://marketplace.visualstudio.com/items?itemName=VIKAS9793.androjack-vscode). The `VS Code` badge above always reflects the currently published Marketplace version.
|
|
39
|
+
|
|
40
|
+
**PM / APM docs:** Product strategy, JTBD, personas, roadmap, user stories, competitive analysis, and GTM materials now live under [product-management/README.md](product-management/README.md).
|
|
41
|
+
|
|
35
42
|
<br/>
|
|
36
43
|
|
|
37
44
|
**Also works with:** Windsurf ยท VS Code Copilot ยท Google Antigravity ยท JetBrains AI โ see [Manual Config](#-manual-config--copy--paste) below โ
|
|
@@ -487,10 +494,10 @@ Each tool lists the **specific failure mode it prevents** โ not just what it d
|
|
|
487
494
|
|
|
488
495
|
## ๐ Quick Start โ Zero Install Required
|
|
489
496
|
|
|
490
|
-
### Option 1 โ Interactive CLI (v1.
|
|
497
|
+
### Option 1 โ Interactive CLI (v1.6.0) โจ Recommended
|
|
491
498
|
|
|
492
499
|
```bash
|
|
493
|
-
npx androjack-mcp install
|
|
500
|
+
npx androjack-mcp@1.6.0 install
|
|
494
501
|
```
|
|
495
502
|
|
|
496
503
|
Launches a full animated terminal wizard:
|
|
@@ -507,20 +514,20 @@ Launches a full animated terminal wizard:
|
|
|
507
514
|
### Option 2 โ Targeted installs (non-interactive, safe in any environment)
|
|
508
515
|
|
|
509
516
|
```bash
|
|
510
|
-
# Auto-detect and install to all found IDEs
|
|
511
|
-
npx androjack-mcp install --auto
|
|
512
|
-
|
|
513
|
-
# Install to one specific IDE
|
|
514
|
-
npx androjack-mcp install --ide=cursor
|
|
515
|
-
npx androjack-mcp install --ide=claude
|
|
516
|
-
npx androjack-mcp install --ide=vscode
|
|
517
|
-
npx androjack-mcp install --ide=windsurf
|
|
518
|
-
npx androjack-mcp install --ide=jetbrains
|
|
519
|
-
npx androjack-mcp install --ide=antigravity
|
|
520
|
-
npx androjack-mcp install --ide=kiro
|
|
521
|
-
|
|
522
|
-
# Check what's installed where
|
|
523
|
-
npx androjack-mcp install --list
|
|
517
|
+
# Auto-detect and install to all found IDEs
|
|
518
|
+
npx androjack-mcp@1.6.0 install --auto
|
|
519
|
+
|
|
520
|
+
# Install to one specific IDE
|
|
521
|
+
npx androjack-mcp@1.6.0 install --ide=cursor
|
|
522
|
+
npx androjack-mcp@1.6.0 install --ide=claude
|
|
523
|
+
npx androjack-mcp@1.6.0 install --ide=vscode
|
|
524
|
+
npx androjack-mcp@1.6.0 install --ide=windsurf
|
|
525
|
+
npx androjack-mcp@1.6.0 install --ide=jetbrains
|
|
526
|
+
npx androjack-mcp@1.6.0 install --ide=antigravity
|
|
527
|
+
npx androjack-mcp@1.6.0 install --ide=kiro
|
|
528
|
+
|
|
529
|
+
# Check what's installed where
|
|
530
|
+
npx androjack-mcp@1.6.0 install --list
|
|
524
531
|
```
|
|
525
532
|
|
|
526
533
|
### Option 3 โ From your IDE's NPM Scripts panel (one click)
|
|
@@ -543,7 +550,7 @@ install-mcp:list โ see detection status
|
|
|
543
550
|
### Option 4 โ Test all tools (no IDE needed)
|
|
544
551
|
|
|
545
552
|
```bash
|
|
546
|
-
npx @modelcontextprotocol/inspector npx androjack-mcp
|
|
553
|
+
npx @modelcontextprotocol/inspector npx androjack-mcp@1.6.0
|
|
547
554
|
```
|
|
548
555
|
|
|
549
556
|
> **Requires:** Node.js 18+. Nothing else.
|
|
@@ -570,7 +577,7 @@ npx @modelcontextprotocol/inspector npx androjack-mcp
|
|
|
570
577
|
|
|
571
578
|
### AWS Kiro
|
|
572
579
|
|
|
573
|
-
[](https://kiro.dev/launch/mcp/add?name=androjack&config=%7B%22command%22%3A%22npx%22%2C%22args%22%3A%5B%22-y%22%2C%22androjack-mcp%22%5D%2C%22disabled%22%3Afalse%2C%22autoApprove%22%3A%5B%5D%7D)
|
|
580
|
+
[](https://kiro.dev/launch/mcp/add?name=androjack&config=%7B%22command%22%3A%22npx%22%2C%22args%22%3A%5B%22-y%22%2C%22androjack-mcp%401.6.0%22%5D%2C%22disabled%22%3Afalse%2C%22autoApprove%22%3A%5B%5D%7D)
|
|
574
581
|
|
|
575
582
|
---
|
|
576
583
|
|
|
@@ -584,7 +591,7 @@ npx @modelcontextprotocol/inspector npx androjack-mcp
|
|
|
584
591
|
"mcpServers": {
|
|
585
592
|
"androjack": {
|
|
586
593
|
"command": "npx",
|
|
587
|
-
"args": ["-y", "androjack-mcp"],
|
|
594
|
+
"args": ["-y", "androjack-mcp@1.6.0"],
|
|
588
595
|
"env": {},
|
|
589
596
|
"autoApprove": [],
|
|
590
597
|
"disabled": false
|
|
@@ -604,7 +611,7 @@ npx @modelcontextprotocol/inspector npx androjack-mcp
|
|
|
604
611
|
"androjack": {
|
|
605
612
|
"type": "stdio",
|
|
606
613
|
"command": "npx",
|
|
607
|
-
"args": ["-y", "androjack-mcp"]
|
|
614
|
+
"args": ["-y", "androjack-mcp@1.6.0"]
|
|
608
615
|
}
|
|
609
616
|
}
|
|
610
617
|
}
|
|
@@ -620,7 +627,7 @@ npx @modelcontextprotocol/inspector npx androjack-mcp
|
|
|
620
627
|
"mcpServers": {
|
|
621
628
|
"androjack": {
|
|
622
629
|
"command": "npx",
|
|
623
|
-
"args": ["-y", "androjack-mcp"]
|
|
630
|
+
"args": ["-y", "androjack-mcp@1.6.0"]
|
|
624
631
|
}
|
|
625
632
|
}
|
|
626
633
|
}
|
|
@@ -640,7 +647,7 @@ UI path: Agent pane โ `...` โ **MCP Servers** โ **Manage MCP Servers** โ
|
|
|
640
647
|
"mcpServers": {
|
|
641
648
|
"androjack": {
|
|
642
649
|
"command": "npx",
|
|
643
|
-
"args": ["-y", "androjack-mcp"],
|
|
650
|
+
"args": ["-y", "androjack-mcp@1.6.0"],
|
|
644
651
|
"disabled": false,
|
|
645
652
|
"autoApprove": []
|
|
646
653
|
}
|
|
@@ -649,13 +656,15 @@ UI path: Agent pane โ `...` โ **MCP Servers** โ **Manage MCP Servers** โ
|
|
|
649
656
|
```
|
|
650
657
|
|
|
651
658
|
Place at `.kiro/settings/mcp.json` (project) or `~/.kiro/settings/mcp.json` (global).
|
|
652
|
-
Or use the CLI: `kiro-cli mcp add --name androjack --command npx --args '-y androjack-mcp' --scope workspace`
|
|
659
|
+
Or use the CLI: `kiro-cli mcp add --name androjack --command npx --args '-y androjack-mcp@1.6.0' --scope workspace`
|
|
653
660
|
|
|
654
661
|
</details>
|
|
655
662
|
|
|
656
663
|
---
|
|
657
664
|
|
|
658
|
-
##
|
|
665
|
+
## ๐งช Examples
|
|
666
|
+
|
|
667
|
+
### Example Session
|
|
659
668
|
|
|
660
669
|
```
|
|
661
670
|
You: Build a login screen with ViewModel and Jetpack Compose
|
|
@@ -702,9 +711,9 @@ In February 2026, Google launched the Developer Knowledge MCP in public preview
|
|
|
702
711
|
| **Mechanism** | Context Retrieval | Context Enforcement |
|
|
703
712
|
| **Scope** | Generalist โ Firebase, Cloud, Android, Maps, and more | Android specialist โ 21 tools, one domain, zero drift |
|
|
704
713
|
| **Tools** | 3 retrieval tools (`search_documents`, `get_document`, `batch_get_documents`) | 21 specialized tools โ live version checks, deprecation registry, Gradle lookups, API level validation, loop-back code validator |
|
|
705
|
-
| **Setup** | Google Cloud project + API key + `gcloud` CLI required | `npx androjack-mcp` โ zero auth, zero cloud project |
|
|
714
|
+
| **Setup** | Google Cloud project + API key + `gcloud` CLI required | `npx androjack-mcp@1.6.0` โ zero auth, zero cloud project |
|
|
706
715
|
| **Enforcement** | Passive โ AI decides when to retrieve | Active โ tool descriptions mandate calls before every task type |
|
|
707
|
-
| **Status** | Public preview (v1alpha / experimental) | Stable (v1.
|
|
716
|
+
| **Status** | Public preview (v1alpha / experimental) | Stable (v1.6.0) |
|
|
708
717
|
|
|
709
718
|
**Why you need both in production:**
|
|
710
719
|
Google's tool cures AI "ignorance" by providing official text. However, **AndroJack cures AI "bad habits."** If you ask an AI to refactor an app, Google's tool will provide the new docs. But **AndroJack** is the tool that actively blocks the AI from writing legacy XML, enforces Jetpack Compose, checks Gradle versions against Maven, and ensures your `minSdk` doesn't violate Android 16's Play Store mandate.
|
|
@@ -713,7 +722,7 @@ Google tells the AI the rules; **AndroJack forces the AI to follow them.**
|
|
|
713
722
|
|
|
714
723
|
---
|
|
715
724
|
|
|
716
|
-
## ๐ Security & Privacy
|
|
725
|
+
## ๐ Security & Privacy
|
|
717
726
|
|
|
718
727
|
| Property | Detail |
|
|
719
728
|
|----------|--------|
|
|
@@ -721,14 +730,24 @@ Google tells the AI the rules; **AndroJack forces the AI to follow them.**
|
|
|
721
730
|
| **Rate limiting** | 30 requests / domain / minute with exponential backoff on 429/5xx |
|
|
722
731
|
| **No credentials** | Zero API keys, zero auth tokens required |
|
|
723
732
|
| **No data stored** | Nothing persisted beyond process lifetime |
|
|
724
|
-
| **Transparent agent** | User-Agent: `AndroJack-MCP/1.
|
|
733
|
+
| **Transparent agent** | User-Agent: `AndroJack-MCP/1.6.0 (documentation-grounding bot; not-a-scraper)` |
|
|
725
734
|
| **Read-only** | All 21 tools are annotated `readOnlyHint: true` โ no writes, no side effects |
|
|
726
735
|
| **Input bounds** | All inputs length-capped and sanitized before use |
|
|
727
|
-
| **Body size cap** | HTTP responses capped at 4 MB โ no OOM risk on large documentation pages |
|
|
728
|
-
|
|
729
|
-
---
|
|
730
|
-
|
|
731
|
-
##
|
|
736
|
+
| **Body size cap** | HTTP responses capped at 4 MB โ no OOM risk on large documentation pages |
|
|
737
|
+
|
|
738
|
+
---
|
|
739
|
+
|
|
740
|
+
## ๐ก๏ธ Privacy Policy
|
|
741
|
+
|
|
742
|
+
- AndroJack runs locally in your MCP client or terminal session.
|
|
743
|
+
- It does not require user accounts, API keys, or cloud credentials.
|
|
744
|
+
- It does not persist prompts, source code, or tool outputs beyond the current process lifetime.
|
|
745
|
+
- It only fetches from allowlisted documentation and artifact domains needed to ground answers.
|
|
746
|
+
- If you run the optional HTTP mode yourself, you are responsible for your own network exposure and access controls.
|
|
747
|
+
|
|
748
|
+
---
|
|
749
|
+
|
|
750
|
+
## ๐บ๏ธ Knowledge Sources
|
|
732
751
|
|
|
733
752
|
| Source | What It Covers |
|
|
734
753
|
|--------|---------------|
|
|
@@ -742,7 +761,7 @@ Google tells the AI the rules; **AndroJack forces the AI to follow them.**
|
|
|
742
761
|
|
|
743
762
|
---
|
|
744
763
|
|
|
745
|
-
## ๐๏ธ Architecture
|
|
764
|
+
## ๐๏ธ Architecture
|
|
746
765
|
|
|
747
766
|
```
|
|
748
767
|
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
|
@@ -770,11 +789,21 @@ Google tells the AI the rules; **AndroJack forces the AI to follow them.**
|
|
|
770
789
|
โผ โผ โผ
|
|
771
790
|
developer.android.com kotlinlang.org Google Maven
|
|
772
791
|
issuetracker.google source.android Maven Central
|
|
773
|
-
```
|
|
774
|
-
|
|
775
|
-
---
|
|
776
|
-
|
|
777
|
-
##
|
|
792
|
+
```
|
|
793
|
+
|
|
794
|
+
---
|
|
795
|
+
|
|
796
|
+
## ๐งฑ Infrastructure
|
|
797
|
+
|
|
798
|
+
- **Primary transport:** stdio via the `androjack-mcp` npm package for local MCP clients.
|
|
799
|
+
- **Optional hosted transport:** Streamable HTTP via `node build/index.js --http` for controlled environments.
|
|
800
|
+
- **Runtime model:** stateless tool execution with in-process rate limiting and shared LRU caching.
|
|
801
|
+
- **Source of truth:** official Android/Kotlin docs, Google issue tracker, Google Maven, and Maven Central.
|
|
802
|
+
- **Release channels:** npm for the MCP server, VS Code Marketplace for the thin wrapper that launches the pinned npm package.
|
|
803
|
+
|
|
804
|
+
---
|
|
805
|
+
|
|
806
|
+
## ๐งโ๐ป Local Development
|
|
778
807
|
|
|
779
808
|
```bash
|
|
780
809
|
git clone https://github.com/VIKAS9793/AndroJack-mcp.git
|
|
@@ -785,14 +814,38 @@ npm run inspector # opens MCP Inspector UI
|
|
|
785
814
|
node build/index.js # run MCP server directly
|
|
786
815
|
npm run install-mcp # interactive installer (needs real terminal)
|
|
787
816
|
npm run install-mcp:auto # non-interactive auto-install
|
|
788
|
-
npm run install-mcp:list # check IDE detection status
|
|
789
|
-
```
|
|
790
|
-
|
|
791
|
-
---
|
|
792
|
-
|
|
793
|
-
##
|
|
794
|
-
|
|
795
|
-
|
|
817
|
+
npm run install-mcp:list # check IDE detection status
|
|
818
|
+
```
|
|
819
|
+
|
|
820
|
+
---
|
|
821
|
+
|
|
822
|
+
## โ FAQ
|
|
823
|
+
|
|
824
|
+
**Why does the VS Code extension need its own release if the MCP code lives on `main`?**
|
|
825
|
+
Because the Marketplace wrapper is a separate package. For `v1.6.0`, it is pinned to `androjack-mcp@1.6.0`, so the wrapper must be versioned and uploaded separately.
|
|
826
|
+
|
|
827
|
+
**Why pin `npx -y androjack-mcp@1.6.0` instead of using the floating latest package?**
|
|
828
|
+
Pinning guarantees reproducible installs, clearer support, and predictable Anthropic or Marketplace review behavior. It avoids stale local `npx` cache surprises.
|
|
829
|
+
|
|
830
|
+
**Does AndroJack send my project files to a hosted backend?**
|
|
831
|
+
No. It runs locally and only makes outbound requests to allowlisted documentation and artifact sources needed to answer the userโs query.
|
|
832
|
+
|
|
833
|
+
**What should I update first for future releases?**
|
|
834
|
+
Publish the MCP server to npm first, confirm the pinned version is live, then update and upload the VS Code wrapper to point at that exact version.
|
|
835
|
+
|
|
836
|
+
---
|
|
837
|
+
|
|
838
|
+
## ๐ Changelog
|
|
839
|
+
|
|
840
|
+
### v1.6.0 โ Pinned Distribution, Shared Cache Wiring, and Registry Metadata
|
|
841
|
+
|
|
842
|
+
- **New:** Exact `@1.6.0` pinning across shipped config examples, installer output, one-click install links, and the VS Code Marketplace wrapper release flow.
|
|
843
|
+
- **New:** Shared fetch cache wiring for both `secureFetch()` and `secureFetchJson()` so repeated documentation and metadata lookups stop consuming rate-limit budget.
|
|
844
|
+
- **New:** Official MCP registry metadata with `server.json` plus package-level `mcpName`.
|
|
845
|
+
- **Fix:** User-Agent now reports the correct released version: `AndroJack-MCP/1.6.0`.
|
|
846
|
+
- **Docs:** Added explicit privacy policy, infrastructure, examples, and FAQ sections for release reviewers and end users.
|
|
847
|
+
|
|
848
|
+
### v1.5.1 โ Level 3 Loop-Back Validator + Interactive CLI Installer
|
|
796
849
|
|
|
797
850
|
- **New:** `android_code_validator` (Tool 21) โ Level 3 loop-back validation gate. 24 rules across Kotlin, XML, and Gradle. Validates AI-generated code before it reaches the user. Returns PASS/WARN/FAIL verdict with line-level violations, replacements, and official doc URLs. Zero new dependencies โ pure TypeScript.
|
|
798
851
|
- **New:** Grounding Gate upgraded to Level 3: Step 8 mandates `android_code_validator` after every code generation. Negative constraints section lists explicit prohibitions by API level (Android 16 targets, new Compose projects, universal rules).
|
package/build/cache.js
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* Shared LRU cache for AndroJack HTTP fetches and hosted-mode stats.
|
|
3
3
|
*/
|
|
4
4
|
export class LRUCache {
|
|
5
5
|
cache = new Map();
|
|
6
6
|
ttlMs = 24 * 60 * 60 * 1000; // 24 hours default
|
|
7
7
|
maxSize = 100;
|
|
8
|
-
// Stats
|
|
9
8
|
hits = 0;
|
|
10
9
|
misses = 0;
|
|
11
10
|
evictions = 0;
|
|
@@ -44,7 +43,7 @@ export class LRUCache {
|
|
|
44
43
|
this.misses++;
|
|
45
44
|
return undefined;
|
|
46
45
|
}
|
|
47
|
-
if (Date.now()
|
|
46
|
+
if (Date.now() > entry.expiresAt) {
|
|
48
47
|
this.cache.delete(key);
|
|
49
48
|
this.misses++;
|
|
50
49
|
return undefined;
|
|
@@ -55,9 +54,11 @@ export class LRUCache {
|
|
|
55
54
|
this.hits++;
|
|
56
55
|
return entry.value;
|
|
57
56
|
}
|
|
58
|
-
set(key, value) {
|
|
57
|
+
set(key, value, ttlMs = this.ttlMs) {
|
|
59
58
|
if (this.ttlMs === 0)
|
|
60
59
|
return;
|
|
60
|
+
if (ttlMs <= 0)
|
|
61
|
+
return;
|
|
61
62
|
if (this.cache.has(key)) {
|
|
62
63
|
this.cache.delete(key);
|
|
63
64
|
}
|
|
@@ -69,7 +70,31 @@ export class LRUCache {
|
|
|
69
70
|
this.evictions++;
|
|
70
71
|
}
|
|
71
72
|
}
|
|
72
|
-
this.cache.set(key, { value,
|
|
73
|
+
this.cache.set(key, { value, expiresAt: Date.now() + ttlMs });
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
const DOC_SOURCE_TTL_MS = 6 * 60 * 60 * 1000;
|
|
77
|
+
const ISSUE_TRACKER_TTL_MS = 60 * 60 * 1000;
|
|
78
|
+
const ARTIFACT_METADATA_TTL_MS = 30 * 60 * 1000;
|
|
79
|
+
const ARTIFACT_HOSTS = new Set([
|
|
80
|
+
"dl.google.com",
|
|
81
|
+
"plugins.gradle.org",
|
|
82
|
+
"search.maven.org",
|
|
83
|
+
]);
|
|
84
|
+
const ISSUE_TRACKER_HOSTS = new Set([
|
|
85
|
+
"issuetracker.google.com",
|
|
86
|
+
]);
|
|
87
|
+
export function getFetchCacheKey(url, kind) {
|
|
88
|
+
return `${kind}:${url}`;
|
|
89
|
+
}
|
|
90
|
+
export function getFetchCacheTtlMs(hostname, kind) {
|
|
91
|
+
const normalized = hostname.toLowerCase();
|
|
92
|
+
if (ARTIFACT_HOSTS.has(normalized)) {
|
|
93
|
+
return ARTIFACT_METADATA_TTL_MS;
|
|
94
|
+
}
|
|
95
|
+
if (ISSUE_TRACKER_HOSTS.has(normalized)) {
|
|
96
|
+
return ISSUE_TRACKER_TTL_MS;
|
|
73
97
|
}
|
|
98
|
+
return kind === "json" ? ISSUE_TRACKER_TTL_MS : DOC_SOURCE_TTL_MS;
|
|
74
99
|
}
|
|
75
100
|
export const docCache = new LRUCache(200);
|
package/build/constants.js
CHANGED
|
@@ -29,7 +29,7 @@ export const GOOGLE_MAVEN_URL = "https://dl.google.com/dl/android/maven2";
|
|
|
29
29
|
export const JETPACK_BOM_URL = "https://developer.android.com/jetpack/compose/setup";
|
|
30
30
|
// โโ HTTP Client Config โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
|
31
31
|
export const HTTP_TIMEOUT_MS = 12_000;
|
|
32
|
-
export const USER_AGENT = "AndroJack-MCP/1.0 (documentation-grounding bot; not-a-scraper)";
|
|
32
|
+
export const USER_AGENT = "AndroJack-MCP/1.6.0 (documentation-grounding bot; not-a-scraper)";
|
|
33
33
|
export const COMPONENT_REGISTRY = {
|
|
34
34
|
// โโ Deprecated concurrency โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
|
35
35
|
AsyncTask: {
|
package/build/http-server.js
CHANGED
|
@@ -45,12 +45,12 @@ export async function startHttpServer(server) {
|
|
|
45
45
|
res.writeHead(200, { "Content-Type": "application/json" });
|
|
46
46
|
res.end(JSON.stringify({
|
|
47
47
|
name: "androjack-mcp",
|
|
48
|
-
version: "1.
|
|
48
|
+
version: "1.6.0",
|
|
49
49
|
description: "Documentation-grounded Android engineering MCP server. " +
|
|
50
50
|
"Forces AI tools to verify official docs before generating Android/Kotlin code.",
|
|
51
51
|
mcp_endpoint: `http://${host}:${port}${MCP_PATH}`,
|
|
52
52
|
spec_version: "2025-11-25",
|
|
53
|
-
tools:
|
|
53
|
+
tools: 21,
|
|
54
54
|
read_only: true,
|
|
55
55
|
auth_required: false,
|
|
56
56
|
}));
|
package/build/http.js
CHANGED
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
*/
|
|
13
13
|
import * as cheerio from "cheerio";
|
|
14
14
|
import { ALLOWED_DOMAINS, HTTP_TIMEOUT_MS, USER_AGENT } from "./constants.js";
|
|
15
|
+
import { docCache, getFetchCacheKey, getFetchCacheTtlMs } from "./cache.js";
|
|
15
16
|
import { logger } from "./logger.js";
|
|
16
17
|
// โโ Rate limiter (per domain, per process lifetime) โโโโโโโโโโโโโโโโโโโโโโโโโโ
|
|
17
18
|
const requestCounts = new Map();
|
|
@@ -90,6 +91,11 @@ async function fetchWithRetry(url, init, attempt = 0) {
|
|
|
90
91
|
// โโ Public API โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
|
91
92
|
export async function secureFetch(url) {
|
|
92
93
|
const parsed = assertAllowedDomain(url);
|
|
94
|
+
const cacheKey = getFetchCacheKey(url, "html");
|
|
95
|
+
const cached = docCache.get(cacheKey);
|
|
96
|
+
if (typeof cached === "string") {
|
|
97
|
+
return cached;
|
|
98
|
+
}
|
|
93
99
|
checkRateLimit(parsed.hostname);
|
|
94
100
|
const response = await fetchWithRetry(url, {
|
|
95
101
|
headers: {
|
|
@@ -102,17 +108,26 @@ export async function secureFetch(url) {
|
|
|
102
108
|
throw new Error(`HTTP ${response.status} from ${parsed.hostname}: ${response.statusText}`);
|
|
103
109
|
}
|
|
104
110
|
const text = await response.text();
|
|
105
|
-
|
|
111
|
+
const boundedText = text.length > MAX_BODY_BYTES ? text.slice(0, MAX_BODY_BYTES) : text;
|
|
112
|
+
docCache.set(cacheKey, boundedText, getFetchCacheTtlMs(parsed.hostname, "html"));
|
|
113
|
+
return boundedText;
|
|
106
114
|
}
|
|
107
115
|
export async function secureFetchJson(url) {
|
|
108
116
|
const parsed = assertAllowedDomain(url);
|
|
117
|
+
const cacheKey = getFetchCacheKey(url, "json");
|
|
118
|
+
const cached = docCache.get(cacheKey);
|
|
119
|
+
if (cached !== undefined) {
|
|
120
|
+
return structuredClone(cached);
|
|
121
|
+
}
|
|
109
122
|
checkRateLimit(parsed.hostname);
|
|
110
123
|
const response = await fetchWithRetry(url, {
|
|
111
124
|
headers: { "User-Agent": USER_AGENT, Accept: "application/json" },
|
|
112
125
|
});
|
|
113
126
|
if (!response.ok)
|
|
114
127
|
throw new Error(`HTTP ${response.status}: ${response.statusText}`);
|
|
115
|
-
|
|
128
|
+
const payload = (await response.json());
|
|
129
|
+
docCache.set(cacheKey, structuredClone(payload), getFetchCacheTtlMs(parsed.hostname, "json"));
|
|
130
|
+
return payload;
|
|
116
131
|
}
|
|
117
132
|
// โโ HTML extraction (cheerio) โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
|
118
133
|
export function extractPageText(html, maxChars = 3000) {
|
package/build/index.js
CHANGED
|
@@ -39,7 +39,7 @@ import { androidCodeValidator } from "./tools/validator.js";
|
|
|
39
39
|
// โโ Server Instantiation โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
|
40
40
|
const server = new McpServer({
|
|
41
41
|
name: "androjack-mcp",
|
|
42
|
-
version: "1.
|
|
42
|
+
version: "1.6.0",
|
|
43
43
|
});
|
|
44
44
|
// โโ Tool 1: Official Android Documentation Search โโโโโโโโโโโโโโโโโโโโโโโโโโ
|
|
45
45
|
server.registerTool("android_official_search", {
|