Skip to main content
Glama

Scenario Word

by HyunJuHwan
index.ts1.21 kB
import { MCPServer } from "mcp-framework"; import dotenv from "dotenv"; import fs from "fs/promises"; import path from "path"; import { fileURLToPath } from "url"; dotenv.config(); const __filename = fileURLToPath(import.meta.url); const __dirname = path.dirname(__filename); const requiredDirs = [ "tools/character", "tools/scene", "tools/video", "tools/webtoon", ]; async function ensureDirectoriesExist() { for (const dir of requiredDirs) { const fullPath = path.resolve(__dirname, dir); try { await fs.mkdir(fullPath, { recursive: true }); console.error(`[✔] 폴더 확인됨: ${fullPath}`); } catch (e) { console.error(`[x] 폴더 생성 실패: ${fullPath}`, e); } } } async function startServer() { await ensureDirectoriesExist(); const mode = process.env.MODE || "dev"; const server = new MCPServer({ transport: mode === "prod" ? { type: "http-stream", options: { port: 1337, cors: { allowOrigin: "*" } } } : { type: "stdio" }, }); console.error(`🚀 MCP Server started in [${mode}] mode`); server.start(); } startServer();

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/HyunJuHwan/mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server