This repository provides an implementation of a Model Context Protocol (MCP) server in Pharo Smalltalk. The server exposes a set of tools and capabilities for interacting with the Pharo image via HTTP.
MCP supports Pharo 12, Pharo 13, and Pharo 14. Mainline development targets the Pharo 13 API surface; the project uses PharoCompatibility to keep the supported version range loadable and tested.
- Install Pharo
Download and install Pharo. This project currently supports Pharo 12, Pharo 13, and Pharo 14.
- Load the MCP Project
Open your Pharo image and load the MCP project. To load MCP directly in an image, use this snippet in a Playground or Workspace:
Metacello new
baseline: 'MCP';
repository: 'github://Evref-BL/MCP:main/src';
load.To add MCP as a dependency of another project, reference the MCP baseline from that project's baseline:
spec
baseline: 'MCP'
with: [ spec repository: 'github://Evref-BL/MCP:main/src' ].To start the MCP HTTP server, launch the Pharo image and execute code like this in a Playground or Workspace:
mcp := MCP new.
mcp port: 4000.
mcp start.This starts the MCP server on port 4000. You can use another available port if 4000 conflicts with another service.
The server will only run as long as the Pharo image is running. You must keep the image open for the server to remain available.
In a graphical Pharo image, inspect the mcp object and open the Dashboard tab to monitor the server and control its lifecycle.
If you want to use Codex to manipulate Pharo, create an empty folder and copy inside it user/codex/.codex as .codex and user/AGENTS.md as AGENTS.md.
It will give Codex the default configuration of the MCP server on port 4000. If you started the server on another port, update the copied .codex/config.toml accordingly.
If you want to use opencode to manipulate Pharo, you can follow these steps:
- Go to the configuration folder of opencode: open ~/.config/opencode/
- Edit file: opencode.json to add the below:
{
"$schema": "https://opencode.ai/config.json",
"mcp": {
"pharo": {
"type": "remote",
"url": "http://127.0.0.1:4000",
"enabled": true
}
}
}- Close opencode and reopen it. You should see in the left bottom corner a green pointer for MCP indicating that opencode is connected to the MCP server. Make sure you started it in Pharo first.

- For more details about connected MCPs you can check the command
/mcps.
- You can follow this documentation to get more updates/explanation.
Once the server is started, AI clients interact with it via HTTP requests on the configured port (default: 4000).