fai-mcp-java-scaffold
/fai-mcp-java-scaffold
Scaffold Java MCP servers with Spring Boot integration, typed tool beans, and structured error handling. Use when building MCP servers in Java for enterprise AI agent tool access.
Assessment and security
- Files in this package
- 3
- Scripts
- 0
- HTML comments
- 0
- URLs in SKILL.md
- 0
No signals detected. Repository changed on 26.10.2026, without references to retired models or APIs.
MIT, open: use and modify while retaining author attribution.
What it does and when to use it
Scaffold Java MCP servers with Spring Boot integration, typed tool beans, and structured error handling. Use when building MCP servers in Java for enterprise AI agent tool access.
Original author description
Scaffold Java MCP servers with Spring Boot integration, typed tool beans, and structured error handling. Use when building MCP servers in Java for enterprise AI agent tool access.
How it works
- When to Use
- Maven Dependencies
- Tool Definition
- Application Config
- Spring Boot Main
- Troubleshooting
- Best Practices
- MCP Transport Options
- Related Skills
SKILL.md preview
---
name: fai-mcp-java-scaffold
description: |
Scaffold Java MCP servers with Spring Boot integration, typed tool beans,
and structured error handling. Use when building MCP servers in Java
for enterprise AI agent tool access.
---
# Java MCP Server Scaffold
Build MCP servers in Java with Spring Boot and typed tool definitions.
## When to Use
- Building MCP servers for enterprise Java environments
- Integrating with existing Spring Boot applications
- Exposing Java services as AI agent tools
---
## Maven Dependencies
```xml
<dependency>
<groupId>io.modelcontextprotocol</groupId>
<artifactId>mcp-spring-boot-starter</artifactId>
<version>0.9.0</version>
</dependency>
```
## Tool Definition
```java
import io.modelcontextprotocol.annotation.McpTool;
import io.modelcontextprotocol.annotation.McpParam;
import org.springframework.stereotype.Component;
@Component
public class SearchTools {
@McpTool(name = "search_documents",
description = "Search knowledge base documents by query")
public String searchDocuments(
@McpParam(name = "query", required = true,
description = "Search query text") String query,
@McpParam(name = "top_k",
description = "Number of results") Integer topK) {
if (topK == null) topK = 5;
var results = searchService.search(query, topK);
return objectMapper.writeValueAsString(results);
}
}
```
## Application Config
```yaml
# application.yml
mcp:
server:
name: my-mcp-server
version: 1.0.0
transport: stdio
```
## Spring Boot Main
```java
@SpringBootApplication
public class McpServerApplication {
public static void main(String[] args) {
SpringApplication.run(McpServerApplication.class, args);
}
}
```
## Troubleshooting
| Issue | Cause | Fix |
|-------|-------|-----|
| Tool not registered | Missing @Component | Add @Component to tool class |
| Serialization error | Complex return type | Return String (serialize manually) |
| Slow startup | Full Spring context | Use Spring Boot 3.x with AOT |
| Classpath conflict | Dependency version mismatch | Check BOM alignment |
## Best Practices
| Practice | Rationale |
|----------|-----------|
| Type all tool parameters | Agent understands expected inputs |
| Write descriptive tool docstrings | Agent matches tasks to tools |
| Validate inputs before processing | Prevent injection and crashes |
| Return structured JSON strings | Consistent parsing by consumers |
| Add error messages in results | Agent can report failures to user |
| Test tools independently | Verify behavior before server integration |
## MCP Transport Options
| Transport | Use Case | Config |
|-----------|----------|--------|
| stdio | VS Code Copilot, Claude Desktop | Default — no setup needed |
| SSE | Web clients, remote access | Add HTTP server endpoint |
| WebSocket | Real-time bidirectional | For streaming-heavy tools |
## Related Skills
- `fai-mcp-python-generator` — Python MCP with FastMCP
- `fai-mcp-typescript-generator` — TypeScript MCP with SDK
- `fai-mcp-csharp-scaffold` — C# MCP with ModelContextProtocol
Files in this package (3)
- SKILL.lean.md 3 KB
- SKILL.md 3 KB
- agents/openai.yaml 1 KB
Versions
The database has no other skills named fai-mcp-java-scaffold.
Database snapshot: 13.11.2026 · package version 960e02177065 (SHA-256 digest of the entire package)
Downloads in the last 30 days: 0 · ranking
Report a problem with this skill: harmful content, incorrect descriptions or an author’s removal request.
Similar skills
- 100fai-mcp-go-scaffold
Scaffold Go MCP servers with the mcp-go SDK, typed tool handlers, middleware, and production deployment. Use when building high-performance MCP servers in Go for AI agent tool access. - 100fai-mcp-kotlin-scaffold
Scaffold Kotlin MCP servers with coroutines, typed tool definitions, and Ktor or Spring integration. Use when building MCP servers in Kotlin with idiomatic async patterns. - 100spring-ai-mcp-server-patterns
Provides Spring Boot MCP server patterns that create Model Context Protocol servers with Spring AI by defining tool handlers, exposing resources, configuring prompt templates, and setting up transports for AI function calling and tool calling. Use when building MCP servers to… - 100langchain4j-mcp-server-patterns
Provides LangChain4j patterns for implementing MCP (Model Context Protocol) servers, creating Java AI tools, exposing tool calling capabilities, and integrating MCP clients with AI services. Use when building a Java MCP server, implementing tool calling in Java, connecting… - 95java-mcp-server
Best practices and patterns for building Model Context Protocol (MCP) servers in Java using the official MCP Java SDK with reactive streams and Spring integration. Triggers on: **/*.java, **/pom.xml, **/build.gradle, **/build.gradle.kts - 100java-mcp-server-generator
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".…