java-mcp-server-generator

Generates a complete Java 21 MCP server project with tools, resources, and prompts.

Updated Sep 10, 2026
One-click install
npx skills add https://github.com/serpro-workshop-fortaleza/sifap-modernization-paula --skill java-mcp-server-generator-serpro-workshop-fortaleza
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: java-mcp-server-generator
Source: https://github.com/serpro-workshop-fortaleza/sifap-modernization-paula/tree/main/.github/skills/java-mcp-server-generator
Command: npx skills add https://github.com/serpro-workshop-fortaleza/sifap-modernization-paula --skill java-mcp-server-generator-serpro-workshop-fortaleza

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Building a Model Context Protocol (MCP) server in Java from scratch requires wiring up the official MCP Java SDK, reactive handlers, logging, build configuration, and tests, which is repetitive and error-prone. This Skill scaffolds the entire project structure so you start from a working, compilable server instead of a blank directory. ## Core Features & Use Cases - Full project scaffolding: Produces pom.xml or build.gradle.kts, the McpServerApplication entry point, and organized packages for tools, resources, and prompts. - Reactive handler templates: Generates Project Reactor Mono-based handlers with SLF4J logging, argument validation, and structured error responses. - Tests and documentation: Includes a JUnit 5 test class covering success and error flows (like division by zero) plus a README with build, run, and VS Code mcp.json integration steps. - Use Case: You want to expose internal business operations as MCP tools for an AI assistant. Invoke this Skill to generate a Maven-based Java 21 server with sample greet and calculate tools, then replace the sample handlers with your own logic. ## Quick Start Ask the assistant to create a Java MCP server project with Maven that exposes your desired tools, resources, and prompts.

Frequently Asked Questions about java-mcp-server-generator

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I create an MCP server in Java?

Use the official MCP Java SDK (io.modelcontextprotocol.sdk:mcp) with Java 21 and Maven or Gradle. Define tools, resources, and prompts, register reactive handlers on an McpServer instance, and start it with a StdioServerTransport.

Should I use Maven or Gradle for a Java MCP server?

Both are supported. Maven uses a pom.xml with the shade plugin to produce an executable jar, while Gradle uses a build.gradle.kts with the application plugin. Choose based on your team's existing build tooling.

What Java version is required for the MCP Java SDK?

The generated project targets Java 21, configured through maven.compiler.source/target or Gradle's sourceCompatibility. You also need Maven 3.6+ or Gradle 7+ to build the project.

How do I connect a Java MCP server to VS Code?

Add the server to the .vscode/mcp.json file with a command entry pointing to java -jar and the path to your built jar. VS Code then launches the server over stdio and exposes its tools to the assistant.

How are errors handled in MCP tool handlers?

Handlers validate incoming arguments and return a ToolResponse.error with a descriptive message instead of throwing exceptions. For example, the calculate tool returns an error response for division by zero or unknown operations.

Does the Java MCP server support asynchronous handlers?

Yes, handlers are reactive and return Project Reactor Mono types for asynchronous execution. The project also includes reactor-test as a test dependency, and tests can use a synchronous wrapper via toSyncServer.