pharo
Pharo Smalltalk implementation of Anthropic's Model Context Protocol (MCP) server specification. Enables LLMs like Claude to interact with Pharo applications.
claude mcp add --transport stdio paulwilke-pharo-mcp-server docker run -i pharo/pharo-mcp-server:latest \ --env PHARO_MCP_PORT="8080" \ --env PHARO_MCP_BASE_PATH="/mcp"
How to use
This Pharo MCP server provides a server-side implementation of the Model Context Protocol tailored for Pharo Smalltalk. It enables LLMs and other clients to discover available tools exposed by a Pharo application, fetch a generated service description, and invoke registered tools in a standardized way. The server dynamically registers Pharo methods or blocks as MCP tools and auto-generates the MCP Service Description from the registered tools, including their names, purposes, and parameter schemas. Typical workflows involve registering your Pharo tools, starting the server, then using an MCP-compatible client (for example Claude or another LLM integrated tool) to discover, describe, and invoke the exposed methods.
To use it, expose your Pharo methods or blocks as MCP tools via the server API, then query the discovery endpoint at /.well-known/model-context to confirm MCP support. Retrieve the tool descriptions at /mcp/description (or the configurable path), which provides the available tool names, input schemas, and output formats. Finally, invoke a tool at /mcp/invoke, sending the tool name and the required arguments as defined by the service description. The server is built on the Teapot web framework and uses NeoJSON for robust JSON handling, ensuring clean and interoperable messages between Pharo and LLM clients.
How to install
Prerequisites:
- A Pharo development environment or container capable of running a Pharo VM
- Basic familiarity with Metacello and Pharo package management
Installation steps (example using a containerized Pharo MCP server):
- Install Docker or ensure you have a compatible container runtime installed.
- Pull and run the MCP server container (adjust image name if needed): docker pull pharo/pharo-mcp-server:latest docker run -i -p 8080:8080 pharo/pharo-mcp-server:latest
- If you prefer a local Pharo setup (non-container):
- Launch Pharo
- Ensure Metacello is loaded
- In a Workspace, load the MCP framework using a baseline script similar to: Metacello new baseline: 'MCPFramework'; repository: 'github://YOUR_USERNAME/pharo-mcp-server:main/'; load.
- Start the embedded server from within Pharo and bind to a port you choose.
Note: The exact images or repository URLs may vary; replace placeholders with your repository details. The MCP server is designed to be integrated into a Pharo application and can be deployed either in a container or directly within a Pharo VM.
Additional notes
Tips and caveats:
- If your environment uses a custom base path for MCP endpoints, configure the server accordingly (e.g., /mcp/description or /mcp/invoke).
- When registering tools, provide clear names, short descriptions, and schemas for inputs/outputs to improve discoverability by LLMs.
- Ensure JSON handling uses NeoJSON for compatibility with MCP tooling.
- For production deployments, consider securing endpoints and handling authentication as needed by your integration.
- If you encounter port binding issues, verify that the host port (e.g., 8080) is available and not blocked by other services.
- Regularly update the server to align with MCP specification changes and Pharo ecosystem updates.