一个本地的MCP服务器,用于评估Pharo Smalltalk表达式并通过NeoConsole获取系统信息。
PHARO_DIR设置为你的Pharo安装目录(默认:~/pharo)NeoConsole.image在Pharo目录中可用git clone <repository-url>
cd pharo-nc-mcp-server
uv sync --dev
启动服务器:
uv run pharo-nc-mcp-server
{
"mcpServers": {
"pharo-nc-mcp-server": {
"command": "uv",
"args": [
"--directory",
"/your-path/to/pharo-nc-mcp-server",
"run",
"pharo-nc-mcp-server"
]
}
}
}
evaluate_smalltalk_with_neo_console使用NeoConsole执行Pharo中的Smalltalk表达式:
# 在MCP客户端中的示例用法
evaluate_smalltalk_with_neo_console(expression="42 factorial", command="eval")
evaluate_simple_smalltalk使用Pharo的简单-e选项执行Smalltalk表达式:
# 简单评估
evaluate_simple_smalltalk(expression="Time now")
get_pharo_metric从Pharo获取系统指标:
# 获取系统状态
get_pharo_metric(metric="system.status")
# 获取内存信息
get_pharo_metric(metric="memory.free")
get_class_comment获取Pharo类的注释:
# 获取Array类的注释
get_class_comment(class_name="Array")
get_class_definition获取Pharo类的定义:
# 获取Array类的定义
get_class_definition(class_name="Array")
get_method_list获取Pharo类的方法选择器列表:
# 获取Array类的所有方法选择器
get_method_list(class_name="Array")
get_method_source获取Pharo类中特定方法的源代码:
# 获取Array>>asSet方法的源代码
get_method_source(class_name="Array", selector="asSet")
PHARO_DIR:Pharo安装目录的路径(默认:~/pharo)# 格式化代码
uv run black pharo_nc_mcp_server/
# 检查代码
uv run ruff check pharo_nc_mcp_server/
# 运行测试
uv run python -m pytest
# 或使用测试脚本
./scripts/test.sh
项目包括几个方便的脚本在scripts/目录下:
scripts/format.sh通过一个命令格式化所有代码和文档文件:
./scripts/format.sh
scripts/test.sh使用pytest运行测试套件:
./scripts/test.sh