dynamic-java-mcp-server
by gemo12123
Overview
Dynamically registers and exposes internal Java tools as HTTP APIs for AI models using the Model Context Protocol (MCP), enabling a single-process multi-MCP server setup.
Installation
mvn clean install && java -jar webmvc-dynamic-mcp-server/target/webmvc-dynamic-mcp-server-*.jarEnvironment Variables
- MCP_REGISTER_ENABLED
- MCP_REGISTER_MODULEID
- MCP_REGISTER_MODULENAME
- MCP_REGISTER_MODULEDESCRIPTION
- MCP_REGISTER_MODULEVERSION
- MCP_REGISTER_REPORT_ADDRESSSOURCE
- MCP_REGISTER_REPORT_FIXEDURLPREFIX
Security Notes
The `HttpExecutor` makes HTTP calls to dynamically configured service instances and paths. If `ModuleDefinition` (containing `ServiceInstance` and `ToolDefinitionWrapper`) is sourced from an untrusted or insufficiently validated external input, this could lead to Server-Side Request Forgery (SSRF) or arbitrary code execution via external tool calls. The `inputSchema` for tools, deserialized into `McpSchema.JsonSchema`, also presents a potential vector if not properly validated for malicious JSON content. No obvious hardcoded secrets or 'eval' equivalents were found in the truncated code, but the dynamic nature requires careful input sanitization and source validation.
Similar Servers
Unla
Transforms existing MCP Servers and APIs into MCP protocol-compliant endpoints through configuration, enabling LLM tool calling without code changes.
infobip-openapi-mcp
Exposes any OpenAPI documented HTTP API as a Model Context Protocol (MCP) server for AI agents, with support for mock mode and authentication.
spring-boot-ai
A Spring Boot application implementing a Model Context Protocol (MCP) server that provides a remote 'Booking Tool' for an AI agent.
MCP-Client-Host-Java
An MCP (Model Context Protocol) client that acts as a server to the MCP host, managing connections to various external MCP servers (tools) and orchestrating tool discovery and execution for AI assistants.