Spring Jetty MCP Server
No description available
Ask AI about Spring Jetty MCP Server
Powered by Claude Β· Grounded in docs
I know everything about Spring Jetty MCP Server. Ask me about installation, configuration, usage, or troubleshooting.
0/500
Reviews
Documentation
π Spring MCP Server (Jetty + Maven)
A lightweight Model Context Protocol (MCP) Server built using Spring Framework and deployed on Jetty, running as part of a traditional Java web application.
This project enables dynamic tool execution via MCP using annotation-driven registration and a servlet-based request pipeline.
π Features
- β Custom MCP server implementation
- β Annotation-based tool definitions
- β
Servlet-based request handling (
/mcp) - β Maven + Jetty integration
- β Lightweight and deployable as WAR
- β Easy to extend with new tools
π οΈ Tech Stack
- Java 17+
- Spring Framework (XML-based configuration)
- Maven
- Jetty Server
- Servlet API
π Project Structure
src/
βββ main/
βββ java/com/spring/
β βββ mcp/ # MCP core logic
β βββ demo/ # Sample controller
β βββ ...
βββ resources/
β βββ spring/ # Spring XML configs
βββ webapp/
βββ WEB-INF/
βββ web.xml
βΆοΈ Running Locally
1. Clone the Repository
git clone https://github.com/your-username/your-repo.git
cd your-repo
2. Build the Project
mvn clean install
3. Run Using Jetty
mvn jetty:run
4. Access Application
http://localhost:8080
π‘ MCP Endpoint
POST /mcp
All MCP requests are handled via:
McpDelegatingServlet
π§ͺ Adding a New Tool
Create a method using annotations:
@McpTool(name = "exampleTool")
public String example(
@McpToolParam(name = "input") String input
) {
return "Processed: " + input;
}
Thatβs it β the tool will be automatically registered at startup.
π Deployment
π¦ Build WAR File
mvn clean package
WAR file will be generated in:
target/your-app-name.war
π Deploy on Jetty (Standalone)
Option 1: Using Jetty Home
- Copy WAR file:
cp target/your-app-name.war <JETTY_HOME>/webapps/
- Start Jetty:
java -jar start.jar
Option 2: Using Embedded Jetty (Already configured)
mvn jetty:run
π³ Docker Deployment (Optional)
# Build image
docker build -t mcp-server .
# Run container
docker run -p 8080:8080 mcp-server
π Detailed Explanation
π For deep dive into architecture, tool registration, and MCP flow:
π Configuration Notes
-
Update Spring configs in:
application-context.xmldispatcher-servlet.xml
-
Avoid committing sensitive data
π§© Extending the Project
- Add new tools via annotations
- Plug in caching (Redis / Memcached)
- Add authentication layer
- Enable async / streaming execution
π License
MIT License
π¨βπ» Author
Mangesh Patil Backend Engineer | Java | Spring | System Design
