关于 Smalltalk Validator Mcp Server
Smalltalk Validator Mcp Server 是用于在代码载入 Smalltalk 环境前检查 Tonel 格式代码的 MCP 服务,可验证文件、文本和方法体,并检查代码风格。
主要功能
- 01验证 Tonel 文件和文本
- 02检查 Smalltalk 方法语法
- 03检查 Tonel 源码风格
- 04可跳过方法体检查
适用场景
- 01载入前检查 AI 生成的 Tonel
- 02排查方法体语法错误
- 03发现 Tonel 源码风格问题
MCP 相关
向 MCP 客户端提供 Tonel Smalltalk 文件、文本和方法体的验证与检查工具。
配置
本地服务的配置在各客户端中通用,复制后粘贴到客户端的 MCP 配置文件即可。
工具
还没有获取到工具列表
本地服务需要在你的电脑上运行后才能读取工具,维护者暂未提供工具列表。
详细介绍
smalltalk-validator-mcp-server
一个简单的 MCP 服务,用于使用 tree-sitter-tonel-smalltalk 验证和检查 Tonel 格式的 Smalltalk 源代码。
- 我们希望在将 AI 生成的 Tonel 文件和 Smalltalk 方法定义加载到真实的 Smalltalk 环境之前,对其进行验证和检查。
工具
验证工具
validate_tonel_smalltalk_from_file(file_path, options)
- 验证文件中的 Tonel 格式 Smalltalk 源代码
validate_tonel_smalltalk(file_content, options)
- 验证内容字符串中的 Tonel 格式 Smalltalk 源代码
validate_smalltalk_method_body(method_body_content)
- 验证 Smalltalk 方法体的语法是否正确
验证选项
without-method-body: true
if true, it only validates tonel structure only (mainly for testing)
检查工具
lint_tonel_smalltalk_from_file(file_path)
- 检查文件中的 Tonel 格式 Smalltalk 源代码
lint_tonel_smalltalk(file_content)
- 检查内容字符串中的 Tonel 格式 Smalltalk 源代码
完整的检查列表请参阅 docs/lint-checks.md。
安装
快速安装(uvx)
无需克隆即可直接运行:
uvx --from git+https://github.com/mumez/smalltalk-validator-mcp-server.git@main smalltalk-validator-mcp-server
开发环境设置(git clone)
git clone https://github.com/mumez/smalltalk-validator-mcp-server.git
cd smalltalk-validator-mcp-server
uv sync
使用方法
运行 MCP 服务
- 使用 uvx(推荐快速运行):
uvx --from git+https://github.com/mumez/smalltalk-validator-mcp-server.git@main smalltalk-validator-mcp-server
- 从克隆的仓库运行:
uv run smalltalk-validator-mcp-server
配置示例
Cursor 配置
添加到你的 .cursor/settings.json:
{
"mcpServers": {
"smalltalk-validator": {
"command": "uvx",
"args": [
"--from",
"git+https://github.com/mumez/smalltalk-validator-mcp-server.git@main",
"smalltalk-validator-mcp-server"
]
}
}
}
如果你更愿意使用本地克隆,请改用以下配置:
{
"mcpServers": {
"smalltalk-validator": {
"command": "uv",
"args": [
"--directory",
"/path/to/smalltalk-validator-mcp-server",
"run",
"smalltalk-validator-mcp-server"
]
}
}
}
Claude Code 配置
添加到你的 Claude Code 设置中:
claude mcp add smalltalk-validator -- uvx --from git+https://github.com/mumez/smalltalk-validator-mcp-server.git@main smalltalk-validator-mcp-server
改用本地克隆:
claude mcp add smalltalk-validator -- uv --directory /path/to/smalltalk-validator-mcp-server run smalltalk-validator-mcp-server
工具使用示例
验证文件系统中的 Tonel 文件
# Validate a complete Tonel file with method bodies
validate_tonel_smalltalk_from_file("/path/to/MyClass.st")
# Validate only Tonel structure (without method body validation)
validate_tonel_smalltalk_from_file("/path/to/MyClass.st", {"without-method-body": true})
直接验证 Tonel 内容
tonel_content = """
Class {
#name : #MyClass,
#superclass : #Object,
#category : #'My-Package'
}
{ #category : #accessing }
MyClass >> getValue [
^ 42
]
"""
validate_tonel_smalltalk(tonel_content)
验证 Smalltalk 方法体
method_body = "^ self name asUppercase"
validate_smalltalk_method_body(method_body)
检查文件系统中的 Tonel 文件
# Lint a Tonel file for best practices and style issues
result = lint_tonel_smalltalk_from_file("/path/to/MyClass.st")
# Example result:
# {
# "success": true,
# "file_path": "/path/to/MyClass.st",
# "issue_list": [
# {
# "severity": "warning",
# "message": "Method 'longMethod' long: 18 lines (recommended: 15)",
# "class_name": "MyClass",
# "selector": "longMethod",
# "is_class_method": false,
# "reference_url": "https://github.com/mumez/smalltalk-validator-mcp-server/blob/main/docs/lint-checks.md#method-too-long"
# }
# ],
# "issues_count": 1,
# "warnings_count": 0,
# "errors_count": 0
# }
直接检查 Tonel 内容
tonel_content = """
Class {
#name : #MyClass,
#superclass : #Object,
#instVars : [
'name',
'age'
],
#category : #'My-Package'
}
{ #category : #accessing }
MyClass >> getName [
^ name
]
"""
result = lint_tonel_smalltalk(tonel_content)
开发
# Install dependencies
uv sync
# Run tests
uv run pytest
# Lint and format
uv run ruff check
uv run ruff format
# Install pre-commit hooks
uv run pre-commit install
评论
支持 Markdown
一个开放协议,规定了 AI 应用如何以统一方式连接外部工具与数据源。客户端负责与模型对话,MCP 服务负责提供工具、资源和提示模板,两者通过标准消息通信,同一个服务可以被不同客户端复用。