by hungryrobot1
Enables AI models to create, modify, and execute tools at runtime while maintaining safety through sandboxing, code validation, and comprehensive journaling.
Mcp Pif Cljs provides a Model Context Protocol (MCP) server written in ClojureScript that lets AI assistants generate new tools on‑the‑fly, execute them safely, and keep an auditable log of every change. The server treats code as data, allowing dynamic evolution without restarting.
git clone https://github.com/hungryrobot1/MCP-PIF
cd MCP-PIF
npm install
npx shadow-cljs compile mcp-server
mcp-server.js
via Node:
{
"mcpServers": {
"mcp-pif-cljs": {
"command": "node",
"args": ["/full/path/to/MCP-PIF/out/mcp-server.js"]
}
}
}
memory-store
, meta-evolve
, execute-tool
, etc.)../package-dxt.sh
to produce a .dxt
bundle for drag‑and‑drop installation.meta-evolve
tool.execute-tool
) that bypasses client‑side caching of newly created tools.memory-store
, memory-retrieve
, journal-recent
, server-info
).execute-tool
tool with the tool name and arguments.journal-recent
and server-info
../package-dxt.sh
to create a .dxt
bundle that can be installed by dragging it onto Claude Desktop.A Model Context Protocol (MCP) server written in ClojureScript that explores homoiconicity, introspection, and metaprogramming to enable runtime tool creation and safe self-modification capabilities. It allows models like Claude to create and execute new tools during runtime without restarting the server. For example, tools for arithmetic can perform actual calculations, not LLM approximations based on pattern matching.
It leverages Clojure's code-as-data philosophy known as homoiconicity, is designed to block dangerous operations, and all modifications are journaled and auditable.
Clone and build:
git clone <https://github.com/hungryrobot1/MCP-PIF>
cd MCP-PIF
npm install
npx shadow-cljs compile mcp-server
Configure Claude Desktop:
Edit your Claude Desktop config file:
~/Library/Application Support/Claude/claude_desktop_config.json
%APPDATA%\Claude\claude_desktop_config.json
{
"mcpServers": {
"mcp-pif-cljs": {
"command": "node",
"args": ["/full/path/to/MCP-PIF/out/mcp-server.js"]
}
}
}
Restart Claude Desktop
For easier use and distribution, you can create a .dxt package:
./package-dxt.sh
This creates mcp-pif-cljs.dxt
which can be installed via drag-and-drop in Claude Desktop.
memory-store
- Store key-value pairs in memorymemory-retrieve
- Retrieve stored valuesjournal-recent
- View recent activity journalserver-info
- Get comprehensive server information (all tools, state, statistics)meta-evolve
- Create new tools at runtimeexecute-tool
- Execute any tool by name (including dynamic ones)You: "Store my favorite programming language as ClojureScript"
Claude: I'll store that for you using the memory-store tool.
You: "What's my favorite programming language?"
Claude: Your favorite programming language is ClojureScript.
You: "I need a tool that calculates the area of a circle"
Claude: I'll create that tool for you using meta-evolve...
[Creates tool with code: (args) => Math.PI * args.radius * args.radius]
You: "What's the area of a circle with radius 5?"
Claude: The area is 78.54 square units.
Due to MCP client caching, newly created tools must be called via execute-tool
:
Create a tool:
Use meta-evolve to create "multiply":
- code: "(args) => args.x * args.y"
- tool-type: "arithmetic"
Verify creation:
Use server-info
(You'll see "multiply [RUNTIME]" in the tools list)
Execute the tool:
Use execute-tool with:
- tool-name: "multiply"
- arguments: { x: 6, y: 7 }
Result: 42
┌─────────────────┐ ┌──────────────────┐ ┌─────────────────┐
│ AI Client │────▶│ MCP Protocol │────▶│ Meta Engine │
│ (Claude) │ │ (stdio/jsonrpc) │ │ (Self-Modifier) │
└─────────────────┘ └──────────────────┘ └─────────────────┘
│ │
▼ ▼
┌──────────────────┐ ┌─────────────────┐
│ Tools/Memory │ │ Journal DB │
│ (Extensible) │ │ (DataScript) │
└──────────────────┘ └─────────────────┘
src/mcp/
├── core.cljs # Main server & request routing
├── protocol.cljs # JSON-RPC/MCP protocol handling
├── tools.cljs # Tool definitions and handlers
├── meta.cljs # Self-modification engine
├── evaluator.cljs # Safe JavaScript evaluation
└── journal.cljs # Activity logging (DataScript)
# Development build with hot reload
npx shadow-cljs watch mcp-server
# Run tests
npm test
# Create .dxt package
./package-dxt.sh
# Basic protocol test
node test-clean-protocol.js
# Dynamic tools test
node test-dynamic-tools.js
This project explores the intersection of:
Completed:
In progress:
execute-tool
to call runtime-created toolsThis is an experimental project exploring metaprogramming in the context of AI tools. Contributions that enhance self-modification capabilities or improve safety are welcome!
MIT
"The significant problems we face cannot be solved at the same level of thinking we were at when we created them." - Einstein
This project asks: What if our tools could evolve their own thinking?
Please log in to share your review and rating for this MCP.
Explore related MCPs that share similar capabilities and solve comparable challenges
by modelcontextprotocol
An MCP server implementation that provides a tool for dynamic and reflective problem-solving through a structured thinking process.
by danny-avila
Provides a self‑hosted ChatGPT‑style interface supporting numerous AI models, agents, code interpreter, image generation, multimodal interactions, and secure multi‑user authentication.
by block
Automates engineering tasks on local machines, executing code, building projects, debugging, orchestrating workflows, and interacting with external APIs using any LLM.
by RooCodeInc
Provides an autonomous AI coding partner inside the editor that can understand natural language, manipulate files, run commands, browse the web, and be customized via modes and instructions.
by pydantic
A Python framework that enables seamless integration of Pydantic validation with large language models, providing type‑safe agent construction, dependency injection, and structured output handling.
by lastmile-ai
Build effective agents using Model Context Protocol and simple, composable workflow patterns.
by mcp-use
A Python SDK that simplifies interaction with MCP servers and enables developers to create custom agents with tool‑calling capabilities.
by nanbingxyz
A cross‑platform desktop AI assistant that connects to major LLM providers, supports a local knowledge base, and enables tool integration via MCP servers.
by gptme
Provides a personal AI assistant that runs directly in the terminal, capable of executing code, manipulating files, browsing the web, using vision, and interfacing with various LLM providers.