antlr4-mcp-server

sshailabh/antlr4-mcp-server

3.3

If you are the rightful owner of antlr4-mcp-server and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to dayong@mcphub.com.

The ANTLR4 MCP Server enables AI assistants to assist in developing ANTLR4 grammars through natural conversation.

ANTLR4 MCP Server

MCP server enabling AI assistants to help with ANTLR4 grammar development.

Java ANTLR


Quick Start

Docker (Recommended)

docker pull sshailabh1/antlr4-mcp-server:latest

Configure your MCP client:

{
  "mcpServers": {
    "antlr4": {
      "command": "docker",
      "args": ["run", "-i", "--rm", "sshailabh1/antlr4-mcp-server:latest"]
    }
  }
}

Build from Source

./mvnw clean package -DskipTests
{
  "mcpServers": {
    "antlr4": {
      "command": "java",
      "args": ["-jar", "/path/to/antlr4-mcp-server-0.2.0.jar"]
    }
  }
}

Tools

ToolPurpose
validate_grammarSyntax validation with error suggestions
parse_sampleParse input, return tree (interpreter mode)
detect_ambiguityFind parsing ambiguities
analyze_left_recursionDetect recursion patterns
analyze_first_followCompute FIRST/FOLLOW sets
analyze_call_graphRule dependencies, cycles, unused rules
visualize_atnATN state diagrams (DOT/Mermaid)
compile_grammar_multi_targetGenerate parsers (10 languages)
profile_grammarPerformance profiling

Usage Example

Validate and parse "2 + 3 * 4":

grammar Calc;
expr: expr ('*'|'/') expr | expr ('+'|'-') expr | NUMBER ;
NUMBER: [0-9]+ ;
WS: [ \t\r\n]+ -> skip ;

Target Languages

Java, Python, JavaScript, TypeScript, C++, C#, Go, Swift, PHP, Dart


Documentation

DocumentPurpose
Setup in 5 minutes
Complete tool reference
Build, test, contribute
Calculator, JSON grammars

Constraints

ConstraintValue
Max grammar size10 MB
Max input size1 MB
Timeout30 seconds
ImportsNot supported (inline all rules)

License

Apache License 2.0