How mr-mtd/springboot_mcp_orchestrator works
This is a Spring Boot chat API that lets a React client ask natural-language questions answered using tools exposed by a transport MCP server. The request flows through the chat endpoint and ChatService, which maintains conversation context, consults the model, and supplies metered MCP tool callbacks; the reply includes the answer, tool-call details, and token usage. The README documents the model/tool interaction and operational capabilities. Some configuration and integrations are represented from documentation and the source index, not inspected implementation excerpts.
Main entry points: ChatService.java Chat service · ChatController.java Chat endpoint · MeteredToolCallback.java Metered callbacks · exception Service exceptions
Components 16
API and HTTP
- Chat endpoint
src/main/java/io/github/mrmtd/orchestrator/controller/ChatController.java - Chat payloads
src/main/java/io/github/mrmtd/orchestrator/model - CORS policy
src/main/java/io/github/mrmtd/orchestrator/config/CorsConfig.java - Request IDs
src/main/java/io/github/mrmtd/orchestrator/filter/RequestIdFilter.java - Application startup
src/main/java/io/github/mrmtd/orchestrator/OrchestratorApplication.java - OpenAPI docs
src/main/java/io/github/mrmtd/orchestrator/config/OpenApiConfig.java
Chat orchestration
- Chat service
src/main/java/io/github/mrmtd/orchestrator/service/ChatService.java - Chat client setup
src/main/java/io/github/mrmtd/orchestrator/config/ChatClientConfig.java - Session memory
src/main/java/io/github/mrmtd/orchestrator/config/ChatClientConfig.java - Metered callbacks
src/main/java/io/github/mrmtd/orchestrator/mcp/MeteredToolCallback.java
External services
- OpenAI API
- Transport MCP server
Errors and telemetry
- Problem responses
src/main/java/io/github/mrmtd/orchestrator/exception/GlobalExceptionHandler.java - Service exceptions
src/main/java/io/github/mrmtd/orchestrator/exception - Chat and tool metrics
src/main/java/io/github/mrmtd/orchestrator/service/ChatService.java
Other components
- React client
Connections 17
- React client → Chat endpoint: posts chat
README.md - Chat endpoint → Chat payloads: accepts and returns
src/main/java/io/github/mrmtd/orchestrator/controller/ChatController.java - Chat endpoint → Chat service: delegates chat
src/main/java/io/github/mrmtd/orchestrator/controller/ChatController.java - Chat endpoint → React client: returns reply
README.md - CORS policy → React client: allows browser
README.md - Request IDs → Chat endpoint: filters requests
- Chat service → Chat client setup: uses chat client
- Chat service → Session memory: keeps session
README.md - Chat service → OpenAI API: sends prompt
README.md - OpenAI API → Chat service: returns answer or tools
README.md - Chat service → Metered callbacks: wraps tool callbacks
src/main/java/io/github/mrmtd/orchestrator/service/ChatService.java - Metered callbacks → Transport MCP server: calls MCP tools
README.md - Transport MCP server → Metered callbacks: returns tool results
README.md - Chat service → Service exceptions: raises failures
src/main/java/io/github/mrmtd/orchestrator/service/ChatService.java - Problem responses → Service exceptions: maps exceptions
src/main/java/io/github/mrmtd/orchestrator/exception/GlobalExceptionHandler.java - Chat service → Chat and tool metrics: records chat metrics
src/main/java/io/github/mrmtd/orchestrator/service/ChatService.java - Metered callbacks → Chat and tool metrics: records tool metrics
src/main/java/io/github/mrmtd/orchestrator/mcp/MeteredToolCallback.java