# forthling

> forthling is a free MCP server for developer tools. Run Forth code in a persistent sandbox and see the stacks after every call. It runs locally on your machine and is started by your AI client.

- **Kind:** MCP server
- **Pricing:** Free
- **Platforms:** CLI, self-hosted
- **Website:** https://deschaker.github.io/forthling/
- **Repository:** https://github.com/deschaker/forthling/tree/HEAD/mcp
- **MCP Registry name:** io.github.DeSchaker/forthling
- **Categories:** developer tools
- **Listing updated:** 2026-11-14

## About

Forth leans on stack effects that models often get wrong, so this server gives an agent a real interpreter and a session that remembers. Words you define and values on the stacks stay between calls, and every result shows the output, the data and float stacks and any error. A failure empties the stacks, so the result reports what they held, where it happened and which words were running.

It runs forthling, a small Forth-2012 interpreter written in Rust, always sandboxed. Files exist only in memory, up to 4 MiB per session, and can be preloaded so the code can INCLUDE a library. Lines are capped at 1024 characters; larger inputs such as JSON go in a separate data argument and are read with a DATA word.

On connect, the server's instructions tell the model the idioms that trip it up, such as preferring locals over ROT, PICK and ROLL. Install it as an MCP bundle for Claude Desktop, with cargo, or from source, and try it in a browser playground.

## Features

- **Persistent session:** Definitions and stacks carry over between calls.
- **Stack-aware output:** Each result shows the data and float stacks and any error.
- **In-memory files:** Preload files and INCLUDE them without touching disk.
- **Separate data input:** Pass large JSON through a data argument read by a DATA word.
- **Word help:** Look up a word's stack effect, example and word list.
- **Step counts:** Reports how many steps ran and how deep the stack went.

## Good for

- Test a Forth snippet an agent just wrote
- Teach Forth with immediate stack feedback
- Prototype a word that parses JSON
- Debug a stack-effect error

## Install

### Claude Code (Terminal)

```sh
claude mcp add forthling -- npx -y forthling-mcp
```

### Claude Desktop (claude_desktop_config.json)

```json
{
  "mcpServers": {
    "forthling": {
      "command": "npx",
      "args": [
        "-y",
        "forthling-mcp"
      ]
    }
  }
}
```

### Cursor (~/.cursor/mcp.json)

```json
{
  "mcpServers": {
    "forthling": {
      "command": "npx",
      "args": [
        "-y",
        "forthling-mcp"
      ]
    }
  }
}
```

### VS Code (.vscode/mcp.json)

```json
{
  "servers": {
    "forthling": {
      "type": "stdio",
      "command": "npx",
      "args": [
        "-y",
        "forthling-mcp"
      ]
    }
  }
}
```

### Windsurf (~/.codeium/windsurf/mcp_config.json)

```json
{
  "mcpServers": {
    "forthling": {
      "command": "npx",
      "args": [
        "-y",
        "forthling-mcp"
      ]
    }
  }
}
```

### Other clients (your client's MCP settings (most use this shape))

```json
{
  "mcpServers": {
    "forthling": {
      "command": "npx",
      "args": [
        "-y",
        "forthling-mcp"
      ]
    }
  }
}
```

## Tools

- `forth_eval`: Runs Forth code and returns output, stacks and any error.
- `forth_stack`: Shows the stacks without running anything.
- `forth_words`: Lists words defined in this session.
- `forth_help`: Explains a word's stack effect and usage.
- `forth_reset`: Starts a fresh session.

## FAQ

### How do I install it?

As a .mcpb bundle in Claude Desktop, with cargo install forthling-mcp, or from a clone.

### Is it safe?

It always runs in forthling's sandbox, with files held in memory only.

### What are the size limits?

A code line is at most 1024 characters, and session files total at most 4 MiB.

### Can I reset it?

Yes, forth_reset clears definitions, stacks, data and files.

### Is forthling free?

Yes. forthling is free to use.

### How do I add forthling to Claude Code?

Run this command in your terminal: claude mcp add forthling -- npx -y forthling-mcp

### What are the best alternatives to forthling?

The closest alternatives to forthling are REA, Codebase Memory, GitHub, Serena MCP: the IDE for your agent and XERJ.

## Alternatives

- [REA](https://ai-powered.com/mcp/rea): REA is an open-source MCP server for developer tools.
- [Codebase Memory](https://ai-powered.com/mcp/codebase-memory): Codebase Memory is an open-source MCP server for knowledge and memory.
- [GitHub](https://ai-powered.com/mcp/github-2): GitHub is an open-source MCP server for developer tools.
- [Serena MCP: the IDE for your agent](https://ai-powered.com/mcp/serena-mcp-the-ide-for-your-agent): Serena MCP: the IDE for your agent is an open-source MCP server for developer tools.
- [XERJ](https://ai-powered.com/mcp/xerj): XERJ is an open-source MCP server for knowledge and memory.
- [Ouroboros](https://ai-powered.com/mcp/ouroboros): Ouroboros is an open-source MCP server for developer tools.
- [Claude Code Ultimate Guide](https://ai-powered.com/mcp/claude-code-ultimate-guide): Claude Code Ultimate Guide is an open-source MCP server for ai models and llm tooling.
- [Concord MCP](https://ai-powered.com/mcp/concord-mcp): Concord MCP is a freemium MCP server for developer tools.

---
Source: https://ai-powered.com/mcp/forthling
