github/awesome-copilot/java-mcp-server-generator
Claude Code and agent skill by github/awesome-copilot
- community
Checking that the SKILL.md file is still in the repository.
Use this skill when the user wants to create a Model Context Protocol (MCP) server in Java or in a Spring Boot app. Also use it when the user wants AI agents, such as GitHub Copilot or Claude, to use Java code, an API, or a database. Use it even if the user does not say "MCP". The skill makes a Maven or Gradle project with the MCP Java SDK 2.x, tools, JUnit tests, and client configuration. Do not use it for Quarkus/Quarkiverse MCP servers (use the `quarkus-mcp-server-sse` instruction), for an MCP client or for a server in another language.
Install
npx vskill@latest install github/awesome-copilot/java-mcp-server-generatorSKILL.md
Java MCP Server Generator
Create a Model Context Protocol (MCP) server in Java with the official MCP Java SDK 2.x. SDK 2.0.x supports the MCP specification revision 2025-11-25 and the earlier revisions. SDK 3.x will add the revision 2026-07-28.
Workflow
Copy this checklist and track your progress:
- [ ] Step 1: Create the project.
- [ ] Step 2: Write the server.
- [ ] Step 3: Write the tests.
- [ ] Step 4: Build until the tests pass.
- [ ] Step 5: Configure the client.
Step 1: Create the project
Use Maven by default. If the project uses Gradle or the user asks for Gradle, read references/gradle.md. Use it for Step 1, Step 4, and Step 5.
Make this layout:
Write pom.xml:
- The
mcpartifact containsmcp-coreand the Jackson 3 JSON mappermcp-json-jackson3. slf4j-simplewrites the SDK logs to stderr.- The shade plugin makes one executable JAR with all dependencies.
Step 2: Write the server
Start from this template:
Then change the template to match the request of the user:
- Replace
divideTool()with the tools that the user asks for. Make one method for each tool. - Give each tool a JSON Schema
inputSchemaand adescription. The description tells the model when to use the tool. - When the client must get machine-readable data, add
.outputSchema(Map)to the tool. Return the data withCallToolResult.builder().structuredContent(map). Also add the same data as text content for older clients. - Mark a read-only tool with
.annotations(ToolAnnotations.builder().readOnlyHint(true).build()). UsedestructiveHint(true)for a destructive tool. - Add resources, resource templates, and prompts only when the user asks for them. Also enable them in
ServerCapabilities.
Use stdio by default. Read references/streamable-http.md only when the user asks for a remote server, an HTTP server, or Spring Boot.
Step 3: Write the tests
The test starts the server as a subprocess and connects to it with the SDK client. Write a test for each tool and for each error result:
- The test uses the
javacommand of the JDK that runs Maven. Do not use thejavacommand fromPATH. - The test uses the real stdio transport and the real JSON-RPC messages.
Step 4: Build until the tests pass
- Run
mvn verify. This command compiles the code, runs the tests, and makestarget/mcp-server-demo-0.1.0.jar. - If a test fails, read the error. Fix the server or the test.
- Run
mvn verifyagain. - Continue only when the build is successful.
Step 5: Configure the client
For VS Code, write .vscode/mcp.json:
For Claude Desktop, put the same command and args in claude_desktop_config.json, below the mcpServers key.
For an HTTP server, use the client configuration in references/streamable-http.md.
Tell the user these facts:
java -jar target/mcp-server-demo-0.1.0.jarstarts the stdio server. The server waits for a host on stdin. The SDK logs go to stderr.- To test the server manually, start the MCP Inspector with the same command. The Inspector uses Node.js.
Gotchas
SDK 2.x changed many patterns of SDK 0.x and 1.x. Do not copy examples from earlier versions. Read the migration guide for the full list.
This is the start of the file. Read the full SKILL.md on GitHub.
Security
- Security scanPassed, 95 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/java-mcp-server-generator/SKILL.md
Popularity
- Repository stars
- 27,146
- Repository forks
- 3,151
- 7-day trend score
- 51
Stars and forks are for the whole GitHub repository, not this skill alone. Refreshed 21 Mar 2026, 8 months ago.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/github/awesome-copilot/java-mcp-server-generator)