
Guidance Lark Mcp
io.github.guidance-aiPublished by GitHub account guidance-aiv0.1.2Updated Oct 24, 2026
Validate and test llguidance grammars with batch testing and documentation
Overview
Local MCP server for validating and batch-testing llguidance Lark grammars, with syntax docs and optional grammar-constrained generation.
- What you can do
- Validate a Lark grammar for completeness and consistency with llguidance's validator
- Run batch validation tests from a JSON test file against a grammar and get pass/fail statistics with failure details
- Fetch the llguidance grammar syntax documentation from the official repository
- Optionally generate text with an OpenAI-compatible model constrained by a grammar, so output conforms to it
- When to use it
- Useful when iteratively building or debugging llguidance Lark grammars with an AI assistant, for example translating rules from a language spec and checking them against sample inputs until all tests pass.
- Requirements
- Runs locally over stdio as a Python package, launched with uvx or pip install. Grammar validation, batch testing and documentation need no credentials. The optional generation tool requires ENABLE_GENERATION=true plus OPENAI_API_KEY, or Azure OpenAI settings such as AZURE_OPENAI_ENDPOINT and AZURE_OPENAI_API_KEY, or az login with the azure extra. Network access is needed to fetch documentation and to call the model backend.
Installation
In SourceWeft
- Open Guidance Lark Mcp in the dashboard and add it to a workspace.
- Enable the server for the chats that should use its tools.
Desktop only via STDIO. STDIO servers start a local process, so they need the SourceWeft desktop host.
Other MCP clients
Follow the launch instructions in the repository.
README
MCP Grammar Tools
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.
Installation
With uvx (recommended)
With pip
From source
MCP Client Configuration
GitHub Copilot CLI
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.
VS Code
Claude Desktop
Usage
Available Tools
-
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, requiresENABLE_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. RequiresOPENAI_API_KEYenvironment variable. See Backend Configuration for Azure and other endpoints.
Backend Configuration
The generate_with_grammar tool uses the OpenAI Python SDK, which natively supports multiple backends via environment variables:
The server auto-detects which backend to use:
- If
AZURE_OPENAI_ENDPOINTis set → usesAzureOpenAIclient (with Entra ID or API key) - Otherwise → uses
OpenAIclient (readsOPENAI_API_KEYandOPENAI_BASE_URLautomatically)
The server logs which backend it detects on startup.
Example: Azure OpenAI (API key)
Example: Azure OpenAI (Entra ID / keyless)
Requires az login and the azure extra: pip install guidance-lark-mcp[azure]
Example Workflow
Build a grammar iteratively with an AI assistant:
- Start with the spec — paste EBNF rules from a language specification
- Write a basic grammar — translate a few rules to Lark format
- Validate — use
validate_grammarto check for missing rules - Write tests — create a JSON test file with sample inputs
- Batch test — use
run_batch_validation_teststo find failures - Fix & repeat — refine the grammar until all tests pass
Example Grammars
The examples/ directory includes sample grammars built using these tools, with Lark grammar files, test suites, and documentation:
- GraphQL — executable subset of the GraphQL spec (queries, mutations, fragments, variables)
Troubleshooting
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:
- Missing credentials —
ENABLE_GENERATION=truewithout a validOPENAI_API_KEYorAZURE_OPENAI_ENDPOINT. The server will still start and serve validation tools;generate_with_grammarwill return a descriptive error. - Azure Entra ID — make sure you've run
az loginand are usingguidance-lark-mcp[azure](not the base package). - Slow first start —
uvxneeds to resolve and install dependencies on first run, which may exceed the MCP client's connection timeout. Runuvx guidance-lark-mcponce manually to warm the cache. - Updating to a new version —
uvxcaches packages, so after a new release you may need to clear the cache and restart your MCP client:
Development
Source: README.md at commit 65f1350
Tools
0Version history
1- v0.1.2LatestSep 16, 2026
Score
50% of the applicable checks met
How complete this listing is, computed from the registry entry, the endpoint and public sources. Not a rating of the server and not a statement that it is safe or working today: reachability is a dated check, and no installs or reviews go into the score.
- Reached in the last 30 days25 pts
Keep the endpoint answering the MCP handshake; SourceWeft probes it every 30 days.
- Auth declared10 pts
Declare the credential headers in the registry entry, or keep the endpoint answering the probe so its auth can be classified.
- Tools listed15 pts
Answer tools/list without a credential, or ship a package that starts in a sandbox without one.
- DescriptionRequired15 pts
- Logo10 pts
- Documentation15 pts
- License10 pts