pharo-smalltalk-interop-mcp-server

pharo-smalltalk-interop-mcp-server

Local MCP server enabling advanced Pharo Smalltalk integration and introspection.

6
Stars
2
Forks
6
Watchers
0
Issues
pharo-smalltalk-interop-mcp-server implements the Model Context Protocol (MCP) and enables communication with a local Pharo Smalltalk image. It offers capabilities such as code evaluation, code introspection, search and discovery, package management, project installation, test execution, and UI debugging. The server is configured to integrate with tools like Cursor and Claude Code, providing a standardized API for programmatic Smalltalk interaction.

Key Features

Implements Model Context Protocol (MCP) server
Remote execution of Smalltalk expressions
Source code and metadata introspection for classes and methods
Search and discovery of classes, traits, methods, and references
Export and import of packages in Tonel format
Metacello project installation
Execution of test suites at package and class levels
Dynamic server configuration via environment variables
Capture of UI screenshots and structure inspection
Integration with tools like Cursor and Claude Code

Use Cases

Automated code evaluation in a Pharo Smalltalk environment
Programmatic source code searching and navigation for developers
Bulk exporting and importing of Smalltalk packages
Continuous integration pipelines running Pharo test suites
Remote introspection of Smalltalk codebases
Easily installing or updating Metacello-based projects
Enabling AI-powered coding assistants to interact with Smalltalk
Inspection and debugging of Smalltalk graphical interfaces
Dynamic reconfiguration of MCP server settings for varied workflows
Building custom developer tooling on top of a standardized Smalltalk MCP API

README

pharo-smalltalk-interop-mcp-server

CI

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

Installation

Quick Start (using uvx)

The easiest way to run the server without cloning the repository:

bash
uvx --from git+https://github.com/mumez/pharo-smalltalk-interop-mcp-server.git pharo-smalltalk-interop-mcp-server

Development Installation

To set up for development:

  1. Clone the repository:
bash
git clone https://github.com/mumez/pharo-smalltalk-interop-mcp-server.git
  1. Install dependencies using uv:
bash
cd pharo-smalltalk-interop-mcp-server
uv sync --dev

Usage

Running the MCP Server

Using uvx (no installation required):

bash
uvx --from git+https://github.com/mumez/pharo-smalltalk-interop-mcp-server.git pharo-smalltalk-interop-mcp-server

Using uv (after cloning the repository):

bash
uv run pharo-smalltalk-interop-mcp-server

Environment Variables

You can configure the server using environment variables:

  • PHARO_SIS_PORT: Port number for PharoSmalltalkInteropServer (default: 8086)

Examples:

Using uvx:

bash
PHARO_SIS_PORT=8086 uvx --from git+https://github.com/mumez/pharo-smalltalk-interop-mcp-server.git pharo-smalltalk-interop-mcp-server

Using uv:

bash
PHARO_SIS_PORT=9999 uv run pharo-smalltalk-interop-mcp-server

Cursor MCP settings

Using uvx (recommended):

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

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

bash
claude mcp add -s user smalltalk-interop -- uvx --from git+https://github.com/mumez/pharo-smalltalk-interop-mcp-server.git pharo-smalltalk-interop-mcp-server

Using uv (after cloning):

bash
claude mcp add -s user smalltalk-interop -- uv --directory /path/to/pharo-smalltalk-interop-mcp-server run pharo-smalltalk-interop-mcp-server

MCP 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 class
  • get_method_source: Retrieve source code of a specific method
  • get_class_comment: Retrieve comment/documentation of a class

Search & Discovery

  • search_classes_like: Find classes matching a pattern
  • search_methods_like: Find methods matching a pattern
  • search_traits_like: Find traits matching a pattern
  • search_implementors: Find all implementors of a method selector
  • search_references: Find all references to a method selector
  • search_references_to_class: Find all references to a class

Package Management

  • list_packages: List all packages in the image
  • list_classes: List classes in a specific package
  • list_extended_classes: List extended classes in a package
  • list_methods: List methods in a package
  • export_package: Export a package in Tonel format
  • import_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 package
  • run_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 configuration
  • apply_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:

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

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

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

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

python
# Get current settings
get_settings()
# Returns: {"stackSize": 100, "customKey": "customValue"}

Response Format:

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

python
# Apply new settings
apply_settings(settings={"stackSize": 200, "customKey": "customValue"})
# Returns: "Settings applied successfully"

Common Settings:

Setting Type Default Description
stackSize 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:

bash
# 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

Code Quality

bash
# Run linting
uv run ruff check

# Run formatting
uv run ruff format

# Run all pre-commit hooks
uv run pre-commit run --all-files

Project 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.md

Testing 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 (PharoClient class)
  • 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

Star History

Star History Chart

Repository Owner

mumez
mumez

User

Repository Details

Language Python
Default Branch main
Size 208 KB
Contributors 2
License MIT License
MCP Verified Nov 12, 2025

Programming Languages

Python
100%

Tags

Topics

mcp-server pharo-smalltalk

Join Our Newsletter

Stay updated with the latest AI tools, news, and offers by subscribing to our weekly newsletter.

We respect your privacy. Unsubscribe at any time.

Related MCPs

Discover similar Model Context Protocol servers

  • Xcode MCP Server

    Xcode MCP Server

    Comprehensive Xcode integration server for AI assistants using the Model Context Protocol.

    Xcode MCP Server provides an MCP-compliant interface for AI agents to interact with Xcode projects on macOS. It supports project management, simulator control, CocoaPods and Swift Package Manager integration, and advanced file and build operations. Enhanced error handling and multi-project support enable seamless automation and context management for complex Xcode workflows.

    • 330
    • MCP
    • r-huijts/xcode-mcp-server
  • SonarQube MCP Server

    SonarQube MCP Server

    Model Context Protocol server for AI access to SonarQube code quality metrics.

    SonarQube MCP Server offers a Model Context Protocol (MCP) server that integrates with SonarQube, enabling AI assistants to access code quality metrics, issues, and analysis results programmatically. It supports retrieving detailed quality metrics, filtering issues, reviewing security hotspots, analyzing branches and pull requests, and monitoring project health. The server facilitates multi-project analysis, contextual code review, and improved assistant workflows through a standardized protocol.

    • 101
    • MCP
    • sapientpants/sonarqube-mcp-server
  • Pica MCP Server

    Pica MCP Server

    A Model Context Protocol (MCP) server for seamless integration with 100+ platforms via Pica.

    Pica MCP Server provides a standardized Model Context Protocol (MCP) interface for interaction with a wide range of third-party services through Pica. It enables direct platform integrations, action execution, and intelligent intent detection while prioritizing secure environment variable management. The server also offers features such as code generation, form and data handling, and robust documentation for platform actions. It supports multiple deployment methods, including standalone, Docker, Vercel, and integration with tools like Claude Desktop and Cursor.

    • 8
    • MCP
    • picahq/mcp
  • Everything Search MCP Server

    Everything Search MCP Server

    Fast, cross-platform file search via Model Context Protocol integration.

    Everything Search MCP Server provides fast file and folder search capabilities across Windows, macOS, and Linux platforms as an MCP server. It leverages native search utilities such as the Everything SDK on Windows, mdfind on macOS, and locate/plocate on Linux. The tool exposes a standardized search interface with customizable parameters including query, sorting, and matching options. It is suitable for integration with AI clients or automation tools that follow the Model Context Protocol.

    • 268
    • MCP
    • mamertofabian/mcp-everything-search
  • PostHog MCP

    PostHog MCP

    Easily deploy and manage Model Context Protocol servers across multiple platforms.

    PostHog MCP provides a server implementation for the Model Context Protocol, now maintained within the PostHog monorepo. It enables quick deployment for enhanced model context management across editors like Cursor, Claude, Claude Code, VS Code, and Zed. Users can install the MCP server with a single command, streamlining integration for large language model workflows. Documentation and further details are provided through official PostHog resources.

    • 138
    • MCP
    • PostHog/mcp
  • mcpxcodebuild

    mcpxcodebuild

    Build and test iOS Xcode projects via the Model Context Protocol server.

    mcpxcodebuild is a Model Context Protocol server that enables building and testing iOS Xcode workspace and project files. It facilitates seamless integration with Visual Studio Code extensions such as Cline or Roo Code, allowing remote build and test operations via standardized MCP tools. The tool can be installed using pip or uv and is easily configurable for use with platforms like Claude.app.

    • 76
    • MCP
    • ShenghaiWang/xcodebuild
  • Didn't find tool you were looking for?

    Be as detailed as possible for better results