LC

lightweight-component/aj-mcp

开发工具

本页由 AI 翻译,技术细节请以原文为准。 查看原文

35 stars 10 forks 质量 57 趋势 20GPL-3.0

Java 8 中的简单 MCP SDK

概览

AJ-MCP 是一款轻量级的 Java 模型上下文协议(MCP)SDK。它提供了一个小巧直接的 API,用于构建 MCP 客户端和服务器,尤其是对于必须保持 Java 8 或 Spring Boot 2.x 的现有系统。 - 支持 Java 8 及以上版本,支持 Spring Boot 2.x。- 轻量且体积小巧,主要依赖于 Jackson JSON 和 OkHttp。- 易于使用和扩展,包含示例和双语文档。- 支持 STDIO、传统 HTTP/SSE 传输和可流式 HTTP。- 实现 MCP 协议 2024-11-05、2025-03-26 和 2025-06-18 版本,支持版本协商。- 涵盖工具、资源、资源模板、提示、完成、分页、订阅、取消、日志记录、根、采样和引发。 看看这三个MCP SDK组件项目: - AJ MCP Common,AJ-MCP 的通用库,包含模型上下文协议(Model Context Protocol)及其他一些常见类的实现。- AJ MCP 客户端,MCP 客户端 SDK。

概述(AI 翻译)

AJ-MCP 一个轻量级Java MCP SDK

AJ-MCP 是一个轻量级的 Java 模型上下文协议(MCP)SDK。它提供了一个小巧直接的 API 用于构建 MCP客户端和服务器,尤其是对于必须保持Java的现有系统 8 或 Spring Boot 2.x。

  • 支持 Java 8 及以上版本,支持 Spring Boot 2.x。
  • 轻量级且体积小巧,主要依赖于 Jackson JSON 和 OkHttp。
  • 易于使用和扩展,配有示例和双语文档。
  • 支持 STDIO、遗留的 HTTP/SSE 传输和可流式 HTTP。
  • 实现MCP协议修订版2024-11-05、2025-03-26和2025-06-18,并通过版本协商实现。
  • 涵盖工具、资源、资源模板、提示、完成、分页、订阅、取消、日志记录, 根、采样和引发。

看看这三个MCP SDK组件项目:

独立的 AJ MCP Next 项目在使用 AJ Util 的 Java 8 上针对 2026-07-28。 它拥有核心/客户端/服务器模块,带有 STDIO 和无会话 HTTP 适配器,与这个遗留 SDK 分开。

  • AJ MCP Common,AJ-MCP 的通用库,包含模型上下文的实现 协议及其他常见内容

本页由 AI 翻译,技术细节请以原文为准。

README

以下为原文 README 节选,完整内容请查看原文。

AJ-MCP A Lightweight Java MCP SDK

AJ-MCP is a lightweight Model Context Protocol (MCP) SDK for Java. It provides a small, direct API for building MCP clients and servers, especially for existing systems that must remain on Java 8 or Spring Boot 2.x.

  • Supports Java 8 and above, and supports Spring Boot 2.x.
  • Lightweight and small, with Jackson JSON and OkHttp as its main runtime dependencies.
  • Easy to use and extend, with examples and bilingual documentation.
  • Supports STDIO, the legacy HTTP/SSE transport, and Streamable HTTP.
  • Implements MCP protocol revisions 2024-11-05, 2025-03-26, and 2025-06-18 with version negotiation.
  • Covers tools, resources, resource templates, prompts, completion, pagination, subscriptions, cancellation, logging, roots, sampling, and elicitation.

Check out these three projects of MCP SDK components:

The independent AJ MCP Next project targets 2026-07-28 on Java 8 using AJ Util. It has core/client/server modules with STDIO and sessionless HTTP adapters, separate from this legacy SDK.

For further information, please refer to the User Manual website.

When to use AJ-MCP

AJ-MCP is intended for Java applications that need to expose existing business capabilities to AI clients, or consume MCP servers without upgrading the entire application stack. Typical uses include:

  • wrapping an existing Java service as MCP tools, resources, or prompts;
  • connecting a Java desktop or server application to a local STDIO MCP process;
  • integrating MCP into Spring Boot 2.x or a Servlet-based application;
  • supporting clients that negotiate different MCP protocol revisions.

JSON-RPC batch messages are intentionally not supported.

Modules

在 GitHub 查看完整 README

安装

This server does not publish a one-line install command.

Open the repository installation guide 新手?先看 mcpskill.org 教程 →