antlr4
ANTLR4 MCP Server
claude mcp add --transport stdio sshailabh-antlr4-mcp-server docker run -i --rm sshailabh1/antlr4-mcp-server:latest
How to use
This MCP server provides tooling to assist with ANTLR4 grammar development. It exposes a collection of capabilities including syntax validation, parse tree generation, ambiguity detection, left recursion analysis, FIRST/FOLLOW set computation, call graph analysis, ATN visualization, multi-target parser generation, and performance profiling. Use the docker-based deployment shown in the Quick Start to run the server, then interact with the available tools through your MCP client by sending requests that reference the tools by name (e.g., validate_grammar, parse_sample, detect_ambiguity, analyze_left_recursion, analyze_first_follow, analyze_call_graph, visualize_atn, compile_grammar_multi_target, profile_grammar). The server is designed to work with grammars written in ANTLR4 syntax and can output results in machine-friendly formats suitable for integration into IDEs or CI pipelines.
How to install
Prerequisites:
- Docker installed and running (recommended).
- Optional: Java Runtime if you build from source or use a Java-based run method.
Using Docker (recommended):
- Install Docker according to your OS guidelines.
- Pull and run the MCP server image: docker pull sshailabh1/antlr4-mcp-server:latest docker run -i --rm sshailabh1/antlr4-mcp-server:latest
Alternative: Build from source (if you prefer to run locally without Docker):
- Ensure Java and Maven are installed (or use the provided Maven wrapper in the project).
- Clone the repository and navigate to the project root.
- Build the project: ./mvnw clean package -DskipTests
- Run the jar produced in target, for example: java -jar target/antlr4-mcp-server-<version>.jar
Configuration example (via MCP client):
- If using Docker, your MCP client should reference the docker command as shown in the Quick Start: { "mcpServers": { "antlr4": { "command": "docker", "args": ["run", "-i", "--rm", "sshailabh1/antlr4-mcp-server:latest"] } } }
Additional notes
Tips and considerations:
- The server enforces constraints such as max grammar size (10 MB) and max input size (1 MB) with a 30-second timeout. Adjust inputs accordingly or consider streaming results if supported by your client.
- If you encounter issues with Docker networking or image pulls, ensure your environment has proper network access and Docker daemon is running.
- The Tools table lists available capabilities; use tool usage documentation in docs/TOOL_USAGE.md (if provided in your deployment) for detailed request schemas and example payloads.
- Environment-specific settings (e.g., memory limits for Docker) may impact performance; allocate ample resources for large grammars or complex analyses.
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.
jadx-ai
Plugin for JADX to integrate MCP server
drift
Codebase intelligence for AI. Detects patterns & conventions + remembers decisions across sessions. MCP server for any IDE. Offline CLI.
mcp-java-sdk-examples
A collection of MCP server examples developed by various Java SDKs
mcp-annotated-java-sdk
Annotation-driven MCP dev 🚀 No Spring, Zero Boilerplate, Pure Java
chattender-fahrplan
timetable for llms