@chandshantanu/agentbuilder-mcp-server 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,154 @@
1
+ #!/usr/bin/env node
2
+
3
+ /**
4
+ * Test script to verify MCP server can connect to AgentBuilder backend
5
+ *
6
+ * Usage: node test-connection.js
7
+ */
8
+
9
+ import axios from 'axios';
10
+ import { fileURLToPath } from 'url';
11
+ import { dirname } from 'path';
12
+
13
+ const __filename = fileURLToPath(import.meta.url);
14
+ const __dirname = dirname(__filename);
15
+
16
+ const API_URL = process.env.AGENTBUILDER_API_URL || 'http://127.0.0.1:8000';
17
+
18
+ async function testConnection() {
19
+ console.log('๐Ÿงช Testing AgentBuilder MCP Server Connection\n');
20
+ console.log('=' .repeat(60));
21
+ console.log(`API URL: ${API_URL}\n`);
22
+
23
+ // Test 1: Backend connectivity
24
+ console.log('Test 1: Backend Connectivity');
25
+ console.log('-'.repeat(60));
26
+
27
+ try {
28
+ const healthResponse = await axios.get(`${API_URL}/`, {
29
+ timeout: 5000,
30
+ validateStatus: () => true // Accept any status code
31
+ });
32
+ console.log(`โœ… Backend is reachable`);
33
+ console.log(` Status: ${healthResponse.status}`);
34
+ console.log(` Response: ${JSON.stringify(healthResponse.data).substring(0, 100)}...`);
35
+ } catch (error) {
36
+ if (error.code === 'ECONNREFUSED') {
37
+ console.log('โŒ Backend is NOT running');
38
+ console.log(` Error: Connection refused on ${API_URL}`);
39
+ console.log('\n๐Ÿ’ก Start the backend with:');
40
+ console.log(' cd backend && source venv/bin/activate');
41
+ console.log(' python -m uvicorn app.main:app --reload --port 8000');
42
+ process.exit(1);
43
+ } else {
44
+ console.log(`โŒ Backend error: ${error.message}`);
45
+ process.exit(1);
46
+ }
47
+ }
48
+ console.log();
49
+
50
+ // Test 2: API Endpoints
51
+ console.log('Test 2: API Endpoints');
52
+ console.log('-'.repeat(60));
53
+
54
+ try {
55
+ const docsResponse = await axios.get(`${API_URL}/docs`, {
56
+ timeout: 5000,
57
+ validateStatus: () => true
58
+ });
59
+ console.log(`โœ… API documentation accessible`);
60
+ console.log(` URL: ${API_URL}/docs`);
61
+ console.log(` Status: ${docsResponse.status}`);
62
+ } catch (error) {
63
+ console.log(`โš ๏ธ API docs not accessible (this might be okay)`);
64
+ }
65
+ console.log();
66
+
67
+ // Test 3: MongoDB connectivity (via backend)
68
+ console.log('Test 3: Database Connectivity');
69
+ console.log('-'.repeat(60));
70
+
71
+ try {
72
+ // Try to access a public endpoint that requires database
73
+ const workflowsResponse = await axios.get(`${API_URL}/api/v1/workflows`, {
74
+ timeout: 5000,
75
+ validateStatus: (status) => status < 500 // 401/403 is ok, 500+ is not
76
+ });
77
+
78
+ if (workflowsResponse.status === 401) {
79
+ console.log('โœ… Database is connected (auth required, as expected)');
80
+ console.log(` Status: ${workflowsResponse.status} Unauthorized`);
81
+ } else if (workflowsResponse.status === 200) {
82
+ console.log('โœ… Database is connected');
83
+ console.log(` Status: ${workflowsResponse.status} OK`);
84
+ } else {
85
+ console.log(`โš ๏ธ Database status unclear (HTTP ${workflowsResponse.status})`);
86
+ }
87
+ } catch (error) {
88
+ if (error.response && error.response.status < 500) {
89
+ console.log('โœ… Database is connected (backend responding)');
90
+ console.log(` Status: ${error.response.status}`);
91
+ } else {
92
+ console.log(`โŒ Database connection error: ${error.message}`);
93
+ }
94
+ }
95
+ console.log();
96
+
97
+ // Test 4: MCP OAuth endpoints
98
+ console.log('Test 4: MCP OAuth Endpoints');
99
+ console.log('-'.repeat(60));
100
+
101
+ try {
102
+ const mcpResponse = await axios.get(`${API_URL}/api/v1/mcp/connections`, {
103
+ timeout: 5000,
104
+ validateStatus: (status) => status < 500
105
+ });
106
+
107
+ if (mcpResponse.status === 401) {
108
+ console.log('โœ… MCP OAuth endpoints available (auth required)');
109
+ console.log(` Endpoint: /api/v1/mcp/connections`);
110
+ console.log(` Status: ${mcpResponse.status} Unauthorized`);
111
+ } else if (mcpResponse.status === 200) {
112
+ console.log('โœ… MCP OAuth endpoints available');
113
+ console.log(` Endpoint: /api/v1/mcp/connections`);
114
+ console.log(` Status: ${mcpResponse.status} OK`);
115
+ } else {
116
+ console.log(`โš ๏ธ MCP OAuth endpoint status: ${mcpResponse.status}`);
117
+ }
118
+ } catch (error) {
119
+ if (error.response && error.response.status === 404) {
120
+ console.log('โŒ MCP OAuth endpoints NOT found');
121
+ console.log(' The backend might be missing OAuth implementation');
122
+ } else if (error.response && error.response.status < 500) {
123
+ console.log('โœ… MCP OAuth endpoints available');
124
+ console.log(` Status: ${error.response.status}`);
125
+ } else {
126
+ console.log(`โŒ MCP endpoint error: ${error.message}`);
127
+ }
128
+ }
129
+ console.log();
130
+
131
+ // Summary
132
+ console.log('=' .repeat(60));
133
+ console.log('๐Ÿ“Š Connection Test Summary\n');
134
+ console.log('โœ… Backend is running and accessible');
135
+ console.log('โœ… MCP server is built and ready');
136
+ console.log('\n๐Ÿ“ Next Steps:\n');
137
+ console.log('1. Configure Claude Desktop with the MCP server:');
138
+ console.log(` - Copy config from: ${__dirname}/claude_desktop_config.example.json`);
139
+ console.log(' - Paste into: ~/Library/Application Support/Claude/claude_desktop_config.json');
140
+ console.log('\n2. Restart Claude Desktop to load the MCP server');
141
+ console.log('\n3. In Claude, test the connection:');
142
+ console.log(' User: "Use set_auth_token with a test token"');
143
+ console.log(' OR');
144
+ console.log(' User: "Connect to AgentBuilder using connection ID mcp_conn_xxx"');
145
+ console.log('\n4. Create a workflow:');
146
+ console.log(' User: "Create a simple workflow that sends a welcome email"');
147
+ console.log('\n=' .repeat(60));
148
+ }
149
+
150
+ // Run tests
151
+ testConnection().catch(error => {
152
+ console.error('\nโŒ Unexpected error:', error.message);
153
+ process.exit(1);
154
+ });
package/tsconfig.json ADDED
@@ -0,0 +1,21 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ES2022",
4
+ "module": "Node16",
5
+ "moduleResolution": "Node16",
6
+ "lib": ["ES2022"],
7
+ "outDir": "./dist",
8
+ "rootDir": "./src",
9
+ "strict": true,
10
+ "esModuleInterop": true,
11
+ "skipLibCheck": true,
12
+ "forceConsistentCasingInFileNames": true,
13
+ "resolveJsonModule": true,
14
+ "declaration": true,
15
+ "declarationMap": true,
16
+ "sourceMap": true,
17
+ "types": ["node"]
18
+ },
19
+ "include": ["src/**/*"],
20
+ "exclude": ["node_modules", "dist"]
21
+ }