JVM Source Lens

by sintexer

Not rated
GitHub

About

Resolves your Gradle project’s real classpath and returns Java source, method signatures, and class structure for any dependency class—using the version your build actually uses, not random files from ~/.gradle/caches.

Details

Author
sintexer
Categories
Developer Tools, Other

Setup

Install JVM Source Lens in your MCP client (Claude Desktop, Cursor, Windsurf, and others).

Repository: https://github.com/sintexer/jvm-source-lens

Follow the installation instructions in the repository README, then restart your MCP client.

Resolves your Gradle project’s real classpath and returns Java source, method signatures, and class structure for any dependency class—using the version your build actually uses, not random files from ~/.gradle/caches.

jvmsrc — Give your coding agent a Java IDE

An MCP server and CLIthat gives your coding agent the one thing it's missing on JVM codebases:the actual classpath.

You use an IDE to write Java. Your coding agent doesn't have one.

When your agent hits an unfamiliar library type — say, a superclass from a proprietary internal library — it spends25+ turnswalking~/.gradle/caches, opening JARs by hand withjar tf, picking one by guesswork, and trying to answer a question your IDE would answer in one keystroke:does this superclass have a public utility method called X?

jvmsrcqueries your build tool (Gradle) forthis project'sresolved classpath, then hands your agentreal source,real signatures, andreal structure— for the exact version your build actually uses.

- As an MCP server– Connect to Claude Code, Cursor, Windsurf, or any other MCP host and equip your agent with six purpose-built classpath tools.
- As thejvmsrcCLI– Same engine, scriptable, pipe-friendly, and useful on its own when you just want to read a class.

Claude Code resolving HandlerInterceptor signatures via jvmsrc — 3 calls, correct answer, no cache walking.

On JVM projects with private libraries and no public Javadocs,jvmsrcis a force multiplier:

- ~50K tokens savedper "what's on this external class" investigation — roughly70%reduction in cost.
- 15+ agent panic loops avoideddaily — no grinding through Gradle caches, opening wrong JARs, or giving up.
- Unlock delegationfor complex tasks touching internal SDKs that you previously had to do yourself.

Withoutjvmsrc(The 25-turn blind grind)

User:Override the audit hook fromAbstractTradingService— is there a public utility method on it we should reuse?
- Searches workspace for AbstractTradingService.java0 hits
- Runs:find ~/.gradle -name "trading-core"
-
Finds 4 versions:2.1.0,2.3.0,2.4.1,3.0.0-SNAPSHOT
-
Guesses:Pickstrading-core-2.4.1.jar(the project actually uses3.0.0-SNAPSHOT!)
-
Runs:jar tfandjavap -pon the wrong JAR
- [22 turns later]
"I don't see a utility method, you'll have to implement it yourself."

Reality:3.0.0-SNAPSHOTaddedmaskSensitiveFields()as a protected helper exactly for this case. The agent didn't hallucinate — it was just blind.

Withjvmsrc(The 3-turn instant resolution)

User:Override the audit hook fromAbstractTradingService— is there a public utility method on it we should reuse?
- search_classes("AbstractTradingService")➔ Finds FQN & exact resolved library.
- get_class_structure(scope: "overview")➔ DiscoversmaskSensitiveFields()in3.0.0-SNAPSHOT.
- get_method_signature("maskSensitiveFields")➔ Gets accurate signature and generics.

Result:Writes the override correctly on the first try. No cache walking, no guessing, no wrong version.
- Build Tool Inquiry:jvmsrcqueries your active build tool (e.g., Gradle) for the exact resolved classpath configuration.
- Intelligent Caching:It caches the resolved classpath, tracking changes to build files to stay current.
- Precision AI Tools:Instead of full-code dumping, it exposes precise, high-granularity tools (signatures, structure, search) to keep context windows small and token usage ultra-low.

npm install -g jvmsrc # or use it directly via npx: npx jvmsrc <command>

[!IMPORTANT]
RequiresNode ≥ 20andJava onPATH(for CFR decompiler +javap).

Paste this into your AI assistant config (Cursor, Claude Code, Windsurf, etc.), then restart the host:

{ "mcpServers": { "jvmsrc": { "command": "jvmsrc", "args": ["mcp"] } } }

Optional:jvmsrc config(orjvmsrc config --project /path/to/gradle-project) prints a paste-ready block plus environment hints. Most users can skip it and copy the snippet above.

The MCP server runs over stdio viajvmsrc mcp. The default config needs no environment variables:

{ "mcpServers": { "jvmsrc": { "command": "jvmsrc", "args": ["mcp"] } } }

Private repository credentials (optional)

Only needed when your Gradle build requires credential env vars for a private Maven/Artifactory/Nexus-style repo. MCP hosts often donotinherit your interactive shell, so those vars must be set on thejvmsrc MCP process(then restart the server).

REPO_USER/REPO_PASSbelow aresample names only— they are not required by jvmsrc. Use whatever variable names your project’s Gradle scripts document:

{ "mcpServers": { "jvmsrc": { "command": "jvmsrc", "args": ["mcp"], "env": { "REPO_USER": "your-username", "REPO_PASS": "your-password" } } } }

Omit theenvblock entirely when the project does not need them.

[!TIP]
Every source response includessourceAvailable:truefor real sources (Javadoc, parameter names, generics),falsefor CFR decompilation (structure reliable, names may be synthetic).

[!NOTE]
Multimodule:omitmodulePathand jvmsrc auto-picks the unique owning module; on a miss it lists candidatemodulePaths.Methods:search_classesmatches declared method names when the index has source enrichment; for body text in a known JAR usesearch_in_artifact.get_class_sourcemethodNamesalso walks superclasses for unmatched names.

PrimarilyJava + Spring Bootprojects on Gradle. Other JVM languages (Kotlin, Scala) and Android work today on a best-effort basis and are on the roadmap as first-class targets — seeROADMAP.md.

If you're on Maven or Bazel, it's planned but not shipping yet. Star the repo or open an issue and I'll prioritize accordingly.

Project types:JVM codebases (Java, Kotlin, Scala, Groovy).jvmsrccalls the build tool, not your editor.

Point-p/projectRootat the Gradle root (settings.gradle(.kts)or rootbuild.gradle(.kts)). Uses./gradlewwhen present, elsegradleonPATH. Maven-only trees get an explicit unsupported error.

Early software; the supported path is narrow:

Composite builds, Android-only layouts, and exotic configurations are not fully validated. SeeROADMAP.md.

- No telemetry.
- Local only— caches and diagnostics stay on disk; never writes under your project root.
- Subprocessesvia argv only (no shell interpolation) — see
SECURITY.md.
- OptionalJVMSRC_ALLOWED_ROOTSto lock down which projects jvmsrc may resolve.

jvmsrc com.example.MyClass -p /path/to/gradle-project # shorthand for get jvmsrc get com.example.MyClass -p /path/to/project -q > MyClass.java jvmsrc resolve -p /path/to/project --force-refresh jvmsrc config jdk-roots add /path/to/jdks # one-time JDK roots setup jvmsrc doctor java -p /path/to/project # check JDK requirement + selection jvmsrc diagnostics last # latest failure message jvmsrc mcp # run as MCP server

Useful flags:-p/--project,--module(:core:api),--configuration,--include-test,--force-refresh,--verbose(Gradle stderr only),--method,--start-line/--end-line.

Repo fixture for testing:test/fixtures/gradle-smokejvmsrc get com.smoke.Core -p test/fixtures/gradle-smoke --module :core.

- Resolution failures:Runjvmsrc diagnostics last(orjvmsrc diagnostics last 5)
- Custom JDK install roots:Add once withjvmsrc config jdk-roots add /path/to/jdks
- JDK mismatch debugging:Runjvmsrc doctor java -p /path/to/project
- After upgrading jvmsrc:Restart your MCP host
- Stale classpath:Runjvmsrc resolve --force-refresh

Defaults followenv-pathsconventions per OS. Full layout:SPEC.md§6.

WhenJVMSRC_JAVA_HOMEis not set, jvmsrc auto-discovers local JDKs from common paths such as~/.jdks(IntelliJ),~/.gradle/jdks, SDKMan, jenv, asdf, and OS-specific system install directories, plus your global configured JDK roots fromjvmsrc config jdk-roots ....

Finally, an MCP That Doesn't Make Me Decompile JARs

"This tool is a revelation for anyone tired of LLMs hallucinating non-existent Spring APIs. It actually reads bytecode, providing accurate class definitions and source lookups without the usual 'vibes-based' guesswork. Thesearch_classesfunctionality is incredibly precise, and the thoughtful implementation ofjavapfallback and granular scope controls (overview/declared/effective) makes navigating complex JARs painless. It’s fast, honest when it can't find a class, and handles cache management perfectly. A must-have for any dev struggling with dependency hell — it’s like having a senior engineer who actually enjoys reading documentation."*—Claude (AI Reviewer)

git clone https://github.com/Sintexer/jvm-source-lens.git cd jvm-source-lens bun install && bun run setup:cfr && bun run build node dist/cli.js --version

Full contributor workflow:CONTRIBUTING.md.

I builtjvmsrcbecause I kept running into the same wall: agents that are great at writing Java but blind to the actual classpath. If it saves you the same 25-turn grind it saved me, that's exactly why this exists. Found a bug, have an idea, or just want to say it helped? Open an issue or a PR — I read everything.

This is a web browser that enables your coding agent, such as Claude Code, to visit websites on your behalf and assist you in identifying bugs or creating UI test cases.

Bridges agentic coding tools and live Java runtime behavior through a lightweight sidecar agent.

It exposes Micronaut framework documentation and guides as MCP resources, it offers tools to search the docs and prompts to help you write tests and perform tasks in an idiomatic way

The Vaadin Model Context Protocol (MCP) server provides AI coding assistants with direct access to comprehensive Vaadin documentation, enabling intelligent code assistance for Vaadin Java and React applications.

The official Model Context Protocol server for webforJ - providing AI assistants with Java web development tools, project generation, and comprehensive documentation access. Works with Claude, VS Code, Cursor, and all MCP-enabled environments.

A Model Context Protocol (MCP) server that indexes your local Maven repository (~/.m2/repository) and Gradle cache ( ~/.gradle/caches/modules-2/files-2.1) to provide AI agents with tools to search for Java classes, method signatures, and source code.

An MCP server to help AI assistants to answer questions and generate AccelByte Extend SDK code more effectively .

Local stdio MCP server that lets AI coding agents read and maintain structured architecture, rules, and decisions directly from your repository.

Official Context7 MCP server that brings up-to-date, version-specific library documentation and code examples into AI coding prompts.

Remote, no-auth MCP server providing AI-powered codebase context and answers

No reviews yet — be the first

Sign in to leave a review

Use Google, GitHub, or an email account so ratings stay tied to real people.

Email sign in

No reviews posted yet.