Skip to main content
Glama

Babashka MCP Server

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

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
Install Server
A
security – no known vulnerabilities
F
license - not found
A
quality - confirmed to work

local-only server

The server can only run on the client's local machine because it depends on local resources.

Tools

Enables execution and management of Babashka scripts using the Model Context Protocol, offering features like caching, command history access, and configurable timeouts for enhanced scripting workflows.

  1. Features
    1. Prerequisites
      1. Install Babashka
      2. Verify Installation
    2. Installation
      1. Configuration
        1. Tools
          1. execute
        2. Resources
          1. Babashka Language Features
            1. Tail Call Optimization (TCO)
          2. Useful Resources
            1. Official Resources
            2. Community Tools & Libraries
            3. Development Tools
          3. Development
            1. Roadmap

              Related MCP Servers

              • -
                security
                F
                license
                -
                quality
                A Model Context Protocol server that allows management and execution of Blender Python scripts, enabling users to create, edit and run scripts in a headless Blender environment through natural language interfaces.
                Last updated -
                8
                Python
              • -
                security
                A
                license
                -
                quality
                A TypeScript server implementing the Model Context Protocol that enables AI agents to interact with the Akash Network, allowing them to deploy applications, create leases, manage deployments, and access other Akash services through typed tools.
                Last updated -
                7
                TypeScript
                Apache 2.0
                • Apple
              • -
                security
                F
                license
                -
                quality
                Implements the Model Context Protocol to provide LLMs with tools for interacting with Supabase databases, supporting operations like reading, creating, updating, and deleting records with filtering and pagination capabilities.
                Last updated -
                Python
                • Linux
                • Apple
              • A
                security
                A
                license
                A
                quality
                A Model Context Protocol server that enables running AppleScript code to interact with Mac applications and system features including Notes, Calendar, Contacts, Messages, file management, and more.
                Last updated -
                1
                569
                312
                JavaScript
                MIT License
                • Apple

              View all related MCP servers

              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