Skip to content
MCP server

forthling

Run Forth code in a persistent sandbox and see the stacks after every call

Runs locallyStatus and history
Install
Pricing
Free
Platforms
CLI, self-hosted
Runs
Locally
Version
0.2.5
Listing updated
3 days ago

About forthling

forthling is a free MCP server for developer tools. It runs locally on your machine and is started by your AI client.

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.

Install

Run in a terminal

claude mcp add forthling -- npx -y forthling-mcp

Add to claude_desktop_config.json

{
  "mcpServers": {
    "forthling": {
      "command": "npx",
      "args": [
        "-y",
        "forthling-mcp"
      ]
    }
  }
}
Install in CursorOpens Cursor, which asks you to confirm. Or add it by hand:

Add to ~/.cursor/mcp.json

{
  "mcpServers": {
    "forthling": {
      "command": "npx",
      "args": [
        "-y",
        "forthling-mcp"
      ]
    }
  }
}
Install in VS CodeOpens VS Code, which asks you to confirm. Or add it by hand:

Add to .vscode/mcp.json

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

Add to ~/.codeium/windsurf/mcp_config.json

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

Add to your client's MCP settings (most use this shape)

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

Tools this server provides (5)

Taken from the project documentation; the running server may differ.

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.

What it does

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

Pricing

Free

Free to install

Prices change. Check deschaker.github.io before you buy.

forthling 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 to forthling

  1. REA

    MCP server

    CLI and MCP server that lets coding agents reverse engineer apps and binaries

    Runs locally
    • Open source
    • 464K GitHub stars
    • Developer tools
  2. Codebase Memory

    MCP server

    Local MCP server that builds a code knowledge graph for AI coding agents

    Runs locally
    • Open source
    • 48.7K GitHub stars
    • Knowledge and memory
  3. GitHub

    MCP server

    Official MCP server connecting AI assistants to GitHub repos, issues and workflows

    Not checked yet
    • Remote
    • Open source
    • 34.5K GitHub stars
    • Developer tools
  4. MCP toolkit giving coding agents symbol-level code retrieval and editing

    Runs locally
    • Open source
    • 31.5K GitHub stars
    • Developer tools
  5. XERJ

    MCP server

    Local search engine for AI agents with cited answers over your code and docs

    Runs locally
    • Open source
    • 19.2K GitHub stars
    • Knowledge and memory
  6. Ouroboros

    MCP server

    Spec-first layer that pins requirements and verifies results of AI coding agent work

    Runs locally
    • Open source
    • 6.4K GitHub stars
    • Developer tools