tambahan
This commit is contained in:
@@ -1,20 +1,20 @@
|
||||
import { Elysia } from "elysia";
|
||||
import { v4 as uuidv4 } from "uuid";
|
||||
|
||||
const API_KEY = process.env.MCP_API_KEY ?? "super-secret-key";
|
||||
const PORT = Number(process.env.PORT ?? 3000);
|
||||
// const API_KEY = process.env.MCP_API_KEY ?? "super-secret-key";
|
||||
// const PORT = Number(process.env.PORT ?? 3000);
|
||||
|
||||
// =====================
|
||||
// Helper Functions
|
||||
// =====================
|
||||
function isAuthorized(headers: Headers) {
|
||||
const authHeader = headers.get("authorization");
|
||||
if (authHeader?.startsWith("Bearer ")) {
|
||||
const token = authHeader.substring(7);
|
||||
return token === API_KEY;
|
||||
}
|
||||
return headers.get("x-api-key") === API_KEY;
|
||||
}
|
||||
// // =====================
|
||||
// // Helper Functions
|
||||
// // =====================
|
||||
// function isAuthorized(headers: Headers) {
|
||||
// const authHeader = headers.get("authorization");
|
||||
// if (authHeader?.startsWith("Bearer ")) {
|
||||
// const token = authHeader.substring(7);
|
||||
// return token === API_KEY;
|
||||
// }
|
||||
// return headers.get("x-api-key") === API_KEY;
|
||||
// }
|
||||
|
||||
// =====================
|
||||
// Tools Definition
|
||||
|
||||
Reference in New Issue
Block a user