A Model Context Protocol (MCP) server for managing Gradle-based Tomcat applications with log querying capabilities.
- Process Management: Start, stop, restart, and monitor Tomcat processes via Gradle
- Log Management: Capture, store, and query application logs with filtering
- Real-time Monitoring: Stream logs and process status updates
- MCP Integration: Full integration with Claude and other MCP clients
npm install -g mcp-gradle-tomcat
npm install mcp-gradle-tomcat
git clone https://github.com/your-username/mcp-gradle-tomcat.git
cd mcp-gradle-tomcat
npm install
Add this to your Claude configuration file (~/.claude/config.json
):
{
"mcpServers": {
"gradle-tomcat": {
"command": "mcp-gradle-tomcat",
"env": {
"GRADLE_WORKING_DIR": "/path/to/your/gradle/project"
}
}
}
}
Once configured, you can use these commands in Claude:
- "Start Tomcat" - Launches your Gradle application
- "Stop Tomcat" - Gracefully stops the running application
- "Get Tomcat status" - Shows process status and uptime
- "Get recent logs" - Retrieves application logs with filtering
- "Restart Tomcat" - Stops and starts the application
# Set your project directory
export GRADLE_WORKING_DIR="/path/to/your/gradle/project"
# Run the MCP server
mcp-gradle-tomcat
# Test individual tools
npm test
Configuration can be set via environment variables:
GRADLE_WORKING_DIR
: Working directory for Gradle commands (default: current directory)GRADLE_COMMAND
: Gradle command to run (default: appRun)TOMCAT_PORT
: Expected Tomcat port (default: 8080)MAX_LOG_BUFFER_SIZE
: Maximum log entries in memory (default: 1000)LOG_DIR
: Directory for log files (default: ./logs)
Launch Tomcat via Gradle
gradle_command
(optional): Gradle command to runworking_directory
(optional): Working directory
Terminate Tomcat process
force
(optional): Force termination with SIGKILL
Stop and start Tomcat
force
(optional): Force termination during stopgradle_command
(optional): Gradle command for restart
Check Tomcat process status
- No parameters
Retrieve log entries
lines
(optional): Number of recent log lines (default: 100)level
(optional): Minimum log level (DEBUG, INFO, WARN, ERROR)since
(optional): ISO 8601 timestamp to filter fromsource
(optional): Filter by source (stdout, stderr)
Clear log buffer and files
confirm
(required): Must be true to confirm
src/
├── server.js # Main MCP server
├── process-manager.js # Tomcat lifecycle management
├── log-manager.js # Log capture and querying
├── tools/ # MCP tool implementations
└── config.js # Configuration management
MIT