MCP Template

A Java template for MCP servers, ready to run behind MCP Gateway.

Terminal
$ git clone https://github.com/aiwcorpo/mcp-server-template.git
$ cd mcp-server-template && ./mvnw verify
$ ./new-server.sh crm
# new server in ../mcp-server-crm

Hexagonal architecture

mcp-toolstools the agent can see
mcp-applicationuse cases
mcp-coredomain, no framework dependencies
mcp-integrationadapter to your system
mcp-appstartup and configuration

What you get

A risk level for every tool

@Tool(name = "delete_page", description = "...")
@ToolRisk(RiskLevel.DESTRUCTIVE)
@ToolTitle("Delete page")
READ_ONLYUPDATEDESTRUCTIVE

Credentials from the gateway, no secrets in the server

aiwcorpo:
  mcp:
    platform:
      auth-mode: gateway   # dev-pat only in the dev profile
The gateway attaches an OAuth token, a PAT or a service account to each call. The server stores nothing.

Safe error messages

if (ex instanceof PageNotFoundException) {
    return Optional.of(new SafeError(
        ToolErrorCode.NOT_FOUND_OR_DENIED.code(),
        ToolErrorCode.NOT_FOUND_OR_DENIED_MESSAGE));
}
The agent does not see stack traces or internal data.

Auditing with no extra code

{ "server": "mcp-confluence",
  "tool": "delete_page",
  "risk": "DESTRUCTIVE",
  "username": "anna.nowak",
  "outcome": "ok" }

Specifications

Language
Java 25
Framework
Spring Boot 4.1, Spring AI 2.0
Build
Maven
Library
mcp-platform-starter 4.0
Policies
Cedar, inside the server JAR
Endpoint
MCP over HTTP
Works with
MCP Gateway 2.0

Let's talk about your systems

Book a call (English or Polish)