@aibuilders/mcp-coach-server 1.0.4 → 1.0.7
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 +84 -6
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -4,9 +4,16 @@ import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js"
|
|
|
4
4
|
import { CallToolRequestSchema, ListToolsRequestSchema, } from "@modelcontextprotocol/sdk/types.js";
|
|
5
5
|
import dotenv from "dotenv";
|
|
6
6
|
import { readFile, writeFile, access, mkdir } from "fs/promises";
|
|
7
|
-
import {
|
|
7
|
+
import { readFileSync } from "fs";
|
|
8
|
+
import { join, dirname } from "path";
|
|
8
9
|
import { homedir } from "os";
|
|
10
|
+
import { fileURLToPath } from "url";
|
|
9
11
|
dotenv.config();
|
|
12
|
+
// Get package version from package.json
|
|
13
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
14
|
+
const __dirname = dirname(__filename);
|
|
15
|
+
const packageJson = JSON.parse(readFileSync(join(__dirname, "../package.json"), "utf-8"));
|
|
16
|
+
const PACKAGE_VERSION = packageJson.version;
|
|
10
17
|
const CACHE_DIR = join(homedir(), ".ai-builders-mcp-cache");
|
|
11
18
|
const DEPLOYMENT_GUIDE_CACHE = join(CACHE_DIR, "deployment_guide_cache.json");
|
|
12
19
|
async function ensureCacheDir() {
|
|
@@ -93,7 +100,7 @@ async function getCachedDeploymentGuide() {
|
|
|
93
100
|
}
|
|
94
101
|
const server = new Server({
|
|
95
102
|
name: "ai-builder-mcp",
|
|
96
|
-
version:
|
|
103
|
+
version: PACKAGE_VERSION,
|
|
97
104
|
}, {
|
|
98
105
|
capabilities: {
|
|
99
106
|
tools: {},
|
|
@@ -116,10 +123,8 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
|
116
123
|
if (url.startsWith("http")) {
|
|
117
124
|
baseUrl = url;
|
|
118
125
|
}
|
|
119
|
-
else
|
|
120
|
-
|
|
121
|
-
// Don't append the servers path, use the base URL as-is
|
|
122
|
-
baseUrl = "https://space.ai-builders.com/backend";
|
|
126
|
+
else {
|
|
127
|
+
baseUrl = `https://space.ai-builders.com${url}`;
|
|
123
128
|
}
|
|
124
129
|
}
|
|
125
130
|
}
|
|
@@ -177,6 +182,79 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
|
177
182
|
"Explain to the user what you've done and why it's secure"
|
|
178
183
|
]
|
|
179
184
|
}
|
|
185
|
+
},
|
|
186
|
+
deployment_api_info: {
|
|
187
|
+
note: "The deployment API supports environment variable injection via the env_vars field",
|
|
188
|
+
key_features: [
|
|
189
|
+
"Optional env_vars field in DeploymentCreateRequest (up to 20 variables)",
|
|
190
|
+
"Stateless design: environment variables are NOT stored in the platform database",
|
|
191
|
+
"Variables are passed directly to Koyeb during deployment",
|
|
192
|
+
"AI_BUILDER_TOKEN is automatically injected (no need to include it in env_vars)"
|
|
193
|
+
],
|
|
194
|
+
ai_assistant_guidance: {
|
|
195
|
+
when_helping_deploy: "When helping users deploy services, you should:",
|
|
196
|
+
steps: [
|
|
197
|
+
"1. Check if a deploy-config.json file exists in the project",
|
|
198
|
+
"2. If not, help create one with deployment parameters (repo_url, service_name, branch, port) and environment variables",
|
|
199
|
+
"3. Remind users not to commit sensitive values (passwords, API keys) to Git repositories",
|
|
200
|
+
"4. Before deploying, help users test the Dockerfile locally:",
|
|
201
|
+
" - Build the Docker image: docker build -t test-image .",
|
|
202
|
+
" - Run the container locally: docker run -p <port>:<port> -e PORT=<port> test-image",
|
|
203
|
+
" - Verify the service starts correctly and responds to requests",
|
|
204
|
+
" - Test with the same environment variables that will be used in production",
|
|
205
|
+
"5. When user says 'deploy', read from deploy-config.json and include env_vars in the API request",
|
|
206
|
+
"6. After deployment, monitor the deployment status. If deployment fails:",
|
|
207
|
+
" - Use GET /v1/deployments/{service_name}/logs to retrieve deployment logs",
|
|
208
|
+
" - Check build logs: GET /v1/deployments/{service_name}/logs?log_type=build",
|
|
209
|
+
" - Check runtime logs: GET /v1/deployments/{service_name}/logs?log_type=runtime",
|
|
210
|
+
" - Filter by stream: GET /v1/deployments/{service_name}/logs?stream=stderr (for errors)",
|
|
211
|
+
" - Help users debug based on log output and fix issues",
|
|
212
|
+
"7. Guide users to maintain their configuration for future deployments"
|
|
213
|
+
],
|
|
214
|
+
log_api_info: {
|
|
215
|
+
endpoint: "GET /v1/deployments/{service_name}/logs",
|
|
216
|
+
description: "Retrieve deployment logs from Koyeb for debugging failed deployments",
|
|
217
|
+
parameters: {
|
|
218
|
+
service_name: "Path parameter: The unique service name / subdomain",
|
|
219
|
+
log_type: "Query parameter: 'build' or 'runtime' (default: 'runtime')",
|
|
220
|
+
stream: "Query parameter: Filter by 'stdout', 'stderr', or 'koyeb'",
|
|
221
|
+
timeout: "Query parameter: Seconds to wait for streaming logs (1-300, default: 5)",
|
|
222
|
+
deployment_id: "Query parameter: Optional deployment ID override"
|
|
223
|
+
},
|
|
224
|
+
usage_examples: {
|
|
225
|
+
build_logs: "GET /v1/deployments/my-service/logs?log_type=build",
|
|
226
|
+
runtime_errors: "GET /v1/deployments/my-service/logs?log_type=runtime&stream=stderr",
|
|
227
|
+
all_logs: "GET /v1/deployments/my-service/logs?log_type=runtime&timeout=30"
|
|
228
|
+
},
|
|
229
|
+
when_to_use: [
|
|
230
|
+
"When deployment status shows ERROR, UNHEALTHY, or DEGRADED",
|
|
231
|
+
"To debug why a service is not starting correctly",
|
|
232
|
+
"To check build-time errors during Docker image creation",
|
|
233
|
+
"To monitor runtime errors and application logs"
|
|
234
|
+
]
|
|
235
|
+
},
|
|
236
|
+
example_deploy_config: {
|
|
237
|
+
description: "Example deploy-config.json structure",
|
|
238
|
+
content: {
|
|
239
|
+
repo_url: "https://github.com/user/my-app",
|
|
240
|
+
service_name: "my-app",
|
|
241
|
+
branch: "main",
|
|
242
|
+
port: 8000,
|
|
243
|
+
env_vars: {
|
|
244
|
+
DATABASE_URL: "postgresql://user:pass@host:5432/db",
|
|
245
|
+
NODE_ENV: "production",
|
|
246
|
+
LOG_LEVEL: "info"
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
},
|
|
250
|
+
best_practices: [
|
|
251
|
+
"Maintain environment variables in version-controlled config files (deploy-config.json)",
|
|
252
|
+
"Use .env files for sensitive values during development (add to .gitignore)",
|
|
253
|
+
"Never include AI_BUILDER_TOKEN in env_vars (it's automatically injected)",
|
|
254
|
+
"Create deployment scripts that read from config files",
|
|
255
|
+
"Help users understand the stateless nature of env_vars"
|
|
256
|
+
]
|
|
257
|
+
}
|
|
180
258
|
}
|
|
181
259
|
}, null, 2)
|
|
182
260
|
}
|