Babashka MCP Server
Babashka MCP 服务器
用于与Babashka (用于脚本的本机 Clojure 解释器)交互的模型上下文协议服务器。
特征
通过 MCP 工具执行 Babashka 代码
缓存最近的命令结果
通过 MCP 资源访问命令历史记录
可配置命令超时
Related MCP server: Claude Code Control MCP
先决条件
安装 Babashka
Babashka 可以通过多种方式安装:
macOS
brew install borkdude/brew/babashkaLinux
bash < <(curl -s https://raw.githubusercontent.com/babashka/babashka/master/install)视窗
# Using scoop
scoop install babashka其他安装方法请参见Babashka官方安装指南。
验证安装
安装后,验证 Babashka 是否正常工作:
# 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*)'安装
# Install dependencies
npm install
# Build the MCP server
npm run build配置
可以通过环境变量配置服务器:
BABASHKA_PATH:Babashka 可执行文件的路径(默认值:“bb”)
工具
执行
使用可选超时执行 Babashka 代码:
{
name: "execute",
arguments: {
code: string; // Babashka code to execute
timeout?: number; // Timeout in milliseconds (default: 30000)
}
}例子:
{
name: "execute",
arguments: {
code: "(+ 1 2 3)",
timeout: 5000
}
}资源
服务器维护最近执行的命令的缓存,可通过以下方式访问:
babashka://commands/{index}- 通过索引访问特定的命令结果
Babashka 语言功能
尾部调用优化(TCO)
Babashka 通过recur特殊形式支持显式尾调用优化,但不实现自动 TCO。例如:
;; 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))))有用的资源
官方资源
Babashka GitHub 存储库- 主要 Babashka 项目
Babashka Book - 官方文档
Babashka 示例- 示例脚本集合
社区工具和图书馆
pod-babashka-buddy -Babashka 的加密 API
bb-clis - 有用的 Babashka CLI 脚本集合
bb-scripts - Babashka 的各种实用脚本
开发工具
setup-babashka - 用于安装 Babashka 的 GitHub Actions
babashka-docker-action - 在 GitHub Actions 中运行 Babashka 脚本
发展
该服务器最终设计为自托管,这意味着它将用 Babashka 本身重写。当前的 TypeScript 实现可作为参考和起点。
路线图
自托管实施
使用 Babashka 重写 MCP 服务器
利用 Babashka 的原生功能获得更好的性能
删除 Node.js 依赖项
保持与 MCP 协议的完全兼容
支持所有当前功能:
命令执行
资源管理
命令历史记录
超时处理
增强功能
添加对 Babashka pods 的支持
实现文件监视功能
添加 REPL 集成
支持多个 Babashka 实例
性能优化
实施缓存策略
优化资源使用
减少启动时间
测试与文档
综合测试套件
API 文档
使用示例
性能基准
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) |
TDQS
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.
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.
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.
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.
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.
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.
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.22,131 npm885MIT
- 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