Skip to main content
Glama
bmorphism
by bmorphism

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: macOS Automator MCP Server

Prerequisites

Install Babashka

Babashka can be installed in several ways:

macOS

brew install borkdude/brew/babashka

Linux

bash < <(curl -s https://raw.githubusercontent.com/babashka/babashka/master/install)

Windows

# Using scoop
scoop install babashka

For 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 build

Configuration

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

Community Tools & Libraries

Development Tools

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

  1. 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

  2. Enhanced Features

    • Add support for Babashka pods

    • Implement file watching capabilities

    • Add REPL integration

    • Support for multiple Babashka instances

  3. Performance Optimizations

    • Implement caching strategies

    • Optimize resource usage

    • Reduce startup time

  4. Testing & Documentation

    • Comprehensive test suite

    • API documentation

    • Usage examples

    • Performance benchmarks

Available Tools

1 tool
executeC

Execute Babashka (bb) code

ParametersJSON Schema
NameRequiredDescriptionDefault
codeYesBabashka code to execute
timeoutNoTimeout in milliseconds (default: 30000)

TDQS

C2.9/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden of behavioral disclosure. It states the action ('execute') but doesn't describe key behaviors like execution environment, security implications, error handling, or output format. This is a significant gap for a tool that runs arbitrary code.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence with zero waste. It's appropriately sized and front-loaded, clearly stating the tool's purpose without unnecessary elaboration.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the complexity of executing code and the lack of annotations and output schema, the description is incomplete. It doesn't address critical aspects like what the execution returns, error conditions, or safety considerations, leaving the agent with insufficient context for reliable use.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema fully documents both parameters (code and timeout). The description adds no additional meaning beyond what the schema provides, such as examples of valid Babashka code or timeout implications. Baseline 3 is appropriate when the schema does the heavy lifting.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the verb ('execute') and resource ('Babashka (bb) code'), making the purpose immediately understandable. It doesn't need sibling differentiation since there are no sibling tools, but it could be slightly more specific about what 'execute' entails (e.g., running code in a Babashka environment).

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool, such as typical use cases, prerequisites, or alternatives. With no sibling tools, it doesn't need to distinguish from others, but it lacks any context about appropriate scenarios for executing Babashka code.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections. Dates show when Glama detected each change.

  1. 1 tool updatev1.0.0
    • First observedexecute

TDQS

B3.2/5.0
Disambiguation5/5

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.

Naming Consistency5/5

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.

Tool Count2/5

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.

Completeness3/5

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

ActivityInactive
ResponsivenessNo issues

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Connectors

Related MCP Servers

  • A
    license
    A
    quality
    A
    maintenance
    Provides 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.
    2
    1,294
    878
    MIT
  • A
    license
    A
    quality
    D
    maintenance
    A Model Context Protocol server that enables execution of AppleScript and JavaScript for Automation scripts on macOS, allowing programmatic control of applications and system functions through a rich knowledge base of pre-defined scripts.
    2
    1,294
    8
    MIT
  • A
    license
    Not graded
    quality
    D
    maintenance
    Enables execution of ROS 2 CLI commands through the Model Context Protocol, supporting configurable timeouts, working directories, and secure command whitelisting.
    MIT

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/bmorphism/babashka-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server