MCP.so
登录

ModelContextProtocol (MCP) Java SDK v0.8.0 Specification

@jayessdeesea

关于 ModelContextProtocol (MCP) Java SDK v0.8.0 Specification

Instructions for an AI on how to create a Java based mcp server and client

基本信息

分类

开发工具

运行时

java

传输方式

stdio

发布者

jayessdeesea

配置

暂无标准配置

该服务器的 README 中没有可解析的 MCP 配置块,请前往代码仓库查看安装说明。

代码仓库

工具

未检测到工具

工具是从 README 中自动提取的。维护者可以在 ## Tools 标题下列出工具,即可填充这部分内容。

概览

What is ModelContextProtocol (MCP) Java SDK v0.8.0 Specification?

The Model Context Protocol (MCP) is a standardized protocol for communication between AI models and external tools or resources. This Java SDK provides a robust implementation, enabling Java applications to create MCP servers that expose tools and resources to AI models, as well as MCP clients that communicate with these servers.

How to use ModelContextProtocol (MCP) Java SDK v0.8.0 Specification?

Add the MCP BOM to your project's dependency management, then include the core mcp artifact. Use the builder pattern to create a McpSyncClient or McpAsyncClient, providing a transport (e.g., StdioClientTransport) and client info. Then call methods like readResource, callTool, listPrompts, or getPrompt. Close the client after use.

Key features of ModelContextProtocol (MCP) Java SDK v0.8.0 Specification

  • Modular architecture with separate transport, protocol, and error‑handling layers
  • Synchronous (McpSyncClient) and asynchronous (McpAsyncClient) client implementations
  • Server implementations (McpSyncServer, McpAsyncServer) for exposing resources and tools
  • Built‑in support for stdio transport; HTTP/SSE transport via Jakarta Servlet API
  • Type‑safe MCP schema classes and error utilities in dedicated packages
  • Full support for reading resources, calling tools, and managing prompts

Use cases of ModelContextProtocol (MCP) Java SDK v0.8.0 Specification

  • Build a Java MCP server that exposes file‑system resources and AI‑assistant tools
  • Create a synchronous client that fetches resources and calls tools from an external MCP server
  • Develop an asynchronous client for non‑blocking interactions with a remote MCP server
  • List and retrieve prompt templates from a server to generate structured AI queries

FAQ from ModelContextProtocol (MCP) Java SDK v0.8.0 Specification

What is the difference between synchronous and asynchronous clients?

McpSyncClient blocks on each call, while McpAsyncClient returns Reactor Mono objects for non‑blocking operation and requires an explicit initialize().block() call.

What transports are supported out of the box?

The SDK includes StdioClientTransport for stdio‑based communication. HTTP/SSE transports require the jakarta.servlet-api dependency (version 5.0.0, scope provided).

What are the required dependencies?

Use the MCP BOM (mcp-bom:0.8.0) for version management, then add the core mcp artifact. For HTTP/SSE, include jakarta.servlet-api:5.0.0. Testing utilities are in the mcp-test artifact.

Can

评论

开发工具 分类下的更多 MCP 服务器