Android Source Explorer MCP server
Lets an AI client search and read AOSP and AndroidX source code, including class definitions, method bodies, and references.
Also known as mrmike/android-source-explorer-mcp
- Stars
- 102
- Tools
- 6
- Downloads, 30 days
- —
- Latest version
- —
- Last commit
- Jul 13, 2026
- License
- Apache-2.0
What is Android Source Explorer MCP?
Android Source Explorer lets an AI client search and read AOSP and AndroidX source code, including class definitions, method bodies, and references. It exposes 6 tools, such as search_classes, lookup_class, lookup_method.
Summary generated from the project's README
About Android Source Explorer MCP server
Android developers can access the actual AOSP and AndroidX source code directly through their AI clients to avoid relying on outdated training data. This server enables an AI to inspect complex framework internals like the Activity lifecycle or Compose internals by providing precise access to class definitions, method bodies, and inheritance hierarchies. It functions as a local service that manages a cached version of the Android framework on your machine.
Setup requires Python 3.11 or uv to install the tool globally. Users must perform an initial sync using the android-source-explorer sync command to fetch specific API levels, such as API 36, and AndroidX packages like lifecycle or compose. The system uses a hybrid architecture combining Tree-sitter for fast AST parsing of individual files and an optional LSP engine for cross-file navigation. This allows the AI to use tools like search_classes, lookup_method, and find_references to understand the truth of the Android framework.
What you can do with it
- 1Search for specific AndroidX componentsLocate classes within Jetpack libraries using glob patterns or substrings.
Written from the project's README. Every use case is checked against a quote from it.
Android Source Explorer MCP tools 6
Detected from the READMEsearch_classeslookup_classlookup_methodlist_class_membersget_class_hierarchysearch_in_source
Configuration
ANDROID_SOURCE_LSP
Automated checks
Ran Nov 14, 2026Full report →Not verified yet. A server needs a score of 80, no serious finding, and enough data for us to check. How checks work · What to fix for more points
- Source repository linked and reachablemrmike/android-source-explorer-mcp is public and reachablegithub.com/mrmike/android-source-explorer-mcp ↗Pass
- Package names this repository as its sourceNot checked
- Build provenance (Sigstore attestation)Not checked
- Open source license (OSI)Apache-2.0spdx.org/licenses/Apache-2.0.html ↗Pass
- Commit or release in the last yearLast commit or release 2026-07-13github.com/mrmike/android-source-explorer-mcp ↗Pass
- OpenSSF ScorecardNot checked
- Package name not close to a popular packageNot checked
- No critical advisory in the package or its dependenciesNot checked
- No hidden instructions to the model6 tool descriptions and the README read; no override phrases, credential paths or hidden charactersPass
- Destructive tools are labelledNo tool named like delete, drop or execPass
- Remote endpoint answers the MCP handshakeNot checked
README
View on GitHubAndroid Source Explorer MCP Server
MCP server for exploring AOSP internals and Jetpack libraries.
Purpose
When building Android applications, AI tools often rely on outdated training data or incomplete summaries of the Android Framework. This MCP server provides on-demand, precise access to the actual source code (AOSP and AndroidX), enabling the AI to understand complex framework internals like the Activity lifecycle, ViewModel restoration, or Compose internals directly from the truth.
Installation & Setup
Prerequisites
- uv (Recommended) or Python 3.11+
- Git
Recommended Installation (via uv)
The easiest way to install and keep android-source-explorer up to date is using uv. It handles dependencies (including native ones like Tree-sitter and Cryptography) reliably across platforms.
uv tool install git+https://github.com/mrmike/android-source-explorer-mcp
This will make the android-source-explorer command available globally in your PATH.
Initial Sync
After installation, you need to perform an initial sync to fetch the Android source code:
# Sync API 36 (Android 16) and common AndroidX packages
android-source-explorer sync --api-level 36 --androidx "compose,lifecycle,activity"
# (Optional) Download LSP servers for cross-file features
android-source-explorer sync --lsp
Check sync status:
android-source-explorer status
Keeping Sources Up-to-Date
To check for and download the latest available Android Framework revisions (AOSP tags) and newer stable versions of your synced AndroidX packages, run:
# Update all synced framework APIs and AndroidX packages, then rebuild the index
android-source-explorer update
# (Optional) Clean up older versions of updated AndroidX packages
android-source-explorer update --clean
# Update only a specific API level or AndroidX package
android-source-explorer update --api-level 36
android-source-explorer update --androidx activity-compose
Configuration
Add the MCP server to your configuration file (e.g., Claude Desktop, Cursor, Gemini CLI).
Global Usage (Recommended)
If installed via uv tool install, the tool is available globally.
Basic Setup:
{
"mcpServers": {
"android-sources": {
"command": "android-source-explorer",
"args": ["serve"]
}
}
}
With LSP Features Enabled:
{
"mcpServers": {
"android-sources": {
"command": "android-source-explorer",
"args": ["serve"],
"env": {
"ANDROID_SOURCE_LSP": "true"
}
}
}
}
Development Usage
If you cloned the repository and want to run it from the source:
{
"mcpServers": {
"android-sources": {
"command": "uv",
"args": ["run", "--directory", "/absolute/path/to/android-source-explorer", "android-source-explorer", "serve"]
}
}
}
How It Works
1. Hybrid Architecture (Tree-sitter + LSP)
The server uses a dual-engine approach to balance speed and intelligence:
- Tree-sitter (Surgical Engine): Provides near-instant (sub-10ms) AST parsing of single files. It precisely extracts method bodies (including Javadoc and annotations), class members, and inheritance hierarchies without the overhead of a full compiler.
- LSP (Global Engine): Optionally leverages the Eclipse JDT LS (Java) and Kotlin Language Server for cross-file navigation. This enables finding references across millions of lines of code and resolving types that span multiple libraries.
2. Local Sync Strategy
To ensure all lookups are instant and offline-ready, the server uses a sync or update command to manage sources in a local cache (~/.android-sources/):
- AOSP: Fetches framework sources directly from
android.googlesource.comusing git sparse-checkouts. - AndroidX: Downloads
-sources.jarfiles from the Google Maven repository (dl.google.com/dl/android/maven2/). - Hybrid Indexing: Prioritizes your local
$ANDROID_HOMEsources if available, supplemented by the downloaded cache. - Automatic Updates: The
updatecommand queries remote endpoints (AOSP Git tags & Google Maven indexes) for updates, downloads newer revisions/versions, and rebuilds the class index.
Available Tools
| Tool | Engine | Description |
|---|---|---|
search_classes |
Index | Search for classes by glob pattern or substring. |
lookup_class |
FS | Retrieve the full source code for a specific class. |
lookup_method |
Tree-sitter | Extract a precise method body + its Javadoc/annotations. |
list_class_members |
Tree-sitter | List all method and field signatures in a class. |
get_class_hierarchy |
Tree-sitter | Get the inheritance chain (superclass + interfaces). |
search_in_source |
FS/Regex | Search for text/regex across the entire source tree. |
goto_definition* |
LSP | Resolve the cross-file definition of a symbol. |
find_references* |
LSP | Find all usages of a class/method across the whole tree. |
get_type_info* |
LSP | Get documentation and type info via hover data. |
*Requires ANDROID_SOURCE_LSP=true
License
Apache License 2.0
Android Source Explorer MCP questions
What tools does Android Source Explorer MCP provide?
It exposes 6 tools, including search_classes, lookup_class, lookup_method, list_class_members, get_class_hierarchy.
What does the Android Source Explorer MCP server let an AI do?
It gives the AI on-demand access to actual AOSP and AndroidX source code, so it can look up framework internals such as the Activity lifecycle or Compose internals.
How do I install android-source-explorer?
Install it with uv tool install from the GitHub repository, which puts the android-source-explorer command on your PATH.
Do I need to sync sources before using it?
Yes, run the sync command once to fetch sources, for example for API 36 and selected AndroidX packages, then check status.
Which tools are available for searching classes and methods?
It offers search_classes, lookup_class, lookup_method, list_class_members, get_class_hierarchy, and search_in_source, plus LSP-based tools when enabled.
How do I enable cross-file features like goto_definition and find_references?
Set the ANDROID_SOURCE_LSP environment variable to true in the server configuration; these tools depend on LSP servers.