@aibuilders/mcp-coach-server 1.0.8 → 1.0.9
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.
- package/dist/index.js +96 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -333,6 +333,94 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
|
333
333
|
]
|
|
334
334
|
};
|
|
335
335
|
}
|
|
336
|
+
case "get_base_url": {
|
|
337
|
+
let baseUrl = "https://space.ai-builders.com/backend";
|
|
338
|
+
let source = "default";
|
|
339
|
+
try {
|
|
340
|
+
const response = await fetch("https://space.ai-builders.com/backend/openapi.json");
|
|
341
|
+
if (response.ok) {
|
|
342
|
+
const openapiSpec = await response.json();
|
|
343
|
+
try {
|
|
344
|
+
if (openapiSpec?.servers?.length) {
|
|
345
|
+
const url = openapiSpec.servers[0].url;
|
|
346
|
+
if (url.startsWith("http")) {
|
|
347
|
+
baseUrl = url;
|
|
348
|
+
}
|
|
349
|
+
else {
|
|
350
|
+
baseUrl = `https://space.ai-builders.com${url}`;
|
|
351
|
+
}
|
|
352
|
+
source = "openapi_spec";
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
catch { }
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
catch (error) {
|
|
359
|
+
// If fetch fails, use default base URL
|
|
360
|
+
}
|
|
361
|
+
// For OpenAI SDK, baseURL should include /v1 since SDK appends paths directly
|
|
362
|
+
const sdkBaseUrl = baseUrl.endsWith('/v1') ? baseUrl : `${baseUrl}/v1`;
|
|
363
|
+
return {
|
|
364
|
+
content: [
|
|
365
|
+
{
|
|
366
|
+
type: "text",
|
|
367
|
+
text: JSON.stringify({
|
|
368
|
+
base_url: baseUrl,
|
|
369
|
+
sdk_base_url: sdkBaseUrl,
|
|
370
|
+
source: source,
|
|
371
|
+
prompt_for_ai: `The base URL for AI Builders Space API is: ${baseUrl}
|
|
372
|
+
|
|
373
|
+
This is the base URL you should use for all API calls to the AI Builders Space platform. When making HTTP requests, prepend this base URL to the API endpoint paths.
|
|
374
|
+
|
|
375
|
+
For example:
|
|
376
|
+
- Full endpoint URL: ${baseUrl}/v1/chat/completions
|
|
377
|
+
- Full endpoint URL: ${baseUrl}/v1/deployments
|
|
378
|
+
|
|
379
|
+
If you are using the OpenAI SDK (recommended), use this base URL: ${sdkBaseUrl}
|
|
380
|
+
|
|
381
|
+
The base URL is also documented in the deployment guide, but this tool provides a direct way to retrieve it without parsing the full deployment guide.`,
|
|
382
|
+
usage_examples: {
|
|
383
|
+
direct_http: {
|
|
384
|
+
description: "Direct HTTP requests",
|
|
385
|
+
base_url: baseUrl,
|
|
386
|
+
example: `const response = await fetch('${baseUrl}/v1/chat/completions', {
|
|
387
|
+
method: 'POST',
|
|
388
|
+
headers: {
|
|
389
|
+
'Authorization': \`Bearer \${process.env.AI_BUILDER_TOKEN}\`,
|
|
390
|
+
'Content-Type': 'application/json'
|
|
391
|
+
},
|
|
392
|
+
body: JSON.stringify({ model: 'grok-4-fast', messages: [...] })
|
|
393
|
+
});`
|
|
394
|
+
},
|
|
395
|
+
openai_sdk: {
|
|
396
|
+
description: "OpenAI SDK (recommended)",
|
|
397
|
+
base_url: sdkBaseUrl,
|
|
398
|
+
example_node: `import OpenAI from 'openai';
|
|
399
|
+
|
|
400
|
+
const openai = new OpenAI({
|
|
401
|
+
baseURL: '${sdkBaseUrl}',
|
|
402
|
+
apiKey: process.env.AI_BUILDER_TOKEN,
|
|
403
|
+
});`,
|
|
404
|
+
example_python: `from openai import OpenAI
|
|
405
|
+
import os
|
|
406
|
+
|
|
407
|
+
client = OpenAI(
|
|
408
|
+
base_url='${sdkBaseUrl}',
|
|
409
|
+
api_key=os.getenv('AI_BUILDER_TOKEN')
|
|
410
|
+
)`
|
|
411
|
+
}
|
|
412
|
+
},
|
|
413
|
+
important_notes: [
|
|
414
|
+
"Always use this base URL when making API calls to AI Builders Space",
|
|
415
|
+
"The base URL includes the /backend path",
|
|
416
|
+
"For OpenAI SDK compatibility, use the sdk_base_url which includes /v1",
|
|
417
|
+
"All API calls require authentication via AI_BUILDER_TOKEN in the Authorization header"
|
|
418
|
+
]
|
|
419
|
+
}, null, 2)
|
|
420
|
+
}
|
|
421
|
+
]
|
|
422
|
+
};
|
|
423
|
+
}
|
|
336
424
|
default:
|
|
337
425
|
throw new Error(`Unknown tool: ${name}`);
|
|
338
426
|
}
|
|
@@ -399,6 +487,14 @@ server.setRequestHandler(ListToolsRequestSchema, async () => {
|
|
|
399
487
|
}
|
|
400
488
|
}
|
|
401
489
|
}
|
|
490
|
+
},
|
|
491
|
+
{
|
|
492
|
+
name: "get_base_url",
|
|
493
|
+
description: "Get the base URL for AI Builders Space API. This tool provides a direct way to retrieve the base URL without parsing the deployment guide.",
|
|
494
|
+
inputSchema: {
|
|
495
|
+
type: "object",
|
|
496
|
+
properties: {}
|
|
497
|
+
}
|
|
402
498
|
}
|
|
403
499
|
]
|
|
404
500
|
};
|