Babashka MCP Server
The Babashka MCP Server allows interaction with the Babashka interpreter via the Model Context Protocol (MCP), enabling code execution and resource management.
Execute Babashka code: Run Clojure scripts and expressions through the server with configurable timeouts.
Timeout configuration: Set execution timeouts between 1-300 seconds (1,000-300,000 milliseconds), with a default of 30 seconds.
Access command history: Retrieve and browse results of recent command executions through MCP resources (e.g.,
babashka://commands/{index}).Result caching: Automatically cache recent command executions for efficient retrieval.
Custom configuration: Specify the path to the Babashka executable using the
BABASHKA_PATHenvironment variable.Development roadmap: Future plans include self-hosting, REPL integration, and performance optimizations.
The MCP server provides integration with Babashka, which is a native Clojure interpreter for scripting. It allows execution of Clojure code through the MCP protocol.
The README mentions GitHub Actions tools for Babashka, including setup-babashka and babashka-docker-action, which are recommended for using Babashka in GitHub Actions workflows.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Babashka MCP Serverexecute (+ 1 2 3) to test basic arithmetic"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Babashka MCP Server
A Model Context Protocol server for interacting with Babashka, a native Clojure interpreter for scripting.
Features
Execute Babashka code through MCP tools
Cache recent command results
Access command history through MCP resources
Configurable command timeouts
Related MCP server: Claude Code Control MCP
Prerequisites
Install Babashka
Babashka can be installed in several ways:
macOS
brew install borkdude/brew/babashkaLinux
bash < <(curl -s https://raw.githubusercontent.com/babashka/babashka/master/install)Windows
# Using scoop
scoop install babashkaFor other installation methods, see the official Babashka installation guide.
Verify Installation
After installation, verify Babashka works:
# Check version
bb --version
# Try a simple expression
bb -e '(+ 1 2 3)'
# Run a script from string
bb -e '(defn hello [x] (str "Hello, " x "!")) (hello "World")'
# Use -i flag to process lines of input
ls | bb -i '(take 2 *input*)'Installation
# Install dependencies
npm install
# Build the MCP server
npm run buildConfiguration
The server can be configured through environment variables:
BABASHKA_PATH: Path to the Babashka executable (default: "bb")
Tools
execute
Execute Babashka code with optional timeout:
{
name: "execute",
arguments: {
code: string; // Babashka code to execute
timeout?: number; // Timeout in milliseconds (default: 30000)
}
}Example:
{
name: "execute",
arguments: {
code: "(+ 1 2 3)",
timeout: 5000
}
}Resources
The server maintains a cache of recent command executions accessible through:
babashka://commands/{index}- Access specific command results by index
Babashka Language Features
Tail Call Optimization (TCO)
Babashka supports explicit tail call optimization through the recur special form, but does not implement automatic TCO. For example:
;; This will cause stack overflow
(defn countdown [n]
(if (zero? n)
:done
(countdown (dec n))))
;; This works with TCO using recur
(defn countdown [n]
(if (zero? n)
:done
(recur (dec n))))Useful Resources
Official Resources
Babashka GitHub Repository - The main Babashka project
Babashka Book - Official documentation
Babashka Examples - Collection of example scripts
Community Tools & Libraries
pod-babashka-buddy - Cryptographic API for Babashka
bb-clis - Collection of useful Babashka CLI scripts
bb-scripts - Various utility scripts for Babashka
Development Tools
setup-babashka - GitHub Actions for installing Babashka
babashka-docker-action - Run Babashka scripts in GitHub Actions
Development
This server is designed to eventually become self-hosting, meaning it will be rewritten in Babashka itself. The current TypeScript implementation serves as a reference and starting point.
Roadmap
Self-Hosted Implementation
Rewrite the MCP server in Babashka
Leverage Babashka's native capabilities for better performance
Remove Node.js dependency
Maintain full compatibility with MCP protocol
Support all current features:
Command execution
Resource management
Command history
Timeout handling
Enhanced Features
Add support for Babashka pods
Implement file watching capabilities
Add REPL integration
Support for multiple Babashka instances
Performance Optimizations
Implement caching strategies
Optimize resource usage
Reduce startup time
Testing & Documentation
Comprehensive test suite
API documentation
Usage examples
Performance benchmarks
Available Tools
1 toolexecuteC
Execute Babashka (bb) code
| Name | Required | Description | Default |
|---|---|---|---|
| code | Yes | Babashka code to execute | |
| timeout | No | Timeout in milliseconds (default: 30000) |
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
1 tool update
v1.0.0- First observed
execute
TDQS
Scored across 1 tool
With only one tool, there is no possibility of ambiguity or overlap between tools. The single tool 'execute' has a clear and distinct purpose for running Babashka code.
A single tool inherently has perfect naming consistency, as there are no other tools to compare it against. The name 'execute' is straightforward and appropriate for its function.
A single tool is too few for most practical server purposes, as it severely limits functionality and flexibility. While it might suffice for a minimal interface, it feels thin and under-scoped for general use.
The tool provides basic execution capability, but there are notable gaps such as no tools for managing scripts, handling dependencies, or providing utilities like linting or debugging. This limits the server's usefulness for broader Babashka workflows.
Maintenance
Related MCP Connectors
A comprehensive Model Context Protocol (MCP) server that enables AI assistants to interact with yo…
Operate Linux, macOS and Windows from your LLM. Every action runs through an auditable allowlist.
A Model Context Protocol server for Wix AI tools
Enable secure connectivity between Sentry issues and debugging data, and LLM clients, using a Model Context Protocol (MCP) server.
Related MCP Servers
- AlicenseAqualityFmaintenanceProvides a Model Context Protocol server for executing AppleScript and JavaScript for Automation scripts on macOS, featuring a knowledge base of pre-defined scripts and supporting automation of macOS applications and system functions.21,697 npm882MIT
- FlicenseNot gradedqualityDmaintenanceEnables programmatic execution of coding tasks and autonomous file operations using Claude AI. It allows agents to search codebases, run shell commands, and track file changes through the Model Context Protocol.-
- AlicenseNot gradedqualityDmaintenanceEnables execution of ROS 2 CLI commands through the Model Context Protocol, supporting configurable timeouts, working directories, and secure command whitelisting.MIT
- AlicenseAqualityDmaintenanceEnables LLMs to interact with Python environments, execute code, manage files, and handle packages through the Model Context Protocol.9MIT