Serverdex · build · Java

Build an MCP server in Java

The official Java SDK, the exact install command, the API you start from — and the real Java MCP servers in our index to copy. SDK facts read from the repository on 1 December 2026.
Official SDK
Tier 2
Model Context Protocol
Java servers
71
in our index
Requires
Java 17+
toolchain
Good to know: Tier 2 SDK — actively maintained and working toward full spec coverage.

1. Install the Java SDK

package: io.modelcontextprotocol.sdk:mcp
<!-- Maven -->
<dependency>
  <groupId>io.modelcontextprotocol.sdk</groupId>
  <artifactId>mcp</artifactId>
</dependency>

The official SDK repository: modelcontextprotocol/java-sdk.

2. The shape of a minimal server

start from this API
The Java SDK's minimal server lives in its own guide — see the quickstart. Spring AI users add the spring-ai-starter-mcp-server and annotate methods with @Tool.

This is the starting API, not a full program — the complete, always-current walkthrough is the official quickstart. Define your tools, then connect a transport (stdio for local, HTTP for remote). Read on 1 December 2026; confirm the current version in the quickstart.

3. Real Java MCP servers to learn from

most-starred in our index · open source
  1. Mockserver

    mock-server
    A

    Production-ready

    Mock, record/replay, verify and chaos-test any HTTP, REST, gRPC or LLM dependency over MCP.

    Registry
    5k 8d agoApache-2.0
  2. Selenide

    selenide
    A

    Production-ready

    Selenide MCP server — browser automation with smart waits for AI agents

    Registry
    1.9k 6d agoMIT
  3. ArcadeDB

    ArcadeData
    A

    Production-ready

    Multi-Model database with built-in MCP server for SQL, Cypher, Gremlin, and GraphQL.

    Registry
    1.3k 6d agoApache-2.0
  4. SonarQube MCP Server

    SonarSource
    A

    Production-ready

    Analyze code quality and security with SonarQube Server or Cloud directly in AI assistants.

    Registry
    695 6d agoOther
  5. shaft-mcp

    ShaftHQ
    A

    Production-ready

    SHAFT browser automation, capture, and offline deterministic failure diagnosis

    Registry
    422 10d agoMIT
  6. Buddy phone tools

    ghorbelhamdi
    A

    Production-ready

    Android phone tools for AI agents (read the screen, tap, type, open apps), served by the Buddy app.

    Registry
    359 2d agoApache-2.0

See all Java MCP servers, or the best-maintained across every language.

4. Connect it, then get it found

Point a client at your server to try it — the client matrix shows which clients support what. When it works, list it on Serverdex: a free listing is a server page with a link back to us, in front of developers choosing MCP servers. Want it live now without the link? Priority Review ($9, one-time) does that.

Questions people ask

What's the official way to build an MCP server in Java?
Use the official Java SDK, io.modelcontextprotocol.sdk:mcp. Install it (<!-- Maven --> <dependency> <groupId>io.modelcontextprotocol.sdk</groupId> <artifactId>mcp</artifactId> </dependency>), construct a server, register your tools, and connect a transport. The full, always-current walkthrough is the official quickstart; the snippet here shows the shape. Read from the SDK's repository on 1 December 2026.
Is the Java SDK production-ready?
Tier 2 — actively maintained and working toward full specification coverage. Tier 2 SDK — actively maintained and working toward full spec coverage.
How do I test and connect my Java server?
Run it over stdio and point a client at it. Serverdex's client matrix shows which clients support what; most developers start with Claude Desktop or an IDE client. Once it answers, list it on Serverdex so others find it.