Library Insight π¶
API Explorer & MCP Server for Java, Kotlin & KMP¶
Analyze Java and Kotlin libraries, JVM artifacts, Kotlin Multiplatform libraries, and local source code with a standalone CLI or integrate directly into AI IDEs via MCP.
AI coding assistants often guess Java/Kotlin APIs from outdated documentation, web examples, or a different version than the one used in your project. That leads to missing methods, deprecated usage, incorrect signatures, and wasted debugging time.
Library Insight solves this by analyzing the exact JAR, AAR, Maven dependency, Gradle output, or local Java/Kotlin source code used by your project. It builds a searchable, version-aware API index from compiled bytecode (including Kotlin @Metadata) or source code, allowing you to explore APIs, generate AI-ready context, and understand your codebase using the exact code you're working withβnot outdated documentation or web examples.
πΊ Video Walkthrough¶
Watch the full product showcase explaining Library Insight's core features, architecture, KMP integration, and AI MCP server setup:
Key Features¶
- MCP Server: Connect Cursor, Claude Desktop, or any MCP-compatible IDE to query APIs directly.
- Kotlin Multiplatform (KMP) Support: Resolve coordinates from Gradle Module Metadata (
.moduleJSON), parse Native.klibmetadata files, and merge platform variant API targets (common,jvm,ios,js,wasm). - Local Source Code Scanner (
scan-source): Analyze Kotlin and Java source projects without compilation, preserving KDoc/Javadoc, imports, and declaration source locations (file:line). - Version-Correct API Lookup: Build an API index from the exact JAR, AAR, Maven dependency, Gradle output, or source code used by your project to prevent AI hallucinations.
- Deep Metadata Extraction: Extract classes, constructors, methods, properties, nullability, generics, annotations, modifiers, and source metadata.
- Kotlin DSL & Fluent API Mapping: Detect
@DslMarkerscopes, type aliases, lambda builders, extension functions, and inline reified functions. - Method Call Graph Generator: Trace and visualize method call trees to understand internal bytecode invocations.
- Automatic Usage Examples: Generate common usage patterns and extract examples from available documentation.
- API Health & Complexity Reports: Measure public API size, complexity metrics, and deprecation ratios.
- Dependency & ABI Analysis: Detect classpath conflicts, linkage issues (
LinkageError,NoSuchMethodError), and deprecated dependency APIs. - Migration Advisor: Compare two library versions and identify added, removed, deprecated, and replacement APIs.
- Exporter Tools: Export API indexes as JSON, Markdown reference documentation, or token-optimized AI context packages.
Why Library Insight?¶
When you add a dependency, the first question is simple:
"How do I use this version correctly?"
In real projects, that answer is often messy:
- Outdated AI Context: AI may write code for the latest release while your project uses an older version.
- Incorrect Web Examples: AI may copy an old blog post where the method name no longer exists.
- Incomplete Docs: Official docs may be incomplete or not updated for the release you installed.
- Hidden Replacements: Deprecated methods may still appear in examples, while the replacement is hidden in release notes or source comments.
- Context Waste: Huge generated docs waste AI context and make one class hard to find.
Library Insight turns the library artifacts and source code you actually use into the source of truth. Scan a JAR, AAR, KLib, Maven dependency, or local Java/Kotlin source directory, then use search, explain, diff, migrate, or ai-export to give humans and AI agents exact, version-aware API information.
Architecture & Modular Design¶
Library Insight follows Clean Architecture principles. Below is the modular dependency flow:
graph TD
subgraph CLI Layer
CLI[library-insight-cli]
end
subgraph Orchestration Layer
CORE[library-insight-core]
end
subgraph Processing Modules
PARSER[library-insight-parser]
KOTLIN[library-insight-kotlin]
SEARCH[library-insight-search]
EXPORT[library-insight-export]
end
subgraph Data & Common Utility Base
MODEL[library-insight-model]
COMMON[library-insight-common]
end
CLI --> CORE
CORE --> PARSER
CORE --> KOTLIN
CORE --> SEARCH
CORE --> EXPORT
PARSER --> MODEL
KOTLIN --> MODEL
SEARCH --> MODEL
EXPORT --> MODEL
MODEL --> COMMON
COMMON --> ASM[ASM Bytecode Reader]
COMMON --> KTOR[Ktor HTTP Client]
Core Modules¶
library-insight-common: Utility classes for ZIP/JAR/AAR extraction, Ktor async HTTP engine, and filesystem operations.library-insight-model: Immutable Kotlin serialization structures representing the API index schema.library-insight-parser: Raw bytecode structure extraction using ASM and local source code parsing using JavaParser and Kotlin PSI.library-insight-kotlin: Kotlin metadata parsing (kotlin-metadata-jvm) and JVM bytecode enrichment.library-insight-search: Index search and query matching logic.library-insight-export: JSON, Markdown, and AI context formatters.library-insight-core: Orchestrates scan flows and implements the semantic API diffing engine.library-insight-cli: Command Line Interface definitions using Clikt.
π Roadmap¶
We plan to expand Library Insight with deep source-level analysis capabilities:
π Source Analysis Engine (Planned)¶
- References Engine: Build a symbol-to-usage index to locate references for any class, method, or property across the codebase (e.g.
library-insight references LoginRepository). - Implementations: Query all interface implementations or subclass declarations (e.g.
library-insight implementations Repository->RoomRepository,NetworkRepository). - Hierarchy: Render the visual inheritance tree for any base class or interface (e.g.
library-insight hierarchy BaseViewModel). - Source Call Graph: Trace internal method execution paths using raw source file declaration locations.