This guide covers building, testing, and contributing to the PSI MCP Server plugin.
jetbrain-psi-mcp-server/
├── src/main/
│ ├── kotlin/com/mercari/psi/mcp/ # plugin implementation
│ │ ├── ClaudeKotlinPlugin.kt # PsiMcpActivity (startup hook)
│ │ ├── PsiMcpServerManager.kt # app service: lifecycle + tool registry + state
│ │ ├── server/HttpServer.kt # Jetty HTTP + MCP transport
│ │ ├── settings/ # Settings UI
│ │ └── tools/ # one class per MCP tool
│ └── resources/META-INF/ # plugin.xml, bundled LICENSE + notices
├── test-fixtures/audit-sample/ # a multi-module fixture project for runtime testing
├── build.gradle.kts # plugin version + build config
└── Makefile # version + build helpers
There is a single component — the IntelliJ plugin — which speaks MCP directly over HTTP.
./gradlew buildPlugin # -> build/distributions/jetbrain-psi-plugin-<version>.zip
./gradlew compileKotlin # fast compile check
./gradlew verifyPlugin # IntelliJ plugin structure/compat checksmake build runs ./gradlew buildPlugin; make package then copies the
already-built ZIP into release/ (run it after make build — it does not build
on its own). To try the built ZIP in a real IDE, install it via Settings ▸
Plugins ▸ Install Plugin from Disk; for a quicker dev loop use ./gradlew runIde
(below).
Run the unit tests (JUnit) — e.g. the HTTP transport's request-guard security
tests in src/test:
./gradlew testRun the plugin in a sandbox IDE with a real project to exercise the PSI tools:
# Launch a sandbox IDE with the audit-sample fixture opened
./gradlew runIde --args="$(pwd)/test-fixtures/audit-sample"Once it is up and the project has finished indexing, smoke-test the transport:
curl http://127.0.0.1:51234/health # -> OK
curl -s -X POST http://127.0.0.1:51234/mcp \
-H 'Content-Type: application/json' \
-d '{"jsonrpc":"2.0","id":1,"method":"tools/list"}' | head -c 200test-fixtures/README.md documents the fixture and a full per-tool test matrix.
- Implement it — add a class under
src/main/kotlin/com/mercari/psi/mcp/tools/implementing theToolinterface (execute,getDescription,getInputSchema). - Register it — add a
server.registerTool("your-tool", YourTool())line inPsiMcpServerManager(and import it). This is the only registration site — there is no separate MCP-server module. - Document it — add it to the tool list in
README.md. - Verify —
./gradlew compileKotlin verifyPlugin, then exercise it against the fixture viarunIde.
Guidelines: use PSI/K2 APIs for semantic analysis, validate inputs, follow the
success/error response conventions in ARCHITECTURE.md,
and match the style of the surrounding tools.
- JDK 21
- IntelliJ IDEA or Android Studio — the plugin depends on the bundled Kotlin, Java, and Gradle plugins, so it only runs on these IDEs.
- Import the project into IntelliJ IDEA.
- Ensure the Kotlin plugin is enabled and the project SDK is JDK 21.
- Run
./gradlew buildonce to fetch dependencies.
Single artifact, single version. The version is defined in build.gradle.kts
(version = "x.y.z"); bump it with the make helpers below.
make versions # print the current version
make bump-plugin-patch # or bump-plugin-minor / bump-plugin-majorSee the Release Workflow section below for tagging and publishing a release.
Releases are plugin-only. Each release ships one artifact:
build/distributions/jetbrain-psi-plugin-x.y.z.zip.
- Bump the version:
make bump-plugin-patch(orminor/major). - Build:
make build(runs./gradlew buildPlugin). - Smoke-test the zip locally (install from disk in Android Studio, hit
/healthand/mcp). - Commit and tag:
git commit -am "chore: release $(make -s versions | sed 's/Plugin: v//')"git tag plugin-v$(make -s versions | sed 's/Plugin: v//')git push && git push --tags
- Create a GitHub Release for the
plugin-vx.y.ztag and upload the zip frombuild/distributions/.
Users upgrade by downloading the new zip and installing from disk.
The tool surface is intentionally kept small and curated, so we are not actively seeking feature contributions. If you do open a pull request, all contributions are subject to the Mercari CLA — by submitting one you are deemed to accept and agree to be bound by its terms. Please follow the Code of Conduct, and report security issues privately per SECURITY.md.
- ARCHITECTURE.md — design and protocol details
- test-fixtures/README.md — runtime test fixture + matrix
- IntelliJ Platform SDK — https://plugins.jetbrains.com/docs/intellij/
- Model Context Protocol — https://modelcontextprotocol.io/