@kernlang/mcp-server
Give any AI agent the ability to write, compile, review, and self-correct .kern code through MCP.
What your agent gets
The KERN MCP server exposes the full compiler, reviewer, and language schema. An agent using this server can:
- Ask what it can write —
schemareturns the full language spec as JSON - Compile .kern to any target — Next.js, React, Vue, Express, FastAPI, MCP servers, and more
- Self-correct from errors —
compile-jsonreturns structured diagnostics with line numbers and suggestions - Review code — 98 static analysis rules with taint tracking and OWASP coverage
- Scan MCP servers — 12 security rules mapped to OWASP MCP Top 10
Quick start
Claude Desktop
Add to ~/Library/Application Support/Claude/claude_desktop_config.json:
{
"mcpServers": {
"kern": {
"command": "npx",
"args": ["@kernlang/mcp-server"]
}
}
}Cursor
Add to .cursor/mcp.json in your project:
{
"mcpServers": {
"kern": {
"command": "npx",
"args": ["@kernlang/mcp-server"]
}
}
}Claude Code
claude mcp add kern -- npx @kernlang/mcp-serverVS Code / Windsurf
Add to your MCP settings:
{
"kern": {
"command": "npx",
"args": ["@kernlang/mcp-server"]
}
}Hosted endpoint (no install)
KERN runs a live MCP server at https://kernlang.dev/api/mcp. Point any MCP client that supports Streamable HTTP at this URL — no npm install required.
Tools
| Tool | Description |
|---|---|
compile | Compile .kern source to any of 12 targets. Returns generated code. |
compile-json | Compile with structured JSON diagnostics (code, line, col, suggestion). For self-correction. |
schema | Full KERN language schema as JSON — node types, props, children, shorthands. |
review | Run 98 static analysis rules on TypeScript/JavaScript. Taint tracking, OWASP. |
review-kern | Lint .kern source for structural issues, missing props, pattern violations. |
review-mcp-server | Scan MCP server code for security vulnerabilities. 12 rules, OWASP MCP Top 10. |
parse | Parse .kern to intermediate representation (IR). For debugging. |
decompile | Convert IR back to readable .kern text. |
validate | Validate .kern syntax without compiling. |
list-targets | List all 12 compile targets with descriptions. |
list-nodes | Browse node types by category with props and allowed children. |
Resources
| URI | Description |
|---|---|
kern://spec | Full language specification — grammar, node types, shorthands, targets |
kern://examples/{category} | Example code by category: ui, api, state-machine, mcp, terminal |
kern://targets | Available compile targets as JSON |
Prompts
write-kernComprehensive system prompt that teaches an LLM how to write .kern code — grammar rules, node types, style shorthands, and annotated examples for UI, API, state machines, MCP servers, hooks, and type systems.
Self-correction loop
The schema and compile-json tools enable autonomous code generation:
1. schema → "what can I write?"
2. write .kern → generate code using schema
3. compile-json → "did I get it right?"
4. if errors:
read diagnostics (line, col, suggestion)
fix and goto 3
5. done — no human intervention neededEach diagnostic includes code, severity, line, col, endCol, and suggestion — everything an LLM needs to fix its own mistakes.
KERN syntax at a glance
KERN uses indent-based nesting with key=value props. Comments use // or #. Inline code uses <<< ... >>> blocks.
// Comments work with // or #
# This is also a comment
doc text="User management API"
server name=UserAPI port=3001
middleware name=cors
middleware name=json
route GET /api/users
auth required
handler <<<
const users = await db.query('SELECT * FROM users');
res.json(users);
>>>// State machine — 7 lines → 140+ lines TypeScript
machine name=Order initial=pending
transition from=pending to=confirmed event=confirm
transition from=confirmed to=shipped event=ship
transition from=shipped to=delivered event=deliver
transition from=pending to=cancelled event=cancelMCP Security in VS Code
The kern-mcp-security extension brings the 12 MCP security rules directly into your editor. Inline diagnostics for command injection, tool poisoning, path traversal, and more — no CLI needed.
ext install kernlang.kern-mcp-security