-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjustfile
More file actions
371 lines (316 loc) · 10.6 KB
/
justfile
File metadata and controls
371 lines (316 loc) · 10.6 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
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
#!/usr/bin/env -S just --justfile
# Recommend installing completion scripts: https://just.systems/man/en/shell-completion-scripts.html
# Recommend installing vscode extension: https://just.systems/man/en/visual-studio-code.html
# MCPing - macOS Notification MCP Server
# Commands for development, testing, and running the notification server
# Default recipe - show available commands
_default:
@just -l -u
# Brew installation
[group('setup')]
brew:
brew update & brew bundle install --file=./Brewfile
# Recursively sync git submodules
[group('git')]
sync-submodules:
git submodule update --init --recursive
# Show git status
[group('git')]
git-status:
git status
# Create a new git branch
[group('git')]
git-branch name:
git checkout -b {{ name }}
# Initial project setup
[group('setup')]
setup: brew
npm install
npm run build
@echo "✅ Setup complete!"
# Run development mode
[group('dev')]
dev:
npm run dev
# Run the server with stdio transport (for Claude Code)
[group('run')]
run-stdio:
npm start
# Run the server with HTTP transport
[group('run')]
run-http port="3000":
npm start -- --transport http --port {{ port }}
# Run the server with verbose logging
[group('run')]
run-verbose transport="stdio":
npm start -- --transport {{ transport }} --verbose
# Send a test notification (requires HTTP server running)
[group('test')]
test-notify title="Test Notification" message="Hello from MCPing!" port="3000":
@echo "📤 Sending test notification..."
@curl -s -X POST http://localhost:{{ port }}/mcp \
-H "Content-Type: application/json" \
-d '{ \
"jsonrpc": "2.0", \
"id": 1, \
"method": "tools/call", \
"params": { \
"name": "send-notification", \
"arguments": { \
"title": "{{ title }}", \
"message": "{{ message }}", \
"sound": "Ping" \
} \
} \
}' | jq -r '.result.content[0].text' | jq .
# Send a critical notification
[group('test')]
test-critical title="Critical Alert" message="This is urgent!" port="3000":
@echo "🚨 Sending critical notification..."
@curl -s -X POST http://localhost:{{ port }}/mcp \
-H "Content-Type: application/json" \
-d '{ \
"jsonrpc": "2.0", \
"id": 1, \
"method": "tools/call", \
"params": { \
"name": "send-notification", \
"arguments": { \
"title": "{{ title }}", \
"message": "{{ message }}", \
"urgency": "critical", \
"sound": true, \
"timeout": 30 \
} \
} \
}' | jq -r '.result.content[0].text' | jq .
# Send a quiet notification
[group('test')]
test-quiet title="Info" message="Background task complete" port="3000":
@echo "🔕 Sending quiet notification..."
@curl -s -X POST http://localhost:{{ port }}/mcp \
-H "Content-Type: application/json" \
-d '{ \
"jsonrpc": "2.0", \
"id": 1, \
"method": "tools/call", \
"params": { \
"name": "send-notification", \
"arguments": { \
"title": "{{ title }}", \
"message": "{{ message }}", \
"urgency": "low", \
"sound": false, \
"timeout": 5 \
} \
} \
}' | jq -r '.result.content[0].text' | jq .
# Run tests
[group('test')]
test:
npm run test
# Run unit tests only
[group('test')]
test-unit:
npm run test:unit
# Run integration tests only
[group('test')]
test-integration:
npm run test:integration
# Run tests in watch mode
[group('test')]
test-watch:
npm run test:watch
# Build the project
[group('build')]
build:
npm run build
# Type check the project
[group('build')]
typecheck:
npx tsc --noEmit
# Clean build artifacts and dependencies
[group('clean')]
clean:
rm -rf dist/
rm -rf node_modules/
rm -rf coverage/
rm -f *.tgz
@echo "✅ Clean complete!"
# Format code
[group('lint')]
format:
@echo "Formatting JSON files..."
@prettier --write "**/*.json" --ignore-path .gitignore || true
@echo "Formatting Markdown files..."
@markdownlint-cli2 --fix "**/*.md" "#node_modules" "#.git" || true
@echo "Formatting complete!"
# Lint code
[group('lint')]
lint:
@echo "Linting JSON files..."
@prettier --check "**/*.json" --ignore-path .gitignore || echo "Prettier not available, skipping JSON linting"
@echo "Linting Markdown files..."
@markdownlint-cli2 "**/*.md" "#node_modules" "#.git" || echo "Markdownlint not available, skipping Markdown linting"
@echo "Linting complete!"
# Pre-publish checks: build, test, lint, and typecheck
[group('publish')]
pre-publish-checks: build test lint typecheck
@echo "✅ All pre-publish checks passed!"
[group('publish')]
publish: pre-publish-checks
npm publish --access public
# Version bump and publish commands
[group('publish')]
publish-patch: pre-publish-checks
npm version patch --no-git-tag-version
npm publish --access public
[group('publish')]
publish-minor: pre-publish-checks
npm version minor --no-git-tag-version
npm publish --access public
[group('publish')]
publish-major: pre-publish-checks
npm version major --no-git-tag-version
npm publish --access public
[group('publish')]
publish-beta: pre-publish-checks
npm version prerelease --preid=beta --no-git-tag-version
npm publish --access public --tag beta
# Dry run commands
[group('publish')]
publish-dry-run-patch: pre-publish-checks
npm version patch --no-git-tag-version --dry-run
npm publish --dry-run --access public
[group('publish')]
publish-dry-run-minor: pre-publish-checks
npm version minor --no-git-tag-version --dry-run
npm publish --dry-run --access public
[group('publish')]
publish-dry-run-major: pre-publish-checks
npm version major --no-git-tag-version --dry-run
npm publish --dry-run --access public
[group('publish')]
publish-dry-run-beta: pre-publish-checks
npm version prerelease --preid=beta --no-git-tag-version --dry-run
npm publish --dry-run --access public --tag beta
# Test local installation
[group('publish')]
test-install: build
#!/usr/bin/env bash
echo "📦 Testing local installation..."
# Create package tarball
npm pack
# Install globally
PACKAGE_FILE=$(ls toolprint-mcping-mcp-*.tgz | head -1)
npm install -g "./$PACKAGE_FILE"
# Test installation
echo "🧪 Testing global command..."
mcping-mcp --version
echo "🧪 Testing npx execution..."
npx @toolprint/mcping-mcp --version
# Cleanup
npm uninstall -g @toolprint/mcping-mcp
rm -f toolprint-mcping-mcp-*.tgz
echo "✅ Local installation test completed!"
# Quick test workflow - build and send test notification
[group('test')]
quick-test: build
#!/usr/bin/env bash
set -e
echo "🚀 Starting MCPing server..."
npm start -- --transport http --port 8999 &
SERVER_PID=$!
# Wait for server to start
sleep 2
echo "📤 Sending test notifications..."
just test-notify "Build Complete" "All tests passed!" 8999
sleep 1
just test-critical "Test Failed" "3 tests failed" 8999
sleep 1
just test-quiet "Background Task" "Data sync complete" 8999
# Stop server
kill $SERVER_PID
echo "✅ Quick test completed!"
# Test new notification features with icon and sound
[group('test')]
test-features port="3000":
#!/usr/bin/env bash
set -e
echo "🚀 Starting MCPing server for feature testing..."
npm start -- --transport http --port {{ port }} &
SERVER_PID=$!
# Wait for server to start
sleep 2
echo "🔔 Testing built-in sound notifications..."
just test-notify-sound "Sound Test" "Testing Ping sound" "Ping" {{ port }}
sleep 1
just test-notify-sound "Sound Test" "Testing Glass sound" "Glass" {{ port }}
sleep 1
echo "🖼️ Testing with system icon..."
just test-notify-icon "Icon Test" "Testing with Finder icon" "/System/Library/CoreServices/Finder.app/Contents/Resources/Finder.icns" {{ port }}
sleep 1
echo "🌐 Testing with clickable URL..."
just test-notify-url "URL Test" "Click to open GitHub" "https://github.com/toolprint/mcping-mcp" {{ port }}
# Stop server
kill $SERVER_PID
echo "✅ Feature test completed!"
# Test notification with custom sound
[group('test')]
test-notify-sound title message sound port="3000":
@echo "🔔 Sending notification with {{ sound }} sound..."
@curl -s -X POST http://localhost:{{ port }}/mcp \
-H "Content-Type: application/json" \
-d '{ \
"jsonrpc": "2.0", \
"id": 1, \
"method": "tools/call", \
"params": { \
"name": "send-notification", \
"arguments": { \
"title": "{{ title }}", \
"message": "{{ message }}", \
"sound": "{{ sound }}" \
} \
} \
}' | jq -r '.result.content[0].text' | jq .
# Test notification with custom icon
[group('test')]
test-notify-icon title message icon port="3000":
@echo "🖼️ Sending notification with custom icon..."
@curl -s -X POST http://localhost:{{ port }}/mcp \
-H "Content-Type: application/json" \
-d '{ \
"jsonrpc": "2.0", \
"id": 1, \
"method": "tools/call", \
"params": { \
"name": "send-notification", \
"arguments": { \
"title": "{{ title }}", \
"message": "{{ message }}", \
"icon": "{{ icon }}", \
"sound": "Tink" \
} \
} \
}' | jq -r '.result.content[0].text' | jq .
# Test notification with clickable URL
[group('test')]
test-notify-url title message url port="3000":
@echo "🌐 Sending notification with clickable URL..."
@curl -s -X POST http://localhost:{{ port }}/mcp \
-H "Content-Type: application/json" \
-d '{ \
"jsonrpc": "2.0", \
"id": 1, \
"method": "tools/call", \
"params": { \
"name": "send-notification", \
"arguments": { \
"title": "{{ title }}", \
"message": "{{ message }}", \
"open": "{{ url }}", \
"sound": "Hero" \
} \
} \
}' | jq -r '.result.content[0].text' | jq .