Bridges the Tolk smart contract compiler directly into Claude and other MCP clients for TON blockchain development. You get three compilation tools: full compile to Fift assembly and BoC, quick syntax checks, and compiler version lookup. Resources include language references and contract examples for counters, wallets, and jettons. Two guided prompts walk you through writing new contracts or reviewing existing ones for security and optimization. Handles multi-file projects with automatic stdlib resolution and exposes full compiler options including optimization levels and experimental flags. Reach for this when you're developing TON contracts and want compilation feedback without leaving your AI assistant.
MCP server for the Tolk smart contract compiler. Compile, validate, and explore TON smart contracts from any MCP-compatible AI assistant (Claude Desktop, Cursor, Windsurf, etc.).
Tools:
get_compiler_version — Returns the Tolk compiler versioncompile_tolk — Compiles Tolk source code to Fift + BoC with full compiler options (optimization level, stack comments, experimental flags)check_tolk_syntax — Quick syntax validation without full outputResources:
tolk://reference — Tolk language quick reference (syntax, types, differences from FunC)tolk://examples/hello-world — Counter contract exampletolk://examples/wallet — Wallet contract exampletolk://examples/jetton — Jetton (token) contract skeletonPrompts:
write_smart_contract — Guided prompt for writing a new TON smart contractreview_smart_contract — Guided prompt for security review and optimization analysisAdd to claude_desktop_config.json:
{
"mcpServers": {
"tolk": {
"command": "npx",
"args": ["-y", "tolk-mcp-server"]
}
}
}
Add to your MCP settings:
{
"tolk": {
"command": "npx",
"args": ["-y", "tolk-mcp-server"]
}
}
git clone https://github.com/oxgeneral/tolk-mcp-server.git
cd tolk-mcp-server
npm install
npm run build
npm start
> Use the compile_tolk tool to compile this contract:
fun onInternalMessage(myBalance: int, msgValue: int, msgFull: cell, msgBody: slice) {
}
get fun hello(): int {
return 42;
}
The tool returns:
> Use check_tolk_syntax to validate my contract before deploying
Returns OK + code hash, or a detailed error with line/column info.
Pass all files in the sources parameter:
{
"entrypointFileName": "main.tolk",
"sources": {
"main.tolk": "import \"./utils.tolk\";\nfun onInternalMessage(...) { ... }",
"utils.tolk": "fun helper(): int { return 1; }"
}
}
Standard library imports (@stdlib/*) are resolved automatically by the compiler.
| Option | Type | Default | Description |
|---|---|---|---|
optimizationLevel | 0-2 | 2 | 0 = none, 1 = basic, 2 = full |
withStackComments | bool | false | Add stack layout comments to Fift output |
experimentalOptions | string | "" | Space-separated experimental compiler flags |
npm install
npm run dev # Run with tsx (hot reload)
npm run build # Compile TypeScript
npm test # Run tests
MIT