Skip to content

Commit d5df0a1

Browse files
committed
feat(mcp): complete APT code generation for MCP server features
Implement full Annotation Processor (APT) support for generating MCP server specifications and handlers, bridging Jooby controllers with the Model Context Protocol SDK. Key implementations: * Annotations: Add code generation for @mcptool, @McpPrompt, @McpResource, and @McpCompletion. * Completion Routing: Implement "Group and Route" architecture. Groups multiple argument-specific completion methods under a single MCP Reference and routes them at runtime using compile-time generated enhanced switch/when expressions. * Dynamic Resources: Auto-detect URI placeholders (`{}`) to dynamically register as Resource Templates or static Resources. * Template Variables: Integrate `DefaultMcpUriTemplateManager` to safely extract and bind path variables from `req.uri()` into controller args. * Schema Generation: Optimize Jackson 3 (`tools.jackson`) schema builder to automatically omit output schemas for primitives, standard java.lang types, and internal MCP classes. * Idiomatic Output: Generate clean, modern Java (var, enhanced switch) and Kotlin (val, when) with strict null-safety checks and safe default fallbacks for unmatched requests.
1 parent 61cf331 commit d5df0a1

File tree

6 files changed

+1265
-348
lines changed

6 files changed

+1265
-348
lines changed

modules/jooby-apt/pom.xml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,13 @@
3232
<scope>test</scope>
3333
</dependency>
3434

35+
<dependency>
36+
<groupId>com.github.victools</groupId>
37+
<artifactId>jsonschema-generator</artifactId>
38+
<version>5.0.0</version>
39+
<scope>test</scope>
40+
</dependency>
41+
3542
<dependency>
3643
<groupId>io.jooby</groupId>
3744
<artifactId>jooby-jackson3</artifactId>

0 commit comments

Comments
 (0)