# kotlin-lib-mcp [Health: Active]

**Category:** 💻 Developer Tools  
**Repository:** https://github.com/aoreshkov/kotlin-lib-mcp  
**GitHub Stars:** 15  
**Views:** 3  
**Installs:** 0  
**Upvotes:** 0  
**Directory Page:** https://allmcps.com/mcp/kotlin-lib-mcp

## Description
Exposes the public API, KDoc and sources of Maven-published Kotlin/Java libraries to MCP clients

## Tools
Capabilities this server exposes over MCP:

- **fetch_library** — Download + analyze + cache; returns a summary. Idempotent. Version may be omitted or `latest
- **list_packages** — Packages with declaration counts and KMP targets; paged
- **list_declarations** — Declarations with signatures and deprecations; filter by `package`, `visibility` and `deprecated`; paged
- **get_api_signature** — Resolved signature of one declaration by FQ name, with its deprecation and `ReplaceWith
- **get_kdoc** — KDoc (summary, description, tags) of one declaration
- **get_source** — Raw source of a file (`path`) or one declaration (`fqName`); paged by line
- **search_source** — Substring/regex search; bounded, returns `file:line` snippets
- **diff_versions** — Unified diff between two fetched versions; summary-first, paged, `path`-filtered
- **diff_api** — Public-API changes between two fetched versions — added, removed, changed, deprecated (with `ReplaceWith`); summary-first, paged, `package`- and `change`-filtered
- **get_dependencies** — Dependency tree from `.pom`/`.module`; bounded `depth` and `maxNodes
- **list_versions** — Published versions from `maven-metadata.xml`, newest-first; paged
- **get_latest_version** — Latest stable release (and newest overall) from `maven-metadata.xml

## Claude Desktop Quick Installation
No generated config for this server: it installs through its own setup steps.

The project's own setup steps (from https://github.com/aoreshkov/kotlin-lib-mcp), copied verbatim. Follow them in order; they are not an mcpServers config.

1. Add to Claude Code:

```sh
claude mcp add kotlin-lib -- /path/to/kotlin-lib-mcp-server-<version>/bin/server --transport stdio
```

2. Add to Claude Code:

```sh
claude mcp add kotlin-lib -- docker run -i --rm -v kotlin-lib-mcp-cache:/home/mcp/.cache ghcr.io/aoreshkov/kotlin-lib-mcp
```

3. Start the server:

```sh
docker run --rm -p 127.0.0.1:3000:3000 -v kotlin-lib-mcp-cache:/home/mcp/.cache \
  ghcr.io/aoreshkov/kotlin-lib-mcp --transport http --host 0.0.0.0 --port 3000
```

4. Start the server:

```sh
./gradlew :server:run --args="--transport stdio"   # local MCP over stdio (default)
```

5. Start the server:

```sh
./gradlew :server:run --args="--transport http --port 3000"   # Streamable HTTP at /mcp
```

6. Install:

```sh
./gradlew :server:installDist                      # standalone launcher in server/build/install/server/bin
```

## Documentation

## What kotlin-lib-mcp does

kotlin-lib-mcp gives MCP clients access to the published source artifacts of Maven-hosted Kotlin and Java libraries. It works from a Maven coordinate such as `group:artifact:version`, then downloads the matching metadata and sources jar, analyzes the contents, and builds a local index. The result includes public declarations, resolved signatures, KDoc, source files, dependencies, and version information.

The server is particularly suited to Kotlin Multiplatform libraries. Published `.module` metadata is used to resolve per-target source artifacts, and indexed symbols include their available targets. Kotlin declarations are analyzed with the Kotlin Analysis API in standalone K2/FIR mode. When a transitive type cannot be resolved, signature results can fall back to a best-effort PSI representation instead of failing outright.

## How it works

Call `fetch_library` before querying a library. The operation is idempotent: after the initial download and analysis, subsequent tool calls read from the disk cache keyed by group, artifact, and version. A version can be supplied explicitly, omitted where supported, or set to `latest` for `fetch_library`.

Queries return compact JSON text together with structured content and typed output schemas. Large results are paged or bounded. Version and API comparisons require the relevant versions to have been fetched, while dependency trees accept depth and node limits. Source searches can use either substring or regular-expression matching and return bounded `file:line` snippets.

Only requested Maven metadata and artifacts are downloaded. The server reads downloaded library sources, not a project’s own code, and stores the cache locally. Maven Central is used by default; additional repositories can be configured, or Central can be disabled.

## Setup and configuration

The server can run from a release zip with a Java 25 or newer runtime, or from the published Docker image. The Docker setup mounts a volume at `/home/mcp/.cache` so fetched libraries persist between container runs. Claude Code can install the bundled plugin, which downloads the release zip on first use and requires JDK 25 or newer. Claude Code can also register either the executable or Docker command as a stdio MCP server.

A Compose Desktop dashboard is available as an optional in-process interface. Command-line configuration includes streamable HTTP transport, custom cache locations, repository selection, and OpenTelemetry tracing with `--otel`. Task records are stored under a `tasks` subdirectory when task support is enabled.

## Tools and capabilities

- `fetch_library` downloads, analyzes, and caches a coordinate.
- `list_packages` reports packages, declaration counts, and Kotlin Multiplatform targets.
- `list_declarations` lists declarations with signatures and deprecation information, with package, visibility, and deprecation filters.
- `get_api_signature` resolves one declaration by fully qualified name and includes `ReplaceWith` data when present.
- `get_kdoc` returns a declaration’s summary, description, and tags.
- `get_source` reads a file or declaration, while `search_source` finds bounded substring or regex matches.
- `diff_versions` produces a paged unified source diff; `diff_api` reports added, removed, changed, or deprecated public API entries.
- `get_dependencies` reads dependency trees from POM or Gradle module metadata.
- `list_versions` and `get_latest_version` inspect Maven metadata for published releases.

## Limitations and notes

Results depend on the source jars and Maven metadata published for the requested coordinate. API signatures may be marked best-effort when required transitive dependencies are unavailable. Cached artifacts remain on the local disk until removed. Outbound requests are limited to the configured Maven repositories, Docker image hosting, and release downloads used by the installation method; there is no account, analytics, or remote storage.

_Full upstream README: https://allmcps.com/mcp/kotlin-lib-mcp/readme_

