Let your AI write Clean, and check it

The compiler includes an MCP server. Connect it once, and your AI assistant can look up the syntax, type-check its own code and fix errors before you ever see them.

command cln mcp-server
Why it matters

The AI checks its work before you do

AI assistants guess at languages they haven't seen much. With the MCP server, they don't have to guess: they read the real syntax reference and run the real type checker.

Clean was designed for this. Its syntax is small and regular, its types are checked before code runs, and its errors say exactly what to fix. That gives an AI a tight loop: write, check, fix.

What the assistant does
1. get_quick_reference   learn the syntax
2. write the code
3. check                 type-check it
4. explain_error         read what's wrong
5. fix and check again   until it passes
6. compile               produce WebAssembly
Tutorial · 2 minutes

Connect your assistant

1

Install Clean

The MCP server is part of the compiler, so installing Clean is enough. See Install.

2

Print the settings for your tool

Pick your tool: claude-code, claude-desktop, cursor or vscode. The command prints the exact settings for your machine and says where to put them.

Terminal
cln mcp-config --format claude-code
.mcp.json (example output)
{
  "mcpServers": {
    "clean-language": {
      "command": "/home/you/.cleen/bin/cln",
      "args": ["mcp-server"]
    }
  }
}
3

Ask for something

Restart your assistant and ask it to write Clean code, for example "write a Clean function that averages a list of numbers, and check it". It will call the Clean tools on its own.

What the AI can do

Tools the server offers

ToolWhat the assistant uses it for
get_quick_referenceLearn the syntax, types and common patterns before writing
checkType-check code fast, without building
compileBuild code into WebAssembly
explain_errorRead a plain explanation of an error code and how to fix it
diagnosticsGet every error and warning with its exact location
parseSee how the compiler reads a piece of code
get_specificationLook up the exact rules of the language
list_functions, list_types, list_builtinsFind what's available instead of guessing
list_pluginsLearn the Frame blocks for servers, data and pages
list_error_codesBrowse every error the compiler can report
Tutorials

Learn it step by step

Short lessons that build on each other. Each one ends with code you can run.

Going further

AI in your own apps

Give AI agents your app's tools

The frame.mcp plugin turns your Frame app into an MCP server, so agents can call its tools and read its data.

A map for AI crawlers

This site publishes llms.txt, a short guide AI tools read to find the docs.

Why Clean suits AI

The research behind the design: what makes a language easy for AI.

Questions

Common questions

Which assistants work with it?

Any assistant that supports MCP, the Model Context Protocol. That includes Claude Code, Claude Desktop, Cursor and VS Code.

Does my code leave my machine?

The MCP server runs locally and checks code on your machine. What your assistant sends to its own AI service is up to that assistant.

Do I need to start the server myself?

No. Your assistant starts cln mcp-server when it needs it, using the settings from cln mcp-config.

Can I learn Clean with an AI?

Yes. The last lesson of First Steps shows how: Your AI coding partner.

Want the app without the code?

Clean Studio is an AI that writes Clean for you. Describe the app, approve each change, and publish.

Copied!