Tolk MCP Server

io.github.oxgeneral由 GitHub 账号 oxgeneral 发布v1.0.0更新于 Oct 24, 2026

MCP server for the Tolk smart contract compiler. Compile, validate, and explore TON contracts.

已验证STDIO仅桌面开发者工具AI 与机器学习

概览

AI 生成的概览

让助手编译、检查语法并探索 TON 区块链的 Tolk 智能合约。

可以做什么
把 Tolk 智能合约编译器封装为 MCP 工具:get_compiler_version 返回编译器版本,compile_tolk 将 Tolk 源码编译为 Fift 汇编、base64 编码的 BoC 和代码哈希,check_tolk_syntax 做快速语法校验并给出行列错误信息。它还提供 Tolk 语言参考以及 hello-world、wallet、jetton 示例等资源,以及用于编写和审查合约的引导提示。编译选项包括优化级别、栈注释和实验性标志。
适用场景
适合用 Tolk 开发 TON 智能合约、希望助手在对话中直接编译或校验代码的场景。可用于合约编写、部署前的快速语法检查,以及审查或优化现有合约。
运行要求
通过 stdio 在本地运行,需要 Node.js 18 或更高版本;README 建议用 npx 启动,或从源码执行 npm install 与 npm run build 构建。未声明任何账号、API 密钥或环境变量。
安装前请注意
编译结果包含可部署的 BoC 代码和代码哈希,上链部署前应自行审查生成的合约。README 中的审查提示只是辅助,不能替代独立的安全审计。

安装

在 SourceWeft 中

  1. 打开 控制台中的 Tolk MCP Server,将其添加到工作区。
  2. 为需要使用其工具的对话启用该服务。

Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。

其他 MCP 客户端

参照 仓库 中的启动说明。

README

tolk-mcp-server

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.).

Features

Tools:

  • get_compiler_version — Returns the Tolk compiler version
  • compile_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 output

Resources:

  • tolk://reference — Tolk language quick reference (syntax, types, differences from FunC)
  • tolk://examples/hello-world — Counter contract example
  • tolk://examples/wallet — Wallet contract example
  • tolk://examples/jetton — Jetton (token) contract skeleton

Prompts:

  • write_smart_contract — Guided prompt for writing a new TON smart contract
  • review_smart_contract — Guided prompt for security review and optimization analysis

Quick Start

Claude Desktop

Add to claude_desktop_config.json:

json
{  "mcpServers": {    "tolk": {      "command": "npx",      "args": ["-y", "tolk-mcp-server"]    }  }}

Cursor / Windsurf

Add to your MCP settings:

json
{  "tolk": {    "command": "npx",    "args": ["-y", "tolk-mcp-server"]  }}

From Source

bash
git clone https://github.com/oxgeneral/tolk-mcp-server.gitcd tolk-mcp-servernpm installnpm run buildnpm start

Usage Examples

Compile a contract

> 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:

  • Fift assembly code
  • BoC (Bag of Cells) in base64 — ready for deployment
  • Code hash — unique identifier of the compiled code
  • Warnings (if any)

Check syntax quickly

> Use check_tolk_syntax to validate my contract before deploying

Returns OK + code hash, or a detailed error with line/column info.

Multi-file contracts

Pass all files in the sources parameter:

json
{  "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.

Compiler Options

OptionTypeDefaultDescription
optimizationLevel0-220 = none, 1 = basic, 2 = full
withStackCommentsboolfalseAdd stack layout comments to Fift output
experimentalOptionsstring""Space-separated experimental compiler flags

Requirements

  • Node.js >= 18
  • No external dependencies beyond npm packages

Development

bash
npm installnpm run dev    # Run with tsx (hot reload)npm run build  # Compile TypeScriptnpm test       # Run tests

License

MIT

来源:README.md,提交 b489bcf

工具

0
SourceWeft 尚未在沙箱中启动过该软件包,因此其工具未知。

版本历史

1
  1. v1.0.0最新Sep 16, 2026

评分

已满足适用检查项的 40%

该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。

  • 近 30 天内可连通25 分

    请保持端点能够响应 MCP 握手;SourceWeft 每 30 天探测一次。

  • 已声明认证方式10 分

    请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。

  • 已列出工具15 分

    请让服务器在无凭据时响应 tools/list,或发布可在沙箱中无凭据启动的软件包。

  • 描述必需15 分
  • 图标10 分
  • 文档15 分
  • 许可证10 分

    请在仓库或注册中心条目中声明许可证。