aj
Simple MCP SDK in Java
claude mcp add --transport stdio lightweight-component-aj-mcp java -jar path/to/aj-mcp-server.jar \ --env MCP_LOG_LEVEL="INFO" \ --env MCP_CONFIG_PATH="path/to/config"
How to use
AJ-MCP is a lightweight Java MCP SDK server designed to implement the Model Context Protocol in Java applications. It provides a foundation to expose your data sources and business logic via MCP-compliant models and endpoints, with Spring Boot 2.x compatibility for easy integration into existing Java ecosystems. The server ships with a Common library, a Client SDK, and sample implementations, making it straightforward to build, test, and deploy MCP-enabled services. To get started, build the supported modules, run the server, and explore the included samples to see how models, contexts, and actions are wired to real data sources.
Once running, you can extend the server by adding MCP models, registers, and adapters that bridge your data sources (databases, REST services, internal systems) to the MCP layer. The provided samples demonstrate both server-side model definitions and how to expose them through the MCP API, enabling clients to query context, request inferences, or trigger actions against your data sources. Refer to the user manual linked in the project for design patterns, best practices, and integration guidance across common data sources and deployment scenarios.
How to install
Prerequisites:
- Java 8 (or higher) JDK
- Maven or Gradle for build (depending on your chosen workflow)
- Basic knowledge of Java and Spring Boot (for Spring-based integrations)
- Clone the repository and navigate to the project directory:
git clone https://github.com/lightweight-component/aj-mcp
cd aj-mcp
- Build the modules (examples use Maven by default):
# Build all modules including aj-mcp-server and samples
mvn -B -DskipTests package
-
Locate the server artifact (e.g., aj-mcp-server.jar) in the target directories (or run via Spring Boot if you prefer).
-
Run the MCP server:
java -jar path/to/aj-mcp-server.jar
- Optional: If you want to run via Spring Boot tooling, you can use:
mvn spring-boot:run -pl aj-mcp-server
- Configure via environment variables or a config file as described in the documentation (see MCP_CONFIG_PATH and MCP_LOG_LEVEL in the notes below).
Additional notes
Notes and tips:
- The project targets Java 8+ and supports Spring Boot 2.x. If you’re embedding the server in a larger Spring application, you can wire MCP components as Spring beans and manage lifecycle via the host app.
- Use the provided samples to understand how to define MCP models, contexts, and actions, and how to connect to data sources.
- Environment variables like MCP_CONFIG_PATH and MCP_LOG_LEVEL help control runtime behavior and logging without changing code.
- If you encounter classpath or dependency issues, ensure you’re building with the correct module scope and using compatible Java versions.
- For production deployments, consider containerizing the jar and configuring resource limits, logging, and health checks according to your orchestration platform.
Related MCP Servers
mcp-for-beginners
This open-source curriculum introduces the fundamentals of Model Context Protocol (MCP) through real-world, cross-language examples in .NET, Java, TypeScript, JavaScript, Rust and Python. Designed for developers, it focuses on practical techniques for building modular, scalable, and secure AI workflows from session setup to service orchestration.
xiaozhi-esp32 -java
小智ESP32的Java企业级管理平台,提供设备监控、音色定制、角色切换和对话记录管理的前后端及服务端一体化解决方案
turbomcp
A full featured, enterprise grade rust MCP SDK
springboot-ai -example
Example Spring AI Model Context Protocol (MCP)
vertx
A Vert.x MCP Server built on top of MCP Java SDK
solon-ai-embedded-examples
solon ai(&mcp) embedded examples。支持 MCP_2025_06_18(mcp streamable)。示例项目包括各种框架嵌入:(Solon、SpringBoot、jFinal、Vert.X、Quarkus、Micronaut)