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
- Python 3.10 or later
- uv package manager
- Pharo with PharoSmalltalkInteropServer installed
- Clone the repository:
git clone https://github.com/mumez/pharo-smalltalk-interop-mcp-server.git- Install dependencies using uv:
cd pharo-smalltalk-interop-mcp-server
uv sync --devStart the server:
uv run pharo-smalltalk-interop-mcp-serverYou can configure the server using environment variables:
PHARO_SIS_PORT: Port number for PharoSmalltalkInteropServer (default: 8086)
Examples:
# Connect to PharoSmalltalkInteropServer on port 8086 (default)
PHARO_SIS_PORT=8086 uv run pharo-smalltalk-interop-mcp-server
# Connect to PharoSmalltalkInteropServer on port 9999
PHARO_SIS_PORT=9999 uv run pharo-smalltalk-interop-mcp-server{
"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.
Add to your Claude Code settings:
claude mcp add -s user smalltalk-interop -- uv --directory /path/to/pharo-smalltalk-interop-mcp-server run pharo-smalltalk-interop-mcp-serverThis server provides 19 MCP tools that map to all PharoSmalltalkInteropServer APIs:
eval: Execute Smalltalk expressions and return results
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_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
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
install_project: Install a project using Metacello with optional load groups
run_package_test: Run test suites for a packagerun_class_test: Run test suites for a specific class
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 -v# Run linting
uv run ruff check
# Run formatting
uv run ruff format
# Run all pre-commit hooks
uv run pre-commit run --all-filespharo-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.md
The test suite uses mock-based testing to ensure:
- No external dependencies: Tests run without requiring a live Pharo instance
- Comprehensive coverage: All 19 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 19 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