Generate Entry Point
The generateEntryPoint | gep task will generate a module in Infrastructure layer, this task has one required
parameter type.
Whether you'll use generic one also parameter name is required.
gradle generateEntryPoint --type=[entryPointType]
gradle gep --type [entryPointType]
| Type | Name | Parameter | Values | Default |
|---|---|---|---|---|
| generic | Empty Entry Point | --name | String | - |
| asynceventhandler | Async Event Handler | --eda | true, false | false |
--tech | rabbitmq, kafka, rabbitmq,kafka | rabbitmq | ||
| graphql | API GraphQL | --pathgql | String (path) | /graphql |
| kafka | Kafka Consumer | - | - | - |
| mcp | MCP Server (Model Context Protocol) | --name | String | - |
--enable-tools | true, false | true | ||
--enable-resources | true, false | true | ||
--enable-prompts | true, false | true | ||
--enable-security | true, false | true | ||
--enable-audit | true, false | true | ||
| mq | JMS MQ Client to listen messages | - | - | - |
| restmvc | API REST (Spring Boot Starter Webmvc) | --server | tomcat, jetty | tomcat |
--authorization | true, false | false | ||
--versioning | HEADER, PATH, NONE | NONE | ||
--from-swagger | File path | swagger.yaml | ||
--swagger | true, false | false | ||
| rsocket | Rsocket Controller Entry Point | - | - | - |
| sqs | SQS Listener | - | - | - |
| webflux | API REST (Spring Boot Starter WebFlux) | --router | true, false | true |
--authorization | true, false | false | ||
--versioning | HEADER, PATH, NONE | NONE | ||
--from-swagger | File path | swagger.yaml | ||
--swagger | true, false | false | ||
| kafkastrimzi | Kafka Strimzi Consumer Entry Point | --name | String | - |
--topic-consumer | String (topic name) | test-with-registries |
Additionally, if you'll use a restmvc, you can specify the web server on which the application will run. By default,
Tomcat.
| Reference for serverOption | Name |
|---|---|
| tomcat | Tomcat server (default) |
| jetty | Jetty server |
gradle generateEntryPoint --type=restmvc --server=[serverOption]
gradle gep --type=restmvc --server=[serverOption]
This task will generate something like that:
π¦infrastructure
β£ πentry-points
β β πgeneric
β β β£ πsrc
β β β β£ πmain
β β β β β πjava
β β β β β β π[package]
β β β β β β β πgeneric
β β β β πtest
β β β β β πjava
β β β β β β π[package]
β β β β β β β πgeneric
β β β πbuild.gradle
Usage Example for Kafka Strimzi Consumerβ
gradle generateEntryPoint --type=kafkastrimzi
gradle gep --type=kafkastrimzi
gradle generateEntryPoint --type=kafkastrimzi --name=myConsumer --topic-consumer=myTopic
gradle gep --type=kafkastrimzi --name=myConsumer --topic-consumer=myTopic
This will generate a specialized entry point for consuming Kafka messages using Strimzi, with custom parameters.
Usage Example for MCP (Model Context Protocol)β
The mcp entry point type generates a reactive MCP server with Tools, Resources, and Prompts capabilities, based on
Spring AI.
Basic Commandβ
gradle generateEntryPoint --type=mcp
gradle gep --type=mcp
Available Parametersβ
| Parameter | Values | Default | Description |
|---|---|---|---|
--name | String | null | MCP Server Name |
--enable-tools | true/false | true | Enable Tools |
--enable-resources | true/false | true | Enable Resources |
--enable-prompts | true/false | true | Enable Prompts |
--enable-security | true/false | true | Enable OAuth2/Entra ID Security |
--enable-audit | true/false | true | Enable Audit Logging (requires AOP) |
Usage Examplesβ
# Generate with all capabilities enabled (default: includes security and audit)
gradle generateEntryPoint --type=mcp
# Only Tools
gradle generateEntryPoint --type=mcp --enable-tools=true --enable-resources=false --enable-prompts=false
# Only Resources
gradle generateEntryPoint --type=mcp --enable-tools=false --enable-resources=true --enable-prompts=false
# With custom name
gradle generateEntryPoint --type=mcp --name=BancolombiaAssistant
# Without security (development mode only)
gradle generateEntryPoint --type=mcp --enable-security=false
# Without audit logging
gradle generateEntryPoint --type=mcp --enable-audit=false
Generated Structureβ
infrastructure/
βββ entry-points/
βββ mcp-server/
βββ build.gradle
βββ src/
βββ main/java/[package]/mcp/
β βββ tools/
β β βββ HealthTool.java
β β βββ ExampleTool.java
β βββ resources/
β β βββ SystemInfoResource.java
β β βββ UserInfoResource.java
β βββ prompts/
β β βββ ExamplePrompt.java
β βββ audit/ # If audit enabled
β βββ McpAuditAspect.java
βββ test/java/[package]/mcp/
βββ tools/
βββ resources/
βββ prompts/
βββ audit/ # If audit enabled
βββ McpAuditAspectTest.java
applications/
βββ app-service/
βββ src/
βββ main/java/co/com/bancolombia/config/
β βββ McpSecurityConfig.java # If security enabled
βββ test/java/co/com/bancolombia/config/
βββ McpSecurityConfigTest.java # If security enabled
Generated Componentsβ
Java Classes:
HealthTool.java- Health check toolExampleTool.java- Example tool (echo, add)SystemInfoResource.java- System info resourceUserInfoResource.java- Resource template with parametersExamplePrompt.java- Prompt templates
Tests:
HealthToolTest.javaExampleToolTest.javaSystemInfoResourceTest.javaUserInfoResourceTest.javaExamplePromptTest.java
Security & Audit (if enabled):
McpSecurityConfig.java- OAuth2/Entra ID configurationMcpSecurityConfigTest.javaMcpAuditAspect.java- Automatic audit loggingMcpAuditAspectTest.java
Automatic Configurationβ
The command also automatically updates application.yaml with the MCP configuration:
spring:
ai:
mcp:
server:
protocol: "STATELESS"
name: "${spring.application.name}"
version: "1.0.0"
type: "ASYNC"
instructions: |
Reactive MCP Server with capabilities:
- Tools: Executable tools
- Resources: Access to system and user data
- Prompts: Custom conversation templates
Security: Authenticated via Entra ID (Bearer Token)
streamable-http:
mcp-endpoint: "/mcp/${spring.application.name}"
capabilities:
tool: true
resource: true
prompt: true
request-timeout: "30s"
# Security configuration (if --enable-security=true)
security:
oauth2:
resourceserver:
jwt:
issuer-uri: https://login.microsoftonline.com/${TENANT_ID}/v2.0
client-id: ${CLIENT_ID}
jwt:
json-exp-roles: /roles # JSON path for role extraction
Security and Audit Featuresβ
By default, the MCP entry point is generated with security and audit enabled.
Security (McpSecurityConfig)β
When --enable-security=true (default), the generator creates a complete OAuth2/Entra ID security configuration:
- OAuth2 Resource Server: Validates JWT tokens from Entra ID
- JWT Validation: Validates audience (
aud), app ID (appid), and issuer - Role Extraction: Extracts roles from JWT claims using configurable JSON path
- Method Security: Enables
@PreAuthorizeannotations for RBAC - Public Endpoints: Actuator health and info endpoints remain public
- Access Denied Logging: Explicitly logs security rejections with user and path details
Dependencies added to app-service:
spring-boot-starter-securityspring-boot-starter-oauth2-resource-serverspring-boot-starter-actuatorspring-boot-starter-webflux
Audit Logging (McpAuditAspect)β
When --enable-audit=true (default), the generator creates an AOP aspect that automatically logs all MCP operations:
- What is audited: All calls to
@Tool,@McpResource, and@McpPromptmethods - Information logged:
- Who: Client ID extracted from JWT token (
appid,azp, oraud) - What: Class, method name, and arguments
- When: Timestamp (automatic via logging framework)
- Result: Success or failure
- Performance: Execution time in milliseconds
- Who: Client ID extracted from JWT token (
- Reactive Support: Integrates seamlessly with
Monoreturn types - Security Context: Extracts authentication details from
ReactiveSecurityContextHolder
Dependency added to mcp-server:
spring-boot-starter-aop(conditionally added only if audit is enabled)
Example audit log output:
π [AUDIT] TOOL llamado por: a1b2c3d4-client-id | MΓ©todo: ExampleTool.echo | Args: ["hello"]
β
[AUDIT] TOOL exitoso | Client: a1b2c3d4-client-id | MΓ©todo: ExampleTool.echo | Tiempo: 45ms
Component Developmentβ
Create a Toolβ
@Component
public class CalculatorTool {
@McpTool(name = "multiply", description = "Multiplies two numbers")
public Mono<Integer> multiply(
@McpToolParam(description = "First number", required = true) int a,
@McpToolParam(description = "Second number", required = true) int b) {
return Mono.just(a * b);
}
}
Create a Resourceβ
@Component
public class ConfigResource {
@McpResource(
uri = "resource://config/app",
name = "app-config",
description = "Application configuration")
public Mono<ReadResourceResult> getConfig() {
return Mono.fromCallable(() -> {
// Implementation
});
}
}
Create a Promptβ
@Component
public class SupportPrompt {
@McpPrompt(
name = "customer-support",
description = "Generates a customer support prompt")
public Mono<GetPromptResult> customerSupport(
@McpArg(name = "issue", required = true) String issue) {
return Mono.fromCallable(() -> {
// Implementation
});
}
}