Skip to content

Commit e7fec0f

Browse files
committed
doc: update readme
1 parent 36ff2a6 commit e7fec0f

1 file changed

Lines changed: 55 additions & 34 deletions

File tree

README.md

Lines changed: 55 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,51 +1,28 @@
11
# smali-lsp
22

3-
A Language Server Protocol (LSP) server and built-in MCP server for [Smali](https://github.com/google/smali) — the bytecode language of Android apps.
3+
A Language Server Protocol (LSP) server with built-in MCP server for [Smali](https://github.com/google/smali) — the bytecode language of Android apps.
44

55

66
## Features
77

8+
### LSP Server (for IDEs)
89
- **Go to Definition** — jump from any instruction to its target (classes, methods, fields, labels)
910
- **Find References** — cross-file xrefs with inheritance-aware polymorphic matching
1011
- **Hover** — method signatures, field types, class info, SDK class detection
12+
- **Call Hierarchy** — incoming/outgoing call graphs for any method
1113
- **Document Symbols** — class outline with methods and fields
1214
- **Workspace Symbols** — fuzzy search across the entire codebase
1315
- **Diagnostics** — syntax errors and unresolved class references
1416
- **Label Navigation** — goto/if-*/switch targets within methods
1517
- **All 41 Dalvik instruction types** supported (invoke-*, iget/iput/sget/sput, new-instance, check-cast, etc.)
16-
- **MCP Server** - built in MCP Server for full semantic understanding of decompiled APKs for AI agents.
17-
18-
## Performance
19-
20-
Tested on real-world APKs (119K smali files, 118K classes, 560K methods):
21-
22-
| Operation | Avg Latency | Throughput |
23-
|-----------|-------------|------------|
24-
| Goto Definition | 0.26ms | 4,011 ops/sec |
25-
| Parsing / Indexing | ~0.3ms/file | ~3,300 files/sec |
26-
| Find References | <1s ||
27-
| Symbol Search | <1s ||
2818

29-
- All queries (definition, references, symbols, hover) return in <1s after indexing
30-
- 99.7% goto-definition coverage (tested on 300K+ methods)
31-
- 100% parse success rate on 100K+ real smali files
32-
- 18 KB memory per indexed file (string-interned)
33-
- Indexed 119K smali files in ~30–36s (warm), ~40s (cold)
34-
- Indexed 27K smali files in ~6s
35-
36-
## Building
37-
38-
Requires Java 17+ and Gradle 8.8+.
39-
40-
```bash
41-
./gradlew shadowJar
42-
```
19+
### MCP Server (for AI agents)
20+
Built-in [MCP](https://modelcontextprotocol.io/) server for full semantic understanding of decompiled APKs by AI agents — various tools covering indexing, navigation, search, call graphs, and cross-references.
4321

44-
Output: `build/libs/smali-lsp-all.jar`
4522

4623
## Usage
4724

48-
### LSP Server (for IDEs)
25+
### LSP Server
4926

5027
The server communicates over **stdio** in standard LSP protocol — no daemon, no port, just stdio:
5128

@@ -111,7 +88,7 @@ args = ["-jar", "/path/to/smali-lsp-all.jar"]
11188
Extension not yet published. Use the MCP server (below) for VS Code + AI agent workflows.
11289
</details>
11390

114-
### MCP Server (for AI agents)
91+
### MCP Server
11592

11693
```bash
11794
java -jar smali-lsp-all.jar --mcp
@@ -134,19 +111,63 @@ Add to your MCP config (`.vscode/mcp.json`,`claude_desktop_config.json`, Cursor
134111

135112
<details>
136113
<summary>Available tools</summary>
137-
`smali_index`, `smali_find_definition`, `smali_search_symbols`, `smali_get_stats`, `smali_find_references`, `smali_hover`, `smali_diagnostics`, `smali_document_symbols`
114+
115+
| Tool | Description |
116+
|------|-------------|
117+
| `smali_index` | Index a directory of smali files |
118+
| `smali_find_definition` | Go to definition for a symbol at a position |
119+
| `smali_search_symbols` | Fuzzy search across classes, methods, fields |
120+
| `smali_get_stats` | Index statistics (class/method/field/string counts) |
121+
| `smali_find_references` | Find all references to a symbol |
122+
| `smali_hover` | Get hover info (signatures, types, class details) |
123+
| `smali_diagnostics` | Compute diagnostics for a file |
124+
| `smali_document_symbols` | Get document outline (classes, methods, fields) |
125+
| `smali_search_strings` | Search const-string literals by substring |
126+
| `smali_call_graph` | Incoming/outgoing call graph for a method |
127+
| `smali_xref_summary` | Full cross-reference report (subclasses, implementors, callers, field accessors) |
128+
138129
</details>
139130

131+
132+
## Performance
133+
134+
Tested on real-world APKs (119K smali files, 118K classes, 560K methods):
135+
136+
| Operation | Avg Latency | Throughput |
137+
|-----------|-------------|------------|
138+
| Goto Definition | 0.26ms | 4,011 ops/sec |
139+
| Parsing / Indexing | ~0.3ms/file | ~3,300 files/sec |
140+
| Find References | <1s ||
141+
| Symbol Search | <1s ||
142+
143+
- All queries (definition, references, symbols, hover) return in <1s after indexing
144+
- 99.7% goto-definition coverage (tested on 300K+ methods)
145+
- 100% parse success rate on 100K+ real smali files
146+
- 18 KB memory per indexed file (string-interned)
147+
- Indexed 119K smali files in ~30–36s (warm), ~40s (cold)
148+
- Indexed 27K smali files in ~6s
149+
150+
## Building
151+
152+
Requires Java 17+ and Gradle 8.8+.
153+
154+
```bash
155+
./gradlew shadowJar
156+
```
157+
158+
Output: `build/libs/smali-lsp-all.jar`
159+
160+
140161
## Architecture
141162

142163
```
143-
ANTLR4 Grammar → SmaliParser → ASTBuilder → WorkspaceIndex → LSP Providers
164+
ANTLR4 Grammar → SmaliParser → ASTBuilder → WorkspaceIndex → LSP/MCP Providers
144165
145166
WorkspaceScanner (parallel)
146167
```
147168

148169
- **Parser**: ANTLR4 with SLL prediction mode (no ambiguities in smali grammar)
149-
- **Index**: Thread-safe `ConcurrentHashMap` with O(1) lookups and bidirectional class-URI maps
170+
- **Index**: Thread-safe `ConcurrentHashMap` with O(1) lookups, bidirectional class-URI maps, string literal index
150171
- **Providers**: Position-aware symbol extraction — correctly resolves which of multiple symbols on a line the cursor targets
151172
- **Scanner**: Parallel file processing with smart APKTool project detection
152173

@@ -160,7 +181,7 @@ ANTLR4 Grammar → SmaliParser → ASTBuilder → WorkspaceIndex → LSP Provide
160181
./gradlew test --tests "*.unit.*"
161182
./gradlew test --tests "*.integration.*"
162183
./gradlew test --tests "*.regression.*"
163-
./gradlew test --tests "*.performance.*"
184+
./gradlew test --tests "*.stress.*"
164185
```
165186

166187
## License

0 commit comments

Comments
 (0)