Files
crawlab/mcp/validate-build.mjs
Marvin Zhang c29e21deec feat: Implement Crawlab MCP Server with tools and prompts
- Added main server file (index.ts) to initialize the Crawlab MCP Server.
- Created prompts for spider analysis, task debugging, spider setup, and system monitoring.
- Developed tools for managing spiders, tasks, nodes, schedules, and system health.
- Implemented a mock client for testing server functionality.
- Added versioning support with version.ts.
- Created a test script (test-server.mjs) to validate tool configurations and server responses.
- Included build validation script (validate-build.mjs) to ensure proper setup and functionality.
- Configured TypeScript settings with tsconfig.json for better development experience.
2025-06-19 15:38:45 +08:00

50 lines
1.5 KiB
JavaScript

#!/usr/bin/env node
/**
* Simple build validation test for Crawlab MCP Server
*/
import { CrawlabClient } from "./dist/client.js";
console.log("🧪 Testing Crawlab MCP Server build...\n");
// Test that we can instantiate the client
try {
const client = new CrawlabClient("http://localhost:8080", "test-token");
console.log("✅ CrawlabClient class - OK");
} catch (error) {
console.log("❌ CrawlabClient class - FAILED");
console.log(" Error:", error.message);
process.exit(1);
}
// Test that the main entry point is valid
try {
const entryPoint = await import("./dist/index.js");
console.log("✅ Main entry point - OK");
} catch (error) {
console.log("❌ Main entry point - FAILED");
console.log(" Error:", error.message);
process.exit(1);
}
// Test tools module
try {
const toolsModule = await import("./dist/tools.js");
if (typeof toolsModule.configureAllTools === 'function') {
console.log("✅ Tools configuration - OK");
} else {
console.log("❌ Tools configuration - FAILED (configureAllTools not a function)");
}
} catch (error) {
console.log("❌ Tools configuration - FAILED");
console.log(" Error:", error.message);
}
console.log("\n🎉 Build validation completed successfully!");
console.log("\n📋 Ready to use:");
console.log(" npm start <crawlab_url> [api_token]");
console.log(" Example: npm start http://localhost:8080 your-token");
console.log("\n Or use the binary directly:");
console.log(" ./dist/index.js http://localhost:8080 your-token");