npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

rlm-mcp-server

v0.1.3

Published

Recursive Language Model as an MCP server: recursive long-context Q&A and a persistent Python kernel.

Readme

rlm-mcp-server

The Recursive Language Model as an MCP server. It answers a question over a context far larger than a model window by binding the context as a variable in a persistent Python kernel and letting the model decompose it with code, rather than following a fixed chunker.

Part of the harness monorepo.

Installation

npm install rlm-mcp-server

Usage

Run it over stdio, the transport a local host spawns:

RLM_MODEL=anthropic/claude-sonnet-5 RLM_SANDBOX=local npx rlm-mcp-server

Set RLM_MODEL to a provider/model string, with the matching provider key in the environment. Any provider the Vercel AI SDK supports works. Without it, rlm_query returns a stub answer so the server runs offline. RLM_SANDBOX=local (or docker) enables the Python kernel; it runs code, so it stays off by default.

The same binary is a CLI, so a person or a shell-driven model can use it directly. The installed command is rlm:

rlm store "a very large document ..."          # prints a handle
rlm query "who led it?" --file report.txt      # prints the answer
RLM_SANDBOX=local rlm exec "sum(range(100))"   # runs Python in the kernel
rlm query "summarize" --file big.txt --deep    # the kernel-backed RLM

Any subcommand runs the CLI; no subcommand starts the MCP server, so hosts are unaffected.

The package is also a library:

import { Rlm, AiCompletion, FileContextStore, resolveModel, uuidGen } from 'rlm-mcp-server';

const rlm = new Rlm(new AiCompletion({ model: resolveModel('anthropic/claude-sonnet-5') }), new FileContextStore('.contexts', uuidGen));
const { answer } = await rlm.query({ question: 'who led it?', context: veryLargeText });

Tools

| Tool | Purpose | | ------------------- | ------------------------------------------------------------ | | rlm_store_context | Store a large context and get a handle | | rlm_query | Answer a question over a context by chunking and synthesizing | | python_exec | Run Python in a persistent kernel (needs RLM_SANDBOX) | | rlm_deep_query | Answer by exploring the context as a variable in the kernel (needs RLM_SANDBOX and a model) |

Two ways to recurse

rlm_query chunks the context by size and synthesizes, which needs no sandbox. It is the map-reduce baseline, useful when no kernel is available.

rlm_deep_query is the RLM. It binds the context as PROMPT in a live kernel and the model decides how to decompose it, following three mechanisms from the paper:

  • python_exec returns only a bounded prefix of stdout plus its length, so reading a large slice never floods the model window. The value stays in the kernel.
  • A sub-call at depth d spawns a child RLM at depth d+1, down to a flat model call at the ceiling. Set the ceiling with RLM_MAX_DEPTH (default 1).
  • The model can assign its answer to a FINAL variable in the kernel, so the answer can exceed the model's output window.

On the local adapter an in-kernel rlm(question, text) calls back to the model over a loopback socket. Isolated adapters (docker, Cloudflare) use the recurse tool instead, which reaches the model from the host.

Structure

The RLM code depends only on the contracts in each domain, so the pieces that differ between local and Cloudflare sit behind one seam.

src/
  rlm/           recursive query over a large context
  completion/    Completion port, AiCompletion (Vercel AI SDK), StubCompletion
  storage/       ContextStore port, FileContextStore (local), R2ContextStore (Cloudflare)
  sandbox/       SandboxProvider: local process, docker, Cloudflare
  server.ts      builds the MCP server and tools, transport agnostic
  local.ts       stdio entrypoint      remote.ts   http entrypoint
  index.ts       public API