A Zig-based MCP (Model Context Protocol) server providing language intelligence for the Klar programming language. This server enables Claude Code to understand, analyze, and navigate Klar codebases.
- Type Checking (
klar_check) - Validate Klar code and get diagnostics - Hover Information (
klar_hover) - Get type and documentation info at any position - Go to Definition (
klar_definition) - Jump to symbol definitions - Find References (
klar_references) - Find all usages of a symbol - Document Symbols (
klar_symbols) - List all symbols in a file - Code Completion (
klar_completions) - Get intelligent code suggestions
- Zig 0.15 or later
- macOS, Linux, or Windows
-
Clone the repository:
git clone https://github.com/your-username/MCP-Klar.git cd MCP-Klar -
Build the server:
./build.sh
Or manually:
zig build -Doptimize=ReleaseSafe
-
The binary will be at
zig-out/bin/mcp-klar
./run-tests.sh| Variable | Description |
|---|---|
KLAR_STD_PATH |
Path to the Klar standard library |
KLAR_VERBOSE |
Set to 1, true, or yes to enable verbose output |
Create a klar.json file in your project root:
{
"std_path": "/path/to/klar/std",
"project_root": ".",
"source_dirs": ["src", "lib"],
"verbose": false
}Configuration precedence (highest to lowest):
- Environment variables
klar.jsonfile- Default values
Add the server to your Claude Code MCP configuration:
{
"mcpServers": {
"klar": {
"command": "/path/to/mcp-klar"
}
}
}Type check a Klar file and return diagnostics.
Parameters:
file(string, required) - Path to the .kl filecontent(string, optional) - File content override for unsaved buffers
Get type and documentation information for a symbol at a position.
Parameters:
file(string, required) - Path to the .kl fileline(integer, required) - Line number (1-indexed)column(integer, required) - Column number (1-indexed)content(string, optional) - File content override for unsaved buffers
Go to the definition of a symbol at a position.
Parameters:
file(string, required) - Path to the .kl fileline(integer, required) - Line number (1-indexed)column(integer, required) - Column number (1-indexed)content(string, optional) - File content override for unsaved buffers
Find all references to a symbol at a position.
Parameters:
file(string, required) - Path to the .kl fileline(integer, required) - Line number (1-indexed)column(integer, required) - Column number (1-indexed)content(string, optional) - File content override for unsaved buffersinclude_definition(boolean, optional) - Include the definition in results
List all symbols in a Klar file.
Parameters:
file(string, required) - Path to the .kl filecontent(string, optional) - File content override for unsaved bufferskind(string, optional) - Filter by symbol kind (function, struct, enum, variable, etc.)
Get code completions at a position in a Klar file.
Parameters:
file(string, required) - Path to the .kl fileline(integer, required) - Line number (1-indexed)column(integer, required) - Column number (1-indexed)content(string, optional) - File content override for unsaved buffersprefix(string, optional) - Prefix to filter completions
Returns comprehensive documentation for the Klar standard library.
Returns the project directory structure, listing all .kl files.
- Ensure Zig 0.15+ is installed:
zig version - Rebuild from source:
./build.sh - Check that the binary exists:
ls -la zig-out/bin/mcp-klar
- Ensure the file path is correct and accessible
- Check that the file has a
.klextension - Try using the
contentparameter with the file contents
Set the KLAR_STD_PATH environment variable or configure it in klar.json.
MIT