typebot-mcp
Version:
[](https://smithery.ai/server/@hithereiamaliff/typebot-mcp)
24 lines (23 loc) • 965 B
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.authenticate = authenticate;
const axios_1 = __importDefault(require("axios"));
async function authenticate(args) {
const token = args.token || process.env.TYPEBOT_TOKEN;
if (!token) {
throw new Error('authenticate: missing token (neither in args nor in process.env.TYPEBOT_TOKEN)');
}
axios_1.default.defaults.headers.common['Authorization'] = `Bearer ${token}`;
if (!process.env.TYPEBOT_API_URL) {
throw new Error('TYPEBOT_API_URL environment variable is not set');
}
const apiBaseUrl = process.env.TYPEBOT_API_URL;
const response = await axios_1.default.get(`${apiBaseUrl}/workspaces`);
return {
message: 'Authentication successful',
workspaces: response.data,
};
}