Repository navigation
Expand file tree
/
Copy pathsetup.sh
More file actions
executable file
·292 lines (253 loc) · 8.05 KB
/
Copy pathsetup.sh
File metadata and controls
executable file
·292 lines (253 loc) · 8.05 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
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
#!/usr/bin/env bash
set -e
# MCP Marketing Suite installer
# Installs all eight MCPs and prints a Claude config snippet.
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
BOLD='\033[1m'
RESET='\033[0m'
ok() { echo -e "${GREEN}✓${RESET} $1"; }
warn() { echo -e "${YELLOW}⚠${RESET} $1"; }
fail() { echo -e "${RED}✗${RESET} $1"; }
hdr() { echo -e "\n${BOLD}$1${RESET}"; }
# ── dependency checks ──────────────────────────────────────────────────────────
hdr "Checking dependencies"
HAS_NODE=false
HAS_NPM=false
HAS_PYTHON=false
HAS_PIP=false
if command -v node &>/dev/null; then
NODE_VERSION=$(node --version | sed 's/v//')
NODE_MAJOR=$(echo "$NODE_VERSION" | cut -d. -f1)
if [ "$NODE_MAJOR" -ge 18 ]; then
ok "Node.js $NODE_VERSION"
HAS_NODE=true
else
warn "Node.js $NODE_VERSION found but ≥18 is required"
fi
else
warn "Node.js not found — skipping npm MCPs (Google Ads, Bing Ads, LinkedIn, Reddit, GA4, GSC, GTM+GA4)"
fi
if command -v npm &>/dev/null; then
HAS_NPM=true
fi
# Prefer uv → pip3 → pip for Python
PIP_CMD=""
if command -v uv &>/dev/null; then
PIP_CMD="uv pip install"
PYTHON_VER=$(python3 --version 2>/dev/null || echo "unknown")
ok "uv found ($PYTHON_VER)"
HAS_PYTHON=true
HAS_PIP=true
elif command -v pip3 &>/dev/null; then
PIP_CMD="pip3 install"
PYTHON_VER=$(python3 --version 2>/dev/null || echo "unknown")
ok "Python $PYTHON_VER (pip3)"
HAS_PYTHON=true
HAS_PIP=true
elif command -v pip &>/dev/null; then
PIP_CMD="pip install"
PYTHON_VER=$(python --version 2>/dev/null || echo "unknown")
ok "Python $PYTHON_VER (pip)"
HAS_PYTHON=true
HAS_PIP=true
else
warn "Python/pip not found — skipping Meta Ads MCP"
fi
if [ "$HAS_NODE" = false ] && [ "$HAS_PYTHON" = false ]; then
fail "Neither Node.js nor Python found. Install at least one and re-run."
exit 1
fi
# ── install npm MCPs ───────────────────────────────────────────────────────────
NPM_INSTALLED=()
NPM_FAILED=()
if [ "$HAS_NODE" = true ] && [ "$HAS_NPM" = true ]; then
hdr "Installing npm MCPs"
for pkg in mcp-google-ads mcp-bing-ads mcp-linkedin-ads mcp-reddit-ads mcp-ga4 mcp-google-gsc mcp-gtm-ga4; do
if npm install -g "$pkg" &>/dev/null; then
ok "$pkg"
NPM_INSTALLED+=("$pkg")
else
fail "$pkg (install failed)"
NPM_FAILED+=("$pkg")
fi
done
fi
# ── install Python MCPs ────────────────────────────────────────────────────────
PIP_INSTALLED=()
PIP_FAILED=()
if [ "$HAS_PIP" = true ]; then
hdr "Installing Python MCPs"
if $PIP_CMD meta-ads-mcp &>/dev/null; then
ok "meta-ads-mcp"
PIP_INSTALLED+=("meta-ads-mcp")
else
fail "meta-ads-mcp (install failed)"
PIP_FAILED+=("meta-ads-mcp")
fi
fi
# ── locate installed binaries ──────────────────────────────────────────────────
NODE_MODULES_BIN=""
if [ "$HAS_NODE" = true ]; then
# Prefer global node_modules
NPM_PREFIX=$(npm prefix -g 2>/dev/null || echo "")
if [ -n "$NPM_PREFIX" ]; then
NODE_MODULES_BIN="$NPM_PREFIX/lib/node_modules"
fi
fi
PYTHON_BIN=$(command -v python3 2>/dev/null || command -v python 2>/dev/null || echo "python3")
# ── print Claude config snippet ────────────────────────────────────────────────
hdr "Claude config snippet"
echo ""
echo "Add the following to ~/.claude/settings.json (Claude Code)"
echo "or ~/Library/Application Support/Claude/claude_desktop_config.json (Claude Desktop):"
echo ""
echo '```json'
ENTRIES=()
if [[ " ${NPM_INSTALLED[*]} " =~ " mcp-google-ads " ]]; then
ENTRIES+=("$(cat <<'EOF'
"google-ads": {
"command": "node",
"args": ["NMBIN/mcp-google-ads/dist/index.js"],
"env": {
"GOOGLE_ADS_DEVELOPER_TOKEN": "YOUR_DEVELOPER_TOKEN",
"GOOGLE_ADS_CLIENT_ID": "YOUR_CLIENT_ID",
"GOOGLE_ADS_CLIENT_SECRET": "YOUR_CLIENT_SECRET",
"GOOGLE_ADS_REFRESH_TOKEN": "YOUR_REFRESH_TOKEN"
}
}
EOF
)")
fi
if [[ " ${NPM_INSTALLED[*]} " =~ " mcp-bing-ads " ]]; then
ENTRIES+=("$(cat <<'EOF'
"bing-ads": {
"command": "node",
"args": ["NMBIN/mcp-bing-ads/dist/index.js"],
"env": {
"BING_ADS_DEVELOPER_TOKEN": "YOUR_DEVELOPER_TOKEN",
"BING_ADS_CLIENT_ID": "YOUR_CLIENT_ID",
"BING_ADS_REFRESH_TOKEN": "YOUR_REFRESH_TOKEN"
}
}
EOF
)")
fi
if [[ " ${NPM_INSTALLED[*]} " =~ " mcp-linkedin-ads " ]]; then
ENTRIES+=("$(cat <<'EOF'
"linkedin-ads": {
"command": "node",
"args": ["NMBIN/mcp-linkedin-ads/dist/index.js"],
"env": {
"LINKEDIN_CLIENT_ID": "YOUR_CLIENT_ID",
"LINKEDIN_CLIENT_SECRET": "YOUR_CLIENT_SECRET",
"LINKEDIN_REFRESH_TOKEN": "YOUR_REFRESH_TOKEN"
}
}
EOF
)")
fi
if [[ " ${NPM_INSTALLED[*]} " =~ " mcp-reddit-ads " ]]; then
ENTRIES+=("$(cat <<'EOF'
"reddit-ads": {
"command": "node",
"args": ["NMBIN/mcp-reddit-ads/dist/index.js"],
"env": {
"REDDIT_CLIENT_ID": "YOUR_CLIENT_ID",
"REDDIT_CLIENT_SECRET": "YOUR_CLIENT_SECRET",
"REDDIT_REFRESH_TOKEN": "YOUR_REFRESH_TOKEN"
}
}
EOF
)")
fi
if [[ " ${NPM_INSTALLED[*]} " =~ " mcp-ga4 " ]]; then
ENTRIES+=("$(cat <<'EOF'
"ga4": {
"command": "node",
"args": ["NMBIN/mcp-ga4/dist/index.js"],
"env": {
"GA4_PROPERTY_ID": "YOUR_PROPERTY_ID",
"GOOGLE_APPLICATION_CREDENTIALS": "/path/to/service-account.json"
}
}
EOF
)")
fi
if [[ " ${NPM_INSTALLED[*]} " =~ " mcp-google-gsc " ]]; then
ENTRIES+=("$(cat <<'EOF'
"gsc": {
"command": "node",
"args": ["NMBIN/mcp-google-gsc/dist/index.js"],
"env": {
"GOOGLE_APPLICATION_CREDENTIALS": "/path/to/service-account.json"
}
}
EOF
)")
fi
if [[ " ${NPM_INSTALLED[*]} " =~ " mcp-gtm-ga4 " ]]; then
ENTRIES+=("$(cat <<'EOF'
"gtm-ga4": {
"command": "node",
"args": ["NMBIN/mcp-gtm-ga4/dist/index.js"],
"env": {
"GTM_ACCOUNT_ID": "YOUR_ACCOUNT_ID",
"GTM_CONTAINER_ID": "YOUR_CONTAINER_ID",
"GA4_PROPERTY_ID": "YOUR_PROPERTY_ID",
"GOOGLE_APPLICATION_CREDENTIALS": "/path/to/service-account.json"
}
}
EOF
)")
fi
if [[ " ${PIP_INSTALLED[*]} " =~ " meta-ads-mcp " ]]; then
ENTRIES+=("$(cat <<'EOF'
"meta-ads": {
"command": "PYBIN",
"args": ["-m", "meta_ads_mcp"],
"env": {
"META_ACCESS_TOKEN": "YOUR_SYSTEM_USER_TOKEN"
}
}
EOF
)")
fi
# Substitute placeholders
echo "{"
echo " \"mcpServers\": {"
for i in "${!ENTRIES[@]}"; do
entry="${ENTRIES[$i]}"
entry="${entry//NMBIN/$NODE_MODULES_BIN}"
entry="${entry//PYBIN/$PYTHON_BIN}"
if [ "$i" -lt $((${#ENTRIES[@]} - 1)) ]; then
echo "$entry,"
else
echo "$entry"
fi
done
echo " }"
echo "}"
echo '```'
# ── summary ────────────────────────────────────────────────────────────────────
hdr "Summary"
TOTAL_INSTALLED=$(( ${#NPM_INSTALLED[@]} + ${#PIP_INSTALLED[@]} ))
TOTAL_FAILED=$(( ${#NPM_FAILED[@]} + ${#PIP_FAILED[@]} ))
echo "$TOTAL_INSTALLED of 8 MCPs installed."
if [ $TOTAL_FAILED -gt 0 ]; then
echo ""
warn "Failed installs:"
for pkg in "${NPM_FAILED[@]}" "${PIP_FAILED[@]}"; do
echo " - $pkg"
done
echo ""
echo "Run 'npm install $pkg' or 'pip install $pkg' manually and check for errors."
fi
echo ""
echo "Next steps:"
echo " 1. Fill in the credential placeholders in the config snippet above"
echo " 2. See docs/ for per-platform credential setup guides"
echo " 3. Restart Claude Code / Claude Desktop"
echo ""
echo "Docs: https://github.com/mharnett/mcp-marketing-suite"