-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·182 lines (152 loc) · 4.79 KB
/
install.sh
File metadata and controls
executable file
·182 lines (152 loc) · 4.79 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
#!/usr/bin/env bash
set -euo pipefail
INSTALL_DIR="$HOME/.atoms"
BIN_NAME="atoms-mcp"
BASE_URL="https://github.com/aryasmol/atoms-mcp-server/releases/latest/download"
print_step() { printf "\n\033[1;34m→\033[0m %s\n" "$1"; }
print_ok() { printf " \033[1;32m✓\033[0m %s\n" "$1"; }
print_err() { printf " \033[1;31m✗\033[0m %s\n" "$1" >&2; }
detect_platform() {
local os arch
os="$(uname -s)"
arch="$(uname -m)"
case "$os" in
Darwin) os="darwin" ;;
Linux) os="linux" ;;
*) print_err "Unsupported OS: $os"; exit 1 ;;
esac
case "$arch" in
x86_64|amd64) arch="x64" ;;
arm64|aarch64) arch="arm64" ;;
*) print_err "Unsupported architecture: $arch"; exit 1 ;;
esac
echo "${os}-${arch}"
}
get_api_key() {
if [ -n "${ATOMS_API_KEY:-}" ]; then
return
fi
printf "\n Enter your Atoms API key (from console.smallest.ai → API Keys): "
read -r ATOMS_API_KEY
if [ -z "$ATOMS_API_KEY" ]; then
print_err "API key is required."
exit 1
fi
}
download_binary() {
local platform="$1"
local url="${BASE_URL}/${BIN_NAME}-${platform}"
local dest="${INSTALL_DIR}/${BIN_NAME}"
mkdir -p "$INSTALL_DIR"
print_step "Downloading atoms-mcp for ${platform}..."
if command -v curl &>/dev/null; then
curl -fsSL "$url" -o "$dest"
elif command -v wget &>/dev/null; then
wget -qO "$dest" "$url"
else
print_err "Neither curl nor wget found. Install one and try again."
exit 1
fi
chmod +x "$dest"
print_ok "Installed to ${dest}"
}
configure_cursor() {
local config_dir config_file
config_dir="$HOME/.cursor"
config_file="${config_dir}/mcp.json"
mkdir -p "$config_dir"
if [ -f "$config_file" ]; then
if grep -q '"atoms"' "$config_file" 2>/dev/null; then
print_ok "Cursor config already has atoms entry — updating API key"
local tmp
tmp=$(mktemp)
sed "s|ATOMS_API_KEY.*|ATOMS_API_KEY\": \"${ATOMS_API_KEY}\"|" "$config_file" > "$tmp"
mv "$tmp" "$config_file"
return
fi
if grep -q '"mcpServers"' "$config_file" 2>/dev/null; then
local tmp
tmp=$(mktemp)
sed 's/"mcpServers"[[:space:]]*:[[:space:]]*{/"mcpServers": {\
"atoms": {\
"command": "INSTALL_DIR_PLACEHOLDER\/atoms-mcp",\
"env": {\
"ATOMS_API_KEY": "API_KEY_PLACEHOLDER"\
}\
},/' "$config_file" \
| sed "s|INSTALL_DIR_PLACEHOLDER|${INSTALL_DIR}|g" \
| sed "s|API_KEY_PLACEHOLDER|${ATOMS_API_KEY}|g" > "$tmp"
mv "$tmp" "$config_file"
print_ok "Added atoms to existing Cursor config"
return
fi
fi
cat > "$config_file" << JSONEOF
{
"mcpServers": {
"atoms": {
"command": "${INSTALL_DIR}/atoms-mcp",
"env": {
"ATOMS_API_KEY": "${ATOMS_API_KEY}"
}
}
}
}
JSONEOF
print_ok "Created Cursor config at ${config_file}"
}
configure_claude() {
local config_dir config_file
case "$(uname -s)" in
Darwin) config_dir="$HOME/Library/Application Support/Claude" ;;
Linux) config_dir="$HOME/.config/claude" ;;
*) return ;;
esac
config_file="${config_dir}/claude_desktop_config.json"
mkdir -p "$config_dir"
if [ -f "$config_file" ] && grep -q '"atoms"' "$config_file" 2>/dev/null; then
print_ok "Claude Desktop config already has atoms entry"
return
fi
if [ ! -f "$config_file" ] || [ ! -s "$config_file" ]; then
cat > "$config_file" << JSONEOF
{
"mcpServers": {
"atoms": {
"command": "${INSTALL_DIR}/atoms-mcp",
"env": {
"ATOMS_API_KEY": "${ATOMS_API_KEY}"
}
}
}
}
JSONEOF
print_ok "Created Claude Desktop config at ${config_file}"
else
print_ok "Claude Desktop config exists — add atoms manually if needed"
fi
}
main() {
echo ""
echo " ╔══════════════════════════════════════╗"
echo " ║ Atoms MCP Server Installer ║"
echo " ╚══════════════════════════════════════╝"
local platform
platform="$(detect_platform)"
get_api_key
download_binary "$platform"
print_step "Configuring editors..."
configure_cursor
configure_claude
echo ""
echo " ┌──────────────────────────────────────┐"
echo " │ Done! Restart your editor to start. │"
echo " │ │"
echo " │ Cursor: Cmd+Shift+P → Reload Window │"
echo " │ Claude: Quit and reopen the app │"
echo " │ │"
echo " │ Then type: \"List all my agents\" │"
echo " └──────────────────────────────────────┘"
echo ""
}
main "$@"