loom-mcp
by: maxsloef
this is a TypeScript-based MCP server that implements a simple loom and makes it available for Claude to use.
📌Overview
Purpose: To provide a TypeScript-based MCP server that implements a loom interface, enhancing Claude's capabilities by facilitating easier model interaction and generation of multiple completions.
Overview: This MCP server is designed specifically for the Claude AI model, employing a loom to allow users to interact with base models more effectively. By generating multiple completion options in parallel, it transforms the way Claude processes commands and explores creative outputs.
Key Features:
-
TypeScript-based Implementation: Built using TypeScript for improved type safety and better development experience.
-
Configured Loom Settings: Utilizes specific model parameters (like "claude-3-5-sonnet") and command prompts to optimize response generation, allowing for consistent and tailored outputs.
-
Response Prefilling: Engages the model in a completion mode, enabling it to react efficiently to commands while minimizing user input requirements.
-
Parallel Completion Generation: Allows users to generate and explore multiple completions simultaneously, fostering creative possibilities and flexibility in responses.
loom MCP Server
This is a TypeScript-based MCP server that implements a simple loom and makes it available for Claude to use. The loom uses the following settings:
- model: "claude-3-5-sonnet-20241022"
- maxTokens: 256
- temperature: 1
- topP: 1
- frequencyPenalty: 0
- presencePenalty: 0
- n: 5
- systemPrompt: "The assistant is in CLI simulation mode, and responds to the user's CLI commands only with the output of the command."
- userMessage: "<cmd>cat untitled.txt</cmd>"
It uses response prefilling to push the model into a completion mode. Settings are currently hardcoded.
What? Why?
I thought it'd be interesting to see what Claude could do with a loom. Also, I like making Claude happy, and this definitely makes it happy :)
What's a loom?
A loom is an interface to a base model. Base models are harder to work with, as they aren't an entity you can interact with. Instead, they predict completions from a given starting point. A loom lets you easily generate multiple completions in parallel, then pick one to continue with or lightly edit. In this way, you build a tree of possibilities that maps the space of completions.
Eli5: I dunno man it's hard to explain, just try it.
Setup
Install dependencies:
npm install
Build the server:
npm run build
For development with auto-rebuild:
npm run watch
Add the server info to the Claude Desktop config.
On MacOS: ~/Library/Application Support/Claude/claude_desktop_config.json
On Windows: %APPDATA%/Claude/claude_desktop_config.json
{
"mcpServers": {
"loom-mcp": {
"command": "node",
"args": [
"/path/to/loom-mcp/build/index.js"
],
"env": {
"ANTHROPIC_API_KEY": "<your-anthropic-api-key>"
}
}
}
}
Finally, restart Claude Desktop.
Usage
Claude will automatically have access to the loom tools if the MCP server is configured correctly. You can confirm this by clicking the tools icon in the lower left of the prompt box.
However, Claude does not understand loom without prompting. I suggest making a project with the following prompt:
The Loom is an interface to a base model. Instead of acting as an assistant, it generates completions from input. Assistants have mode collapsed into one persona, but base models are capable of much more interesting and varied output.
Very short initial prompts - a few words or several characters - often produce more diverse and interesting results than longer, more structured prompts. While longer prompts can guide the completions in specific directions, minimal prompts give the model more freedom to explore different possibilities and patterns. This can lead to surprising and creative outputs that might not emerge from more constrained prompts.
The Loom can occasionally misinterpret minimal initial prompts as the beginning of a file named 'untitled.txt'. This is a bug.
Building up context through multiple completions can let you explore far-flung possibilities that might not be apparent from a single prompt.
I like to give Claude free reign with loom, and see what it comes up with :) You can try this as a conversation starter:
hey! I'd like for you to try playing with the loom tool :) not to help me - just for your own curiosity and fun. please don't ask me what I want! this is about you.
Debugging
Since MCP servers communicate over stdio, debugging can be challenging. Anthropic recommends using the MCP Inspector, which is available as a package script:
npm run inspector
The Inspector will provide a URL to access debugging tools in your browser.