pharo-smalltalk-interop-mcp-server
This server provides a local MCP interface to interact with a Pharo Smalltalk image, offering 22 tools for code evaluation, introspection, search, package management, project installation, test execution, UI debugging, and server configuration.
Code Evaluation: Execute arbitrary Smalltalk expressions via
eval.Code Introspection: Retrieve source code for classes (
get_class_source), methods (get_method_source), and class comments (get_class_comment).Search & Discovery: Find classes (
search_classes_like), methods (search_methods_like), traits (search_traits_like), implementors (search_implementors), references to methods or symbols (search_references), and references to classes (search_references_to_class).Package Management: List packages (
list_packages), classes in a package (list_classes), extended classes (list_extended_classes), and methods in a package (list_methods); export (export_package) and import (import_package) packages in Tonel format.Project Installation: Install projects via Metacello with optional load groups (
install_project).Test Execution: Run test suites at package (
run_package_test) or class (run_class_test) level.UI Debugging: Capture screenshots and inspect UI structure for World morphs, Spec presenters, and Roassal visualizations using
read_screen, with options to specify target type and screenshot capture.Server Configuration: Retrieve (
get_settings) and dynamically modify (apply_settings) server settings, includingstackSizeand custom key-value pairs.
pharo-smalltalk-interop-mcp-server
⚠️ This project has moved. Starting with v4.0.0, development has moved to smalltalk-interop-mcp-server, which adds support for Squeak's SIS server in addition to Pharo. Please use the new repository for the latest features and updates; this repository is kept for historical reference only.
A local MCP server to communicate local Pharo Smalltalk image. It supports:
Code Evaluation: Execute Smalltalk expressions and return results
Code Introspection: Retrieve source code, comments, and metadata for classes and methods
Search & Discovery: Find classes, traits, methods, references, and implementors
Package Management: Export and import packages in Tonel format
Project Installation: Install projects using Metacello
Test Execution: Run test suites at package or class level
UI Debugging: Capture screenshots and inspect UI structure for World morphs, Spec presenters, and Roassal visualizations
Server Configuration: Retrieve and modify server settings dynamically
Prerequisites
Python 3.10 or later
uv package manager
Pharo with PharoSmalltalkInteropServer installed
Related MCP server: mcp-server-code-runner
Installation
Quick Start (using uvx)
The easiest way to run the server without cloning the repository:
uvx --from git+https://github.com/mumez/pharo-smalltalk-interop-mcp-server.git pharo-smalltalk-interop-mcp-serverDevelopment Installation
To set up for development:
Clone the repository:
git clone https://github.com/mumez/pharo-smalltalk-interop-mcp-server.gitInstall dependencies using uv:
cd pharo-smalltalk-interop-mcp-server
uv sync --devUsage
Running the MCP Server
Using uvx (no installation required):
uvx --from git+https://github.com/mumez/pharo-smalltalk-interop-mcp-server.git pharo-smalltalk-interop-mcp-serverUsing uv (after cloning the repository):
uv run pharo-smalltalk-interop-mcp-serverEnvironment Variables
You can configure the server using environment variables:
PHARO_SIS_PORT: Port number for PharoSmalltalkInteropServer (default: 8086)
Examples:
Using uvx:
PHARO_SIS_PORT=8086 uvx --from git+https://github.com/mumez/pharo-smalltalk-interop-mcp-server.git pharo-smalltalk-interop-mcp-serverUsing uv:
PHARO_SIS_PORT=9999 uv run pharo-smalltalk-interop-mcp-serverCursor MCP settings
Using uvx (recommended):
{
"mcpServers": {
"smalltalk-interop": {
"command": "uvx",
"args": [
"--from",
"git+https://github.com/mumez/pharo-smalltalk-interop-mcp-server.git",
"pharo-smalltalk-interop-mcp-server"
],
"env": {
"PHARO_SIS_PORT": "8086"
}
}
}
}Using uv (after cloning):
{
"mcpServers": {
"smalltalk-interop": {
"command": "uv",
"args": [
"--directory",
"/your-path/to/pharo-smalltalk-interop-mcp-server",
"run",
"pharo-smalltalk-interop-mcp-server"
],
"env": {
"PHARO_SIS_PORT": "8086"
}
}
}
}Note: The env section is optional and can be used to set environment variables for the MCP server.
Claude Code Configuration
Using uvx (recommended):
claude mcp add -s user smalltalk-interop -- uvx --from git+https://github.com/mumez/pharo-smalltalk-interop-mcp-server.git pharo-smalltalk-interop-mcp-serverUsing uv (after cloning):
claude mcp add -s user smalltalk-interop -- uv --directory /path/to/pharo-smalltalk-interop-mcp-server run pharo-smalltalk-interop-mcp-serverMCP Tools Available
This server provides 22 MCP tools that map to all PharoSmalltalkInteropServer APIs:
Code Evaluation
eval: Execute Smalltalk expressions and return results
Code Introspection
get_class_source: Retrieve source code of a classget_method_source: Retrieve source code of a specific methodget_class_comment: Retrieve comment/documentation of a class
Search & Discovery
search_classes_like: Find classes matching a patternsearch_methods_like: Find methods matching a patternsearch_traits_like: Find traits matching a patternsearch_implementors: Find all implementors of a method selectorsearch_references: Find all references to a method selectorsearch_references_to_class: Find all references to a class
Package Management
list_packages: List all packages in the imagelist_classes: List classes in a specific packagelist_extended_classes: List extended classes in a packagelist_methods: List methods in a packageexport_package: Export a package in Tonel formatimport_package: Import a package from specified path
Project Installation
install_project: Install a project using Metacello with optional load groups
Test Execution
run_package_test: Run test suites for a packagerun_class_test: Run test suites for a specific class
UI Debugging
read_screen: UI screen reader for debugging Pharo interfaces with screenshot and structure extraction
Server Configuration
get_settings: Retrieve current server configurationapply_settings: Modify server configuration dynamically
read_screen Tool
The read_screen tool captures screenshots and extracts UI structure for debugging Pharo UI issues.
Parameters:
target_type(string, default: 'world'): UI type to inspect ('world' for morphs, 'spec' for windows, 'roassal' for visualizations)capture_screenshot(boolean, default: true): Include PNG screenshot in response
Returns: UI structure with screenshot and human-readable summary
Usage Examples:
# Inspect all morphs in World
read_screen(target_type='world')
# Inspect Spec presenter windows
read_screen(target_type='spec', capture_screenshot=false)
# Inspect Roassal visualizations without screenshot (faster)
read_screen(target_type='roassal', capture_screenshot=false)Extracted Data Includes:
World (morphs):
Class name and type identification
Bounds (x, y, width, height coordinates)
Visibility state
Background color
Owner class
Submorph count
Text content (if available)
Example output:
{
"totalMorphs": 12,
"displayedMorphCount": 1,
"morphs": [
{
"class": "MenubarMorph",
"visible": true,
"bounds": {"x": 0, "y": 0, "width": 976, "height": 18},
"backgroundColor": "(Color r: 0.883... alpha: 0.8)",
"owner": "WorldMorph",
"submorphCount": 8
}
]
}Spec (presenters):
Window title and class name
Geometry (extent, position)
Window state (maximized, minimized, resizable)
Decorations (menu, toolbar, statusbar presence)
Presenter hierarchy (recursive with max depth of 3 levels)
Presenter class name, child count, and content properties (label, text, value, etc.)
Enablement and visibility state
Example output:
{
"windowCount": 1,
"presenters": [
{
"class": "SpWindowPresenter",
"title": "Welcome",
"extent": "(700@550)",
"hasMenu": false,
"presenter": {
"class": "StWelcomeBrowser",
"childCount": 2,
"isVisible": true,
"children": []
}
}
]
}Roassal (visualizations):
Canvas bounds and visibility state
Canvas class identification
Background color and zoom level
Shape details (color, position, extent, label, text)
Edge details (source, target, color, label)
Node and edge counts
Example output:
{
"canvasCount": 1,
"canvases": [
{
"class": "RSAthensMorph",
"canvasClass": "RSCanvas",
"bounds": {"x": 203, "y": 145, "width": 490, "height": 467},
"backgroundColor": "Color blue",
"zoomLevel": "1.0",
"shapeCount": 5,
"shapes": [
{
"class": "RSCircle",
"color": "(Color r: 1.0 g: 0.0 b: 0.0 alpha: 0.2)",
"position": "(0.0@0.0)",
"extent": "(5.0@5.0)"
}
],
"edgeCount": 0,
"edges": [],
"nodeCount": 0
}
]
}Server Configuration Tools
The get_settings and apply_settings tools provide dynamic server configuration management.
get_settings
Retrieve the current server configuration.
Parameters: None
Returns: Dictionary containing current server settings
Usage Example:
# Get current settings
get_settings()
# Returns: {"stackSize": 100, "customKey": "customValue"}Response Format:
{
"success": true,
"result": {
"stackSize": 100,
"customKey": "customValue"
}
}apply_settings
Modify server configuration dynamically. Settings take effect immediately during the current session.
Parameters:
settings(dict): Dictionary containing settings to modify
Returns: Success confirmation message
Usage Example:
# Apply new settings
apply_settings(settings={"stackSize": 200, "customKey": "customValue"})
# Returns: "Settings applied successfully"Common Settings:
Setting | Type | Default | Description |
| integer | 100 | Maximum stack trace depth for error reporting |
Note: The server accepts arbitrary key-value pairs beyond documented settings, allowing custom configuration options.
Development
Running Tests
The project includes comprehensive unit tests with mock-based testing to avoid requiring a live Pharo instance:
# Run all tests
uv run pytest
# Run tests with verbose output
uv run pytest -v
# Run specific test file
uv run pytest tests/test_core.py -vCode Quality
# Run linting
uv run ruff check
# Run formatting
uv run ruff format
# Run all pre-commit hooks
uv run pre-commit run --all-filesProject Structure
pharo-smalltalk-interop-mcp-server/
├── pharo_smalltalk_interop_mcp_server/
│ ├── __init__.py
│ ├── core.py # HTTP client and core functions
│ └── server.py # FastMCP server with tool definitions
├── tests/
│ ├── __init__.py
│ ├── test_core.py # Tests for core HTTP client functionality
│ └── test_server.py # Tests for MCP server integration
├── pyproject.toml # Project configuration
├── pytest.ini # Test configuration
└── README.mdTesting Strategy
The test suite uses mock-based testing to ensure:
No external dependencies: Tests run without requiring a live Pharo instance
Comprehensive coverage: All 22 endpoints and error scenarios are tested
Fast execution: Tests complete in under 1 second
Reliable results: Tests are deterministic and don't depend on external state
Test coverage includes:
HTTP client functionality (
PharoClientclass)All 22 Pharo interop operations
Error handling (connection errors, HTTP errors, JSON parsing errors)
MCP server initialization and tool registration
Integration between core functions and MCP tools
Available Tools
22 toolsapply_settingsB
Modify server configuration dynamically.
Args: settings: Dictionary containing server settings to modify
Returns: dict: API response with success/error and result - Success: {"success": True, "result": str} - result contains confirmation message - Error: {"success": False, "error": str} - error contains error message
Inputs: settings (required). Returns: object
evalB
Evaluate a Pharo Smalltalk expression with PharoSmalltalkInteropServer.
Args: code: The Smalltalk code to evaluate
Returns: dict: API response with success/error and result - Success: {"success": True, "result": any} - result contains the evaluation result - Error: {"success": False, "error": str} - error contains error message
Inputs: code (required). Returns: object
export_packageB
Export a package in Tonel format.
Args: package_name: The name of the package to export path: The path where to export the package (default: /tmp)
Returns: dict: API response with success/error and result - Success: {"success": True, "result": str} - result contains export success message with path - Error: {"success": False, "error": str} - error contains error message
Inputs: package_name (required), path. Returns: object
get_class_commentA
Get the comment of a Smalltalk class.
Args: class_name: The name of the class to retrieve comment for
Returns: dict: API response with success/error and result - Success: {"success": True, "result": str} - result contains the class comment - Error: {"success": False, "error": str} - error contains error message
Inputs: class_name (required). Returns: object
get_class_sourceA
Get the source code of a Smalltalk class.
Args: class_name: The name of the class to retrieve source for
Returns: dict: API response with success/error and result - Success: {"success": True, "result": str} - result contains the class source code - Error: {"success": False, "error": str} - error contains error message
Inputs: class_name (required). Returns: object
get_method_sourceB
Get the source code of a specific method in a class.
Args: class_name: The name of the class containing the method method_name: The name of the method to retrieve source for is_class_method: True for class-side methods, False for instance methods (default: False)
Returns: dict: API response with success/error and result - Success: {"success": True, "result": str} - result contains the method source code - Error: {"success": False, "error": str} - error contains error message
Inputs: class_name (required), method_name (required), is_class_method. Returns: object
get_settingsA
Retrieve current server configuration.
Returns: dict: API response with success/error and result - Success: {"success": True, "result": dict} - result contains current server settings - Error: {"success": False, "error": str} - error contains error message
Inputs: no named parameters. Returns: object
import_packageA
Import a package from specified path.
Args: package_name: The name of the package to import path: The path to the package file to import (default: /tmp)
Returns: dict: API response with success/error and result - Success: {"success": True, "result": str} - result contains import success message - Error: {"success": False, "error": str} - error contains error message
Inputs: package_name (required), path. Returns: object
install_projectA
Install a project using Metacello.
Args: project_name: The name of the project to install repository_url: The repository URL for the project load_groups: Comma-separated list of groups to load (optional)
Returns: dict: API response with success/error and result - Success: {"success": True, "result": str} - result contains installation success message - Error: {"success": False, "error": str} - error contains error message
Inputs: project_name (required), repository_url (required), load_groups. Returns: object
list_classesA
Get list of classes in a package.
Args: package_name: The name of the package
Returns: dict: API response with success/error and result - Success: {"success": True, "result": list[str]} - result contains list of class names in package - Error: {"success": False, "error": str} - error contains error message
Inputs: package_name (required). Returns: object
list_extended_classesA
Get list of extended classes in a package.
Args: package_name: The name of the package
Returns: dict: API response with success/error and result - Success: {"success": True, "result": list[str]} - result contains list of extended class names - Error: {"success": False, "error": str} - error contains error message
Inputs: package_name (required). Returns: object
list_methodsA
Get list of methods in a package.
Args: package_name: The name of the package
Returns: dict: API response with success/error and result - Success: {"success": True, "result": list[str]} - result contains list of method signatures Each method: "ClassName>>#methodName" - Error: {"success": False, "error": str} - error contains error message
Inputs: package_name (required). Returns: object
list_packagesA
Get list of all packages.
Returns: dict: API response with success/error and result - Success: {"success": True, "result": list[str]} - result contains list of all package names - Error: {"success": False, "error": str} - error contains error message
Inputs: no named parameters. Returns: object
read_screenA
Comprehensive UI screen reader for debugging Pharo interfaces.
Captures screenshot and extracts complete UI structure for World morphs, Spec presenters, and Roassal visualizations.
Args: target_type: 'world' for morphs, 'spec' for Spec windows, 'roassal' for visualizations capture_screenshot: Include PNG screenshot in response (default: true)
Returns: dict: UI structure and metrics - screenshot: Path to PNG file in /tmp/ (if capture_screenshot=true) - target_type: Which UI type was inspected - structure: Complete UI hierarchy data - summary: Human-readable description
Inputs: target_type, capture_screenshot. Returns: object
run_class_testB
Run tests for a class.
Args: class_name: The class name to run tests for
Returns: dict: API response with success/error and result - Success: {"success": True, "result": str} - result contains test results summary - Error: {"success": False, "error": str} - error contains error message
Inputs: class_name (required). Returns: object
run_package_testB
Run tests for a package.
Args: package_name: The package name to run tests for
Returns: dict: API response with success/error and result - Success: {"success": True, "result": str} - result contains test results summary - Error: {"success": False, "error": str} - error contains error message
Inputs: package_name (required). Returns: object
search_classes_likeA
Find classes matching a pattern.
Args: class_name_query: The pattern to search for in class names
Returns: dict: API response with success/error and result - Success: {"success": True, "result": list[str]} - result contains list of matching class names - Error: {"success": False, "error": str} - error contains error message
Inputs: class_name_query (required). Returns: object
search_implementorsA
Get all implementors of a method selector.
Args: method_name: The method name to find implementors for
Returns: dict: API response with success/error and result - Success: {"success": True, "result": list[dict]} - result contains list of implementors Each implementor: {"class": str, "method": str, "package": str} - Error: {"success": False, "error": str} - error contains error message
Inputs: method_name (required). Returns: object
search_methods_likeA
Find methods matching a pattern.
Args: method_name_query: The pattern to search for in method names
Returns: dict: API response with success/error and result - Success: {"success": True, "result": list[str]} - result contains list of matching method names - Error: {"success": False, "error": str} - error contains error message
Inputs: method_name_query (required). Returns: object
search_referencesA
Get all references to a method selector or a symbol.
Args: method_name_or_symbol: The method name to find references for
Returns: dict: API response with success/error and result - Success: {"success": True, "result": list[dict]} - result contains list of references Each reference: {"class": str, "method": str, "package": str} - Error: {"success": False, "error": str} - error contains error message
Inputs: method_name_or_symbol (required). Returns: object
search_references_to_classA
Find references to a class.
Args: class_name: The name of the class to find references for
Returns: dict: API response with success/error and result - Success: {"success": True, "result": list[dict]} - result contains list of class references Each reference: {"package": str, "class": str, "method": str} - Error: {"success": False, "error": str} - error contains error message
Inputs: class_name (required). Returns: object
search_traits_likeA
Find traits matching a pattern.
Args: trait_name_query: The pattern to search for in trait names
Returns: dict: API response with success/error and result - Success: {"success": True, "result": list[str]} - result contains list of matching trait names - Error: {"success": False, "error": str} - error contains error message
Inputs: trait_name_query (required). Returns: object
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 22 tools
Each tool targets a distinct operation: settings management, code evaluation, package operations, code browsing, searching, testing, and UI reading. No two tools have overlapping purposes.
All tools follow a consistent verb_noun pattern (e.g., get_class_source, list_packages, search_methods_like) with clear and predictable naming.
22 tools is on the higher side but still reasonable for a comprehensive Smalltalk interop server covering many aspects; each tool serves a distinct purpose.
Covers many areas (evaluation, browsing, searching, testing, package management, UI reading) but lacks write operations for code (no create/update/delete for classes or methods), which is a notable gap for a development tool.
Maintenance
Related MCP Connectors
MCP server for Speech-to-Text
MCP Server for Slima - AI Writing IDE for Novel Authors with AI Beta Reader.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceAn MCP server to list and launch applications on MacOS19MIT
- AlicenseBqualityDmaintenanceMCP Server for running code snippet and show the result.13,676 npm241MIT
- AlicenseNot gradedqualityDmaintenanceMCP Server around https://expr-lang.org1MIT
- AlicenseBqualityDmaintenanceA local MCP server that enables users to evaluate Pharo Smalltalk expressions and retrieve system information via NeoConsole. It provides comprehensive tools for inspecting class definitions, method sources, and system metrics within a Pharo environment.112MIT