Validate and test llguidance grammars with batch testing and documentation
Copy the AI prompt to install this server into Claude Code, Cursor, or another agent β or use 1-click editor setup below.
We haven't yet run this listing's install command through our automated sandbox check. This isn't a red flag β we're steadily working through the catalog.
π‘ Paste the JSON block into your client's configuration file under mcpServers, then restart the application.
MCP server for validating and testing llguidance grammars (Lark format). Provides grammar validation, batch test execution, and syntax documentation β ideal for iteratively building grammars with AI coding assistants.
You can add the server using the interactive /mcp add command or by editing the config file directly. See the Copilot CLI MCP documentation for full details.
Option 1: Interactive setup
In the Copilot CLI, run /mcp add, select Local/STDIO, and enter uvx guidance-lark-mcp as the command.
Option 2: Edit config file
Add the following to ~/.copilot/mcp-config.json:
This gives you grammar validation and batch testing out of the box. To also enable LLM-powered generation (generate_with_grammar), add ENABLE_GENERATION and your credentials to env:
For Azure OpenAI (with Entra ID via az login), use guidance-lark-mcp[azure] and set the endpoint instead:
See Backend Configuration for all supported backends.
After saving, use /mcp show to verify the server is connected.
validate_grammar β Validate grammar completeness and consistency using llguidance's built-in validator.
run_batch_validation_tests β Run batch validation tests from a JSON file against a grammar. Returns pass/fail statistics and detailed failure info.
Test file format:
get_llguidance_documentation β Fetch the llguidance grammar syntax documentation from the official repo.
generate_with_grammar (optional, requires ENABLE_GENERATION=true) β Generate text using an OpenAI model constrained by a grammar. Uses the Responses API with custom tool grammar format, so output is guaranteed to conform to the grammar. Requires OPENAI_API_KEY environment variable. See Backend Configuration for Azure and other endpoints.
The generate_with_grammar tool uses the OpenAI Python SDK, which natively supports multiple backends via environment variables:
| Backend | Required env vars | Optional env vars |
|---|---|---|
| OpenAI (default) | OPENAI_API_KEY | OPENAI_MODEL |
| Azure OpenAI (API key) | AZURE_OPENAI_ENDPOINT, AZURE_OPENAI_API_KEY | AZURE_OPENAI_API_VERSION, OPENAI_MODEL |
| Azure OpenAI (Entra ID) | AZURE_OPENAI_ENDPOINT + az login | AZURE_OPENAI_API_VERSION, OPENAI_MODEL |
| Custom endpoint | OPENAI_API_KEY, OPENAI_BASE_URL | OPENAI_MODEL |
The server auto-detects which backend to use:
AZURE_OPENAI_ENDPOINT is set β uses AzureOpenAI client (with Entra ID or API key)OpenAI client (reads OPENAI_API_KEY and OPENAI_BASE_URL automatically)The server logs which backend it detects on startup.
Requires az login and the azure extra: pip install guidance-lark-mcp[azure]
Build a grammar iteratively with an AI assistant:
validate_grammar to check for missing rulesrun_batch_validation_tests to find failuresThe examples/ directory includes sample grammars built using these tools, with Lark grammar files, test suites, and documentation:
Server fails to connect in Copilot CLI / VS Code?
MCP clients like Copilot CLI only show "Connection closed" when a server crashes on startup. To see the actual error, run the server directly in your terminal:
Or with generation enabled:
Common issues:
ENABLE_GENERATION=true without a valid OPENAI_API_KEY or AZURE_OPENAI_ENDPOINT. The server will still start and serve validation tools; generate_with_grammar will return a descriptive error.az login and are using guidance-lark-mcp[azure] (not the base package).uvx needs to resolve and install dependencies on first run, which may exceed the MCP client's connection timeout. Run uvx guidance-lark-mcp once manually to warm the cache.uvx caches packages, so after a new release you may need to clear the cache and restart your MCP client:
No reviews yet β be the first to share how this listing worked for you.
Showcase your server listing on GitHub or your project documentation. Embed this dynamic SVG badge to highlight official listing status and live engagement.
[](https://allmcps.com/mcp/guidance-lark-mcp)<a href="https://allmcps.com/mcp/guidance-lark-mcp"><img src="https://allmcps.com/api/badge/guidance-lark-mcp?style=directory" alt="Guidance Lark MCP on AllMCPs" /></a>