-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathtest-mixpanel.js
More file actions
executable file
·50 lines (40 loc) · 1.41 KB
/
Copy pathtest-mixpanel.js
File metadata and controls
executable file
·50 lines (40 loc) · 1.41 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
#!/usr/bin/env node
/**
* Test script for Mixpanel MCP Server
* This sends a test event to Mixpanel using our custom client
*/
import { Command } from 'commander';
import { MixpanelClient } from './mixpanel-client.js';
// Parse command line arguments
const program = new Command();
program
.name('test-mixpanel')
.description('Test Mixpanel connectivity')
.version('1.0.0')
.requiredOption('--token <string>', 'Your Mixpanel project token')
.parse();
const options = program.opts();
const mixpanelToken = options.token;
console.log(`Testing Mixpanel connection with token: ${mixpanelToken.substring(0, 3)}...`);
// Initialize Mixpanel client
const mixpanel = new MixpanelClient(mixpanelToken);
// Run test
async function runTest() {
console.log('Sending test event to Mixpanel...');
try {
// Send a test event
const result = await mixpanel.trackEvent('mcp_server_test', {
distinct_id: 'test_user',
timestamp: new Date().toISOString(),
test: true,
$ip: 0 // Disable geolocation
});
console.log('Test event sent successfully:', result);
console.log('Test event sent to Mixpanel. Check your Mixpanel project events to confirm it was received.');
console.log('Note: There may be a delay before the event appears in the Mixpanel UI.');
} catch (error) {
console.error('Error sending test event to Mixpanel:', error.message);
process.exit(1);
}
}
runTest();