|
| 1 | +//// |
| 2 | +This guide is maintained in the main Quarkus repository |
| 3 | +and pull requests should be submitted there: |
| 4 | +https://github.com/quarkusio/quarkus/tree/main/docs/src/main/asciidoc |
| 5 | +//// |
| 6 | += Agent MCP |
| 7 | +include::_attributes.adoc[] |
| 8 | +:categories: tooling |
| 9 | +:summary: Learn more about the Quarkus Agent MCP server for AI coding agents |
| 10 | +:topics: agent-mcp,mcp,ai-agents |
| 11 | + |
| 12 | +[IMPORTANT] |
| 13 | +.Experimental |
| 14 | +==== |
| 15 | +This feature is currently experimental. |
| 16 | +==== |
| 17 | + |
| 18 | +== Overview |
| 19 | + |
| 20 | +The https://github.com/quarkusio/quarkus-agent-mcp[Quarkus Agent MCP] server is a standalone Model Context Protocol (MCP) server that provides AI coding agents with a complete Quarkus development experience. |
| 21 | +This is the **recommended** way to integrate AI coding agents with Quarkus applications. |
| 22 | + |
| 23 | +The Quarkus Agent MCP server acts as a comprehensive development assistant, offering: |
| 24 | + |
| 25 | +- **Project scaffolding** — Create new Quarkus applications with customizable extensions |
| 26 | +- **Application lifecycle management** — Start, stop, and restart your application, with automatic recovery from crashes |
| 27 | +- **Dev MCP proxy** — Access all xref:dev-mcp.adoc[Dev MCP] tools from the running application |
| 28 | +- **Documentation search** — Semantic search across Quarkus documentation using RAG (Retrieval-Augmented Generation) |
| 29 | +- **Extension skills** — Get extension-specific coding patterns, best practices, and testing guidelines |
| 30 | +- **Version management** — Check for updates and get upgrade reports |
| 31 | + |
| 32 | +== Installation |
| 33 | + |
| 34 | +The Quarkus Agent MCP server requires https://www.jbang.dev[JBang]. |
| 35 | +Make sure JBang is installed before configuring your agent: |
| 36 | + |
| 37 | +[source,bash] |
| 38 | +---- |
| 39 | +jbang version |
| 40 | +---- |
| 41 | + |
| 42 | +If JBang is not installed, follow the instructions at https://www.jbang.dev/download/[jbang.dev/download]. |
| 43 | + |
| 44 | +== Configuration |
| 45 | + |
| 46 | +Most coding agents use stdio transport. |
| 47 | +For example, with https://claude.ai/claude-code[Claude Code]: |
| 48 | + |
| 49 | +[source,bash] |
| 50 | +---- |
| 51 | +claude mcp add quarkus-agent -- jbang quarkus-agent-mcp@quarkusio |
| 52 | +---- |
| 53 | + |
| 54 | +Open the **Dev UI** settings dialog and select the Dev MCP tab to see configuration snippets for all supported agents and IDEs (Claude Code, OpenCode, Cline, Goose, Zed, VS Code, Cursor, Claude Desktop, Windsurf, and JetBrains IDEs). |
| 55 | + |
| 56 | +image::dev_mcp_settings.png[Dev MCP Settings] |
| 57 | + |
| 58 | +== Features |
| 59 | + |
| 60 | +=== Project creation |
| 61 | + |
| 62 | +The Agent MCP server can create new Quarkus applications with your choice of extensions, build tool (Maven or Gradle), and Quarkus version. |
| 63 | +It automatically starts the application in dev mode after creation. |
| 64 | + |
| 65 | +=== Application lifecycle management |
| 66 | + |
| 67 | +The server manages your Quarkus application's lifecycle: |
| 68 | + |
| 69 | +- Start applications in dev mode |
| 70 | +- Monitor application health |
| 71 | +- Automatic restart on crashes |
| 72 | +- Graceful shutdown |
| 73 | +- Access application logs |
| 74 | + |
| 75 | +=== Dev MCP integration |
| 76 | + |
| 77 | +Through the Dev MCP proxy, AI agents can access all xref:dev-mcp.adoc[Dev MCP tools and resources] from your running Quarkus application, including: |
| 78 | + |
| 79 | +- Running tests |
| 80 | +- Managing extensions |
| 81 | +- Viewing configuration |
| 82 | +- Accessing build-time data |
| 83 | +- Invoking extension-specific tools |
| 84 | + |
| 85 | +=== Documentation search with RAG |
| 86 | + |
| 87 | +The Agent MCP server includes a semantic search capability powered by a Retrieval-Augmented Generation (RAG) system. |
| 88 | +This allows AI coding agents to search Quarkus documentation intelligently and get relevant answers to questions. |
| 89 | + |
| 90 | +==== How it works |
| 91 | + |
| 92 | +The documentation RAG system: |
| 93 | + |
| 94 | +1. **Indexes Quarkus documentation** — On first use, the server downloads and indexes the official Quarkus documentation for the version matching your project (or the latest version if no project is specified) |
| 95 | +2. **Creates embeddings** — Documentation is chunked and converted into vector embeddings for semantic search |
| 96 | +3. **Semantic retrieval** — When an AI agent searches for documentation, the system finds the most relevant chunks based on semantic similarity, not just keyword matching |
| 97 | +4. **Version-aware** — Documentation matches your project's Quarkus version, ensuring accuracy |
| 98 | + |
| 99 | +==== Usage |
| 100 | + |
| 101 | +AI coding agents can search documentation by querying the Quarkus Agent MCP server. |
| 102 | +For example, searching for "how to configure datasource" will return relevant documentation chunks about datasource configuration, even if those exact words don't appear in the documentation. |
| 103 | + |
| 104 | +The RAG system is automatically initialized on the first documentation search. |
| 105 | +The initial indexing may take a moment, but subsequent searches are fast. |
| 106 | + |
| 107 | +==== Extension documentation RAG |
| 108 | + |
| 109 | +In addition to the main Quarkus documentation, the RAG system also includes extension-specific documentation from the extension modules. |
| 110 | +Each extension can contribute its own documentation, which is automatically discovered and indexed alongside the core documentation. |
| 111 | + |
| 112 | +This ensures that when working with an extension, AI agents have access to: |
| 113 | + |
| 114 | +- Extension-specific configuration options |
| 115 | +- API usage patterns |
| 116 | +- Integration examples |
| 117 | +- Troubleshooting guides |
| 118 | + |
| 119 | +The extension documentation is pulled from the extension's runtime module and is version-matched to your project, ensuring consistency between the code and documentation. |
| 120 | + |
| 121 | +=== Extension skills |
| 122 | + |
| 123 | +Extensions can provide AI coding agents with extension-specific coding guidelines, testing patterns, and common pitfalls by shipping a `quarkus-skill.md` file. |
| 124 | +During the Quarkus build, all skill files are automatically discovered, composed with extension metadata (name, description, guide URL, categories), and aggregated into a single `io.quarkus:quarkus-extension-skills` JAR following the https://agentskills.io/specification[Agent Skills specification]. |
| 125 | +This JAR is published to Maven Central with each Quarkus release and is compatible with https://www.skillsjars.com[SkillsJars]. |
| 126 | + |
| 127 | +==== How skills work |
| 128 | + |
| 129 | +When an AI agent needs to work with a specific Quarkus extension, it can request the skill for that extension. |
| 130 | +The Quarkus Agent MCP server: |
| 131 | + |
| 132 | +1. Identifies the extensions in your project |
| 133 | +2. Retrieves the corresponding skills from the `quarkus-extension-skills` JAR |
| 134 | +3. Composes a skill document that includes: |
| 135 | + - Extension metadata (name, description, guide URL) |
| 136 | + - Coding patterns and best practices |
| 137 | + - Testing guidelines |
| 138 | + - Available Dev MCP tools |
| 139 | + - Common pitfalls to avoid |
| 140 | + |
| 141 | +Skills can be customized at three levels: |
| 142 | + |
| 143 | +- **JAR defaults** — Shipped with the extension |
| 144 | +- **Global customizations** — Stored in `~/.quarkus/skills/` and apply to all projects |
| 145 | +- **Project customizations** — Stored in `.quarkus/skills/` and apply only to the current project |
| 146 | + |
| 147 | +By default, customizations **enhance** (append to) the base skill. |
| 148 | +You can also use **override** mode to completely replace a base skill. |
| 149 | + |
| 150 | +==== Adding a skill file to your extension |
| 151 | + |
| 152 | +Place a `quarkus-skill.md` file in your extension's deployment module at: |
| 153 | + |
| 154 | +[source] |
| 155 | +---- |
| 156 | +my-extension/deployment/src/main/resources/META-INF/quarkus-skill.md |
| 157 | +---- |
| 158 | + |
| 159 | +The Quarkus build automatically discovers all `quarkus-skill.md` files across all extensions and aggregates them into the `quarkus-extension-skills` artifact. |
| 160 | + |
| 161 | +If your extension's runtime module has a `description` field in `META-INF/quarkus-extension.yaml`, it will be included in the composed skill's YAML frontmatter to help AI agents discover and understand your extension. |
| 162 | +The `categories` field under `metadata` is also included, allowing AI agents to group skills by category. |
| 163 | +While optional, providing a description and categories is recommended: |
| 164 | + |
| 165 | +[source,yaml] |
| 166 | +---- |
| 167 | +name: "My Extension" |
| 168 | +description: "A concise description of what this extension does" |
| 169 | +artifact: ${project.groupId}:${project.artifactId}:${project.version} |
| 170 | +metadata: |
| 171 | + guide: "https://quarkus.io/guides/my-extension" |
| 172 | + categories: |
| 173 | + - "web" |
| 174 | +---- |
| 175 | + |
| 176 | +The file should contain concise, actionable Markdown content. |
| 177 | +Focus on what an AI agent needs to know to use your extension correctly: |
| 178 | + |
| 179 | +- **Key patterns** — how to use the main APIs, annotations, and CDI beans. |
| 180 | +- **Testing** — how to write tests using `@QuarkusTest`, Dev Services, and extension-specific test utilities. |
| 181 | +- **Common pitfalls** — mistakes that agents (and developers) frequently make. |
| 182 | + |
| 183 | +Example for a hypothetical extension: |
| 184 | + |
| 185 | +[source,markdown] |
| 186 | +---- |
| 187 | +### Data Access |
| 188 | +
|
| 189 | +- Inject `MyClient` with `@Inject` — it is an `@ApplicationScoped` CDI bean. |
| 190 | +- Use `client.query("...")` for read operations. |
| 191 | +- Always wrap write operations in `@Transactional`. |
| 192 | +
|
| 193 | +### Testing |
| 194 | +
|
| 195 | +- Use `@QuarkusTest` — Dev Services starts a backing service automatically. |
| 196 | +- Inject `MyClient` in tests for direct assertions. |
| 197 | +
|
| 198 | +### Common Pitfalls |
| 199 | +
|
| 200 | +- Do NOT create `MyClient` manually with `new` — always let CDI inject it. |
| 201 | +- Do NOT set the connection URL without a `%prod.` profile prefix — this disables Dev Services. |
| 202 | +---- |
| 203 | + |
| 204 | +==== What gets composed |
| 205 | + |
| 206 | +The skill file content is **not** shipped as-is. |
| 207 | +During the Quarkus build, the `aggregate-skills` goal scans the source tree for all `quarkus-skill.md` files and composes each one with extension metadata to produce a `SKILL.md` file at `META-INF/skills/{extension-name}/SKILL.md` inside the aggregated JAR. |
| 208 | +The composed document follows the https://agentskills.io/specification[Agent Skills specification] and includes: |
| 209 | + |
| 210 | +1. **YAML frontmatter** — the skill name, extension description from `quarkus-extension.yaml`, license, guide URL, and categories as structured metadata for agent discovery. |
| 211 | +2. **Skill body** — the patterns, testing guidelines, and pitfalls authored by the extension developer. |
| 212 | +3. **Dev MCP tools** — the skill is automatically enriched with an "Available Dev MCP Tools" section listing each MCP tool the extension enables by default, including tool names, descriptions, and parameters. |
| 213 | +Tools are discovered from runtime methods annotated with both `@JsonRpcDescription` and `@DevMCPEnableByDefault`, and from deployment processor classes annotated with `@DevMcpBuildTimeTool`. |
| 214 | + |
| 215 | +Example of a composed `SKILL.md`: |
| 216 | + |
| 217 | +[source,markdown] |
| 218 | +---- |
| 219 | +--- |
| 220 | +name: quarkus-my-extension |
| 221 | +description: "A brief description of the extension from quarkus-extension.yaml" |
| 222 | +license: Apache-2.0 |
| 223 | +metadata: |
| 224 | + guide: https://quarkus.io/guides/my-extension |
| 225 | + categories: "web, data" |
| 226 | +--- |
| 227 | +
|
| 228 | +### Data Access |
| 229 | +... |
| 230 | +
|
| 231 | +### Available Dev MCP Tools |
| 232 | +
|
| 233 | +| Tool | Description | Parameters | |
| 234 | +|------|-------------|------------| |
| 235 | +| `quarkus-my-extension_getData` | Get current status | — | |
| 236 | +| `quarkus-my-extension_updateValue` | Update a value | `name` (required): The name, `value` (required): The new value | |
| 237 | +---- |
| 238 | + |
| 239 | +The Dev MCP tools section is appended during the Quarkus build by the `aggregate-skills` Maven goal. |
| 240 | +Only tools that are enabled by default are included. |
| 241 | +All modules are scanned via Jandex on compiled classes. |
| 242 | +The enriched skills are baked into the `quarkus-extension-skills` JAR published with each Quarkus release. |
| 243 | + |
| 244 | +For **runtime methods**, add both `@JsonRpcDescription` and `@DevMCPEnableByDefault` annotations on the method (see xref:dev-mcp.adoc#mcp-tools-against-the-runtime-classpath[Dev MCP guide]). |
| 245 | + |
| 246 | +For **deployment build-time actions**, annotate the processor class with `@DevMcpBuildTimeTool`: |
| 247 | + |
| 248 | +[source,java] |
| 249 | +---- |
| 250 | +@DevMcpBuildTimeTool(name = "updateProperty", // <1> |
| 251 | + description = "Update a configuration property", // <2> |
| 252 | + params = { |
| 253 | + @DevMcpParam(name = "name", description = "The property name"), // <3> |
| 254 | + @DevMcpParam(name = "value", description = "The new value") |
| 255 | + }) |
| 256 | +public class ConfigurationProcessor { |
| 257 | + // ... |
| 258 | +} |
| 259 | +---- |
| 260 | +<1> The tool name, matching the `methodName` in the builder chain. |
| 261 | +<2> A human-readable description of what this tool does. |
| 262 | +<3> Parameter descriptions. Use `required = false` for optional parameters. |
| 263 | + |
| 264 | +The annotation is repeatable — add one per tool on the same class. |
| 265 | +This is the deployment-classpath counterpart of `@JsonRpcDescription` + `@DevMCPEnableByDefault` used on runtime methods. |
| 266 | + |
| 267 | +==== What NOT to put in the skill file |
| 268 | + |
| 269 | +- **Extension description or guide links** — these are automatically added from `quarkus-extension.yaml`. |
| 270 | +- **Configuration properties** — reference the guide instead. A link is auto-generated. |
| 271 | +- **Obvious instructions** — focus on Quarkus-specific patterns and gotchas, not generic advice. |
| 272 | + |
| 273 | +=== Version management |
| 274 | + |
| 275 | +The Agent MCP server can check if your Quarkus project is up-to-date and provide upgrade reports. |
| 276 | +It detects the current version, checks for newer releases, and can preview migrations using `quarkus update --dry-run`. |
| 277 | + |
| 278 | +== Advanced topics |
| 279 | + |
| 280 | +=== Direct connection to Dev MCP |
| 281 | + |
| 282 | +While the Quarkus Agent MCP server is the recommended approach, you can also connect directly to the xref:dev-mcp.adoc#direct-connection-advanced[Dev MCP endpoint] exposed by your running application. |
| 283 | +Direct connection does not provide application lifecycle management, documentation search, or extension skills, but may be useful for advanced use cases or custom integrations. |
| 284 | + |
| 285 | +See the xref:dev-mcp.adoc[Dev MCP guide] for details on direct connection. |
0 commit comments