Created
May 26, 2025 02:22
-
-
Save bmorphism/37821c4ff9fde29afa8add82c89d7531 to your computer and use it in GitHub Desktop.
Babashka MCP Server Configuration in Nickel
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Babashka MCP Server Configuration in Nickel | |
# Examples for both Goose and Claude Desktop / Code targets | |
# Define the babashka server configuration | |
let babashka_server_path = "/Users/barton/infinity-topos/topOS-release/mcp-servers/babashka-mcp-server/build/index.js" in | |
# Babashka server base configuration | |
let babashka_base = { | |
name = "babashka", | |
command = "node", | |
args = [babashka_server_path], | |
description = "Babashka MCP server for Clojure scripting and evaluation", | |
environment = {}, # Add any required environment variables here | |
} in | |
# Target 1: Goose Configuration | |
let babashka_for_goose = { | |
# All fields required for Goose's extensions | |
name = babashka_base.name, | |
type = "stdio", # Goose requires explicit type | |
cmd = babashka_base.command, # Goose uses 'cmd' instead of 'command' | |
args = babashka_base.args, | |
enabled = true, | |
envs = babashka_base.environment, # Goose uses 'envs' instead of 'env' | |
env_keys = std.record.fields babashka_base.environment, | |
bundled = null, | |
timeout = null, | |
description = babashka_base.description, | |
} in | |
# Target 2: Claude Desktop Configuration | |
let babashka_for_claude = { | |
# Minimal fields for Claude Desktop | |
command = babashka_base.command, | |
args = babashka_base.args, | |
# Only include env if there are environment variables | |
} & (if std.record.is_empty babashka_base.environment then {} else { env = babashka_base.environment }) in | |
# Example with environment variables (if babashka needed them) | |
let babashka_with_env = { | |
name = "babashka", | |
command = "node", | |
args = [babashka_server_path], | |
description = "Babashka MCP server with custom environment", | |
environment = { | |
BABASHKA_CLASSPATH = "/Users/barton/infinity-topos/topoi/src", | |
BABASHKA_PODS_DIR = "/Users/barton/.babashka/pods", | |
DEBUG = "false", | |
}, | |
} in | |
# Convert the environment example to both targets | |
let babashka_env_goose = { | |
name = babashka_with_env.name, | |
type = "stdio", | |
cmd = babashka_with_env.command, | |
args = babashka_with_env.args, | |
enabled = true, | |
envs = babashka_with_env.environment, | |
env_keys = ["BABASHKA_CLASSPATH", "BABASHKA_PODS_DIR", "DEBUG"], | |
bundled = null, | |
timeout = null, | |
description = babashka_with_env.description, | |
} in | |
let babashka_env_claude = { | |
command = babashka_with_env.command, | |
args = babashka_with_env.args, | |
env = babashka_with_env.environment, | |
} in | |
# Complete configuration examples | |
let goose_config_example = { | |
# This would go in ~/.config/goose/config.yaml | |
extensions = { | |
babashka = babashka_for_goose, | |
# Other servers... | |
}, | |
# Other Goose configuration fields | |
version = "1.0", | |
} in | |
let claude_config_example = { | |
# This would go in ~/Library/Application Support/Claude/claude_desktop_config.json | |
mcpServers = { | |
babashka = babashka_for_claude, | |
# Other servers... | |
}, | |
} in | |
# Alternative: Using npx to run babashka server (if published to npm) | |
let babashka_npx_base = { | |
name = "babashka", | |
command = "npx", | |
args = ["-y", "@your-org/babashka-mcp-server"], | |
description = "Babashka MCP server via npx", | |
environment = {}, | |
} in | |
# Export all configurations | |
{ | |
# Basic configurations | |
goose = { | |
basic = babashka_for_goose, | |
with_env = babashka_env_goose, | |
}, | |
claude = { | |
basic = babashka_for_claude, | |
with_env = babashka_env_claude, | |
}, | |
# Complete config file examples | |
full_configs = { | |
goose_yaml = goose_config_example, | |
claude_json = claude_config_example, | |
}, | |
# Utility function to generate both from unified config | |
generate_both = fun config => { | |
goose = { | |
name = config.name, | |
type = "stdio", | |
cmd = config.command, | |
args = config.args, | |
enabled = config.enabled | default = true, | |
envs = config.environment | default = {}, | |
env_keys = std.record.fields (config.environment | default = {}), | |
bundled = null, | |
timeout = config.timeout | default = null, | |
description = config.description | default = null, | |
}, | |
claude = { | |
command = config.command, | |
args = config.args, | |
} & (if std.record.is_empty (config.environment | default = {}) then {} else { env = config.environment }), | |
}, | |
# Example usage of the generator | |
generated_example = (fun config => { | |
goose = { | |
name = config.name, | |
type = "stdio", | |
cmd = config.command, | |
args = config.args, | |
enabled = config.enabled | default = true, | |
envs = config.environment | default = {}, | |
env_keys = std.record.fields (config.environment | default = {}), | |
bundled = null, | |
timeout = config.timeout | default = null, | |
description = config.description | default = null, | |
}, | |
claude = { | |
command = config.command, | |
args = config.args, | |
} & (if std.record.is_empty (config.environment | default = {}) then {} else { env = config.environment }), | |
}) babashka_base, | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment