Skip to main content
Glama
index.ts3.94 kB
#!/usr/bin/env node /** * Copyright 2025 LY Corporation * * LINE Corporation licenses this file to you under the Apache License, * version 2.0 (the "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at: * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the * License for the specific language governing permissions and limitations * under the License. */ import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js"; import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js"; import * as line from "@line/bot-sdk"; import { LINE_BOT_MCP_SERVER_VERSION, USER_AGENT } from "./version.js"; import loadEnvFromDotenv from "./common/loadEnv.js"; import PushGeminiText from "./tools/pushGeminiText.js"; import CancelRichMenuDefault from "./tools/cancelRichMenuDefault.js"; import PushTextMessage from "./tools/pushTextMessage.js"; import PushFlexMessage from "./tools/pushFlexMessage.js"; import BroadcastTextMessage from "./tools/broadcastTextMessage.js"; import BroadcastFlexMessage from "./tools/broadcastFlexMessage.js"; import GetProfile from "./tools/getProfile.js"; import GetMessageQuota from "./tools/getMessageQuota.js"; import GetRichMenuList from "./tools/getRichMenuList.js"; import DeleteRichMenu from "./tools/deleteRichMenu.js"; import SetRichMenuDefault from "./tools/setRichMenuDefault.js"; import PushGeminiFlex from "./tools/pushGeminiFlex.js"; import GeminiCommand from "./tools/geminiCommand.js"; import PushMessages from "./tools/pushMessages.js"; import BroadcastMessages from "./tools/broadcastMessages.js"; import QueryMssql from "./tools/queryMssql.js"; import ExportMssqlKnowledge from "./tools/exportMssqlKnowledge.js"; import AiQueryMssql from "./tools/aiQueryMssql.js"; // Load environment variables from .env if present (no external deps) loadEnvFromDotenv(); const server = new McpServer({ name: "line-bot", version: LINE_BOT_MCP_SERVER_VERSION, }); const channelAccessToken = process.env.CHANNEL_ACCESS_TOKEN || ""; const destinationId = process.env.DESTINATION_USER_ID || ""; const messagingApiClient = new line.messagingApi.MessagingApiClient({ channelAccessToken: channelAccessToken, defaultHeaders: { "User-Agent": USER_AGENT, }, }); new PushTextMessage(messagingApiClient, destinationId).register(server); new PushFlexMessage(messagingApiClient, destinationId).register(server); new BroadcastTextMessage(messagingApiClient).register(server); new BroadcastFlexMessage(messagingApiClient).register(server); new GetProfile(messagingApiClient, destinationId).register(server); new GetMessageQuota(messagingApiClient).register(server); new GetRichMenuList(messagingApiClient).register(server); new DeleteRichMenu(messagingApiClient).register(server); new SetRichMenuDefault(messagingApiClient).register(server); new CancelRichMenuDefault(messagingApiClient).register(server); new PushGeminiText(messagingApiClient, destinationId).register(server); new PushGeminiFlex(messagingApiClient, destinationId).register(server); new GeminiCommand(messagingApiClient, destinationId).register(server); new PushMessages(messagingApiClient, destinationId).register(server); new BroadcastMessages(messagingApiClient).register(server); new QueryMssql().register(server); new ExportMssqlKnowledge().register(server); new AiQueryMssql().register(server); async function main() { if (!process.env.CHANNEL_ACCESS_TOKEN) { console.error("Please set CHANNEL_ACCESS_TOKEN"); process.exit(1); } const transport = new StdioServerTransport(); await server.connect(transport); } main().catch(error => { console.error("Fatal error in main():", error); process.exit(1); });

Implementation Reference

Latest Blog Posts

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/tndfame/mcp_management'

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