vex-mcp-server
Version:
MCP server for VEX Robotics Competition data using RobotEvents API
40 lines • 1.32 kB
JavaScript
/**
* RobotEvents API authentication setup
*/
import * as robotevents from "robotevents";
export class RobotEventsAuth {
static instance;
isAuthenticated = false;
constructor() { }
static getInstance() {
if (!RobotEventsAuth.instance) {
RobotEventsAuth.instance = new RobotEventsAuth();
}
return RobotEventsAuth.instance;
}
setupAuthentication() {
const token = process.env.ROBOTEVENTS_TOKEN;
if (!token) {
console.error("Warning: ROBOTEVENTS_TOKEN environment variable not set");
console.error("Some API calls may fail without authentication");
return;
}
try {
robotevents.authentication.setBearer(token);
this.isAuthenticated = true;
console.error("RobotEvents API authentication configured successfully");
}
catch (error) {
console.error("Failed to set RobotEvents authentication:", error);
}
}
isAuthConfigured() {
return this.isAuthenticated;
}
getAuthStatus() {
return this.isAuthenticated
? "✅ RobotEvents API authenticated"
: "⚠️ RobotEvents API not authenticated - some features may be limited";
}
}
//# sourceMappingURL=robotevents-auth.js.map