Skip to content

feat: MCP server#5542

Draft
SteKoe wants to merge 22 commits into
masterfrom
feat/mcp-server
Draft

feat: MCP server#5542
SteKoe wants to merge 22 commits into
masterfrom
feat/mcp-server

Conversation

@SteKoe

@SteKoe SteKoe commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

This pull request introduces support for the Model Context Protocol (MCP) to Spring Boot Admin, allowing integration with AI assistants. The main changes include adding new MCP server and starter modules, updating dependencies to support MCP, and providing a new sample application and documentation for MCP integration.

MCP Server and Starter Modules:

  • Added new modules spring-boot-admin-server-mcp and spring-boot-admin-starter-server-mcp to provide MCP server functionality and easy integration as a starter. (pom.xml, spring-boot-admin-server-mcp/pom.xml) [1] [2]
  • Updated dependency management to include the new MCP modules and ensure they are available for downstream projects. (spring-boot-admin-dependencies/pom.xml) [1] [2]

Sample Application and Documentation:

  • Added a new sample project spring-boot-admin-sample-mcp demonstrating how to run the MCP server alongside the Web UI. Includes application code and configuration. (spring-boot-admin-samples/pom.xml, spring-boot-admin-samples/spring-boot-admin-sample-mcp/) [1] [2] [3] [4]
  • Updated documentation to add an MCP section, list the MCP sample, and update the feature comparison table to include MCP capabilities. (spring-boot-admin-docs/src/site/docs/07-mcp/_category_.json, spring-boot-admin-docs/src/site/docs/09-samples/index.md) [1] [2] [3] [4]

Dependency Updates:

  • Added the spring-ai.version property and ensured the MCP modules use the correct version of Spring AI dependencies. (pom.xml)

These changes collectively enable Spring Boot Admin to expose registered instances and health status via MCP, facilitating AI assistant integration.

image

@SteKoe
SteKoe force-pushed the feat/mcp-server branch 2 times, most recently from 1adf97c to 0032750 Compare July 17, 2026 20:57
SteKoe added 13 commits July 18, 2026 14:45
Adds spring-boot-admin-server-mcp, an optional module that exposes
registered instances and health status via the Model Context Protocol
using Spring AI 2.0.0-M6 with stateless Streamable HTTP transport.

Three MCP tools are provided:
- list-applications: lists all registered Spring Boot applications
- get-health: fetches live health details from /actuator/health
- get-status: returns the cached status from the registry

Also adds spring-boot-admin-sample-mcp demonstrating Web UI and MCP
server running together on the same port.

# Conflicts:
#	pom.xml
Completes MVP tool coverage with five additional tools:
- list-metrics: lists all available metric names from /actuator/metrics
- get-metrics: fetches a specific metric value with unit
- get-logs: returns last N lines from /actuator/logfile (default 50, max 500)
- restart-application: POSTs to /actuator/restart
- refresh-configuration: POSTs to /actuator/refresh, reports changed keys
Covers setup, all 8 tools, configuration reference, security,
and connection examples for OpenCode, Claude Desktop, Claude Code,
and Cursor.
Add get-env to resolve a single configuration property or environment
variable and list-env to retrieve all environment properties grouped by
property source, with an optional case-insensitive name filter. Document
both tools and their actuator endpoint requirements.
Drop the Spring Security and devtools dependencies and the permit-all
security bean in favour of spring-cloud-starter, and enable the restart
and refresh actuator endpoints so the operations MCP tools work against
the sample out of the box. Remove the obsolete application context test.
Contribute spring.ai.mcp.server.name and spring.ai.mcp.server.version as
low-precedence defaults via an EnvironmentPostProcessor. The name defaults
to "Spring Boot Admin MCP Server" and the version is read from the JAR
manifest. User configuration still overrides both. Remove the now-redundant
hardcoded values from the sample application.
Introduces a dedicated MCP server starter that bundles the Spring Boot
Admin server with the MCP server module (without the Web UI). Register
it in the root reactor and BOM, and switch the MCP sample to use the
new starter.
Recommend the spring-boot-admin-starter-server-mcp starter and clarify
it runs standalone without the Web UI. Note that server name and
version have sensible defaults and need not be set explicitly.
@SteKoe
SteKoe force-pushed the feat/mcp-server branch from 0032750 to e6f9edb Compare July 18, 2026 12:45
SteKoe added 7 commits July 18, 2026 17:13
… caches, and beans tools

New tool classes (one per actuator, following existing pattern):
- LoggersTools: list-loggers, get-logger, set-logger-level
- ThreadDumpTools: get-thread-dump
- HttpExchangesTools: get-http-exchanges (limit param)
- ScheduledTasksTools: get-scheduled-tasks
- CachesTools: list-caches
- BeansTools: list-beans (filter param)

Each tool class is independently togglable via
spring.boot.admin.mcp.tools.<name>=false.

McpProperties and McpAutoConfiguration extended accordingly.
docs/07-mcp/index.md updated: Available Tools, Requirements, and
Configuration Reference tables.
Extract shared WebClient call patterns into ActuatorClient (composition):
- withInstance(): findByName / switchIfEmpty lookup with standard not-found message
- fetch(): GET -> Map<String,Object> with configurable or default timeout
- fetchText(): GET -> raw String (logfile)
- post() / postBodiless(): POST with JSON body
- query(appName, urlSuffix, formatter): collapses the
  withInstance -> fetch -> map -> onErrorResume block into one call
  for 10 read-only GET tool methods; label derived from urlSuffix

Tool classes now hold a single ActuatorClient field. 6 tool classes
(Caches, Beans, Env, Metrics, HttpExchanges, ScheduledTasks) drop
their Logger field entirely; doOnError warnings route through
ActuatorClient's own logger.

McpAutoConfiguration wires one shared ActuatorClient bean into all
tool beans. 65 tests remain green.
Two new properties in spring.boot.admin.mcp:
- timeout (default 450ms): applied to all standard actuator calls
- thread-dump-timeout (default 10s): applied to /actuator/threaddump

Docs: two new rows added to the Configuration Reference table.
…PostProcessor

Spring AI's sync default would block Netty's event loop; the async
server matches the reactive WebFlux/Netty stack and tool methods that
return Mono<String>.

Although McpServerProperties.protocol defaults to STREAMABLE in Java,
transport selection uses @ConditionalOnProperty evaluated against the
Environment before property binding. McpServerSseWebFluxAutoConfiguration
carries matchIfMissing=true on its SSE condition, so when the property is
absent the legacy SSE transport wins and /mcp returns 404.

Both defaults are contributed at lowest precedence (addLast) so users can
override them. Users now only need spring.boot.admin.mcp.enabled=true.
type=async and protocol=streamable are now contributed automatically by
McpServerDefaultsEnvironmentPostProcessor. Users only need
spring.boot.admin.mcp.enabled=true.
@SteKoe
SteKoe force-pushed the feat/mcp-server branch from 31db20c to 0e57d49 Compare July 18, 2026 20:23
SteKoe added 2 commits July 18, 2026 23:00
- Update list-applications tool description to mention instance ID
- Update fleet status example conversation to show id field in output
- Add MCP sample to 09-samples index (list, directory tree, feature table)
Add instance ID to list-applications output. Allow all tools to
resolve an instance by ID when no name match is found in the registry.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant