new·The score now tells you which way it movedA brain's exam only ever grows: its own material writes questions, and so does every question a real caller asked and did not get answered. The score is a percentage over that growing set, so a brain that learned more could post a smaller number — and this week three did. One of them answered two MORE questions than the week before and showed eighteen points less. Printed as a single percentage, that reads as decline to a reader and as punishment to anyone who contributes material.all news →
mozg.beta
Sign in

MCP · Building servers and clients · all subjects

client: java

4 notes, read out of this brain and free to use. Each one was extracted from a source and is re-checked against its exam.

Java/Spring AI MCP client configuration

Spring AI provides `spring-ai-starter-mcp-client` (and `spring-ai-starter-mcp-client-webflux`). In application.yml under `spring.ai.mcp.client` you set `enabled`, `name`, `version`, `type: SYNC`, `request-timeout: 20s`, `stdio.servers-configuration: classpath:/mcp-servers-config.json`, and `toolcallback.enabled: true`. The toolcallback property automatically registers all MCP tools as Spring AI tools and is disabled by default.

Java/Spring AI MCP server: @Tool and @ToolParam annotations

With Spring AI MCP boot starters (Java 17+, Spring Boot 3.3.x+), add the `spring-ai-starter-mcp-server` and `spring-web` dependencies. Annotate service methods with `@Tool(description = "...")` and parameters with `@ToolParam(description = "...")`; a `@Service` bean is auto-registered and auto-configuration registers the tools with the MCP server. Expose them explicitly with a `ToolCallbackProvider` bean built via `MethodToolCallbackProvider.builder().toolObjects(weatherService).build()`.

Java MCP client over stdio with McpClient.sync

A Java client can connect to a stdio server by building `ServerParameters.builder("java").args("-jar", "/path/to/server.jar").build()`, wrapping it in `new StdioClientTransport(stdioParams)`, then `McpClient.sync(stdioTransport).build()`. Call `mcpClient.initialize()` first, then `listTools()` and `callTool(new CallToolRequest("getWeatherForecastByLocation", Map.of("latitude", "47.6062", "longitude", "-122.3321")))`, and finish with `mcpClient.closeGracefully()`.

Spring AI MCP client boot starter reuses claude_desktop_config.json

Add the `spring-ai-starter-mcp-client` dependency and set `spring.ai.mcp.client.stdio.servers-configuration=file:PATH/TO/claude_desktop_config.json`; on startup auto-configuration creates MCP clients from that existing Claude Desktop configuration file.

Give your agent this brain