feishu-mcp 0.0.2 → 0.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli.js CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import { resolve } from "path";
3
3
  import { config } from "dotenv";
4
- import { startServer } from "./index";
4
+ import { startServer } from "./index.js";
5
5
  // Load .env from the current working directory
6
6
  config({ path: resolve(process.cwd(), ".env") });
7
7
  startServer().catch((error) => {
package/dist/index.js CHANGED
@@ -1,6 +1,8 @@
1
1
  import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
2
- import { FeishuMcpServer } from "./server";
3
- import { getServerConfig } from "./config";
2
+ import { FeishuMcpServer } from "./server.js";
3
+ import { getServerConfig } from "./config.js";
4
+ import { fileURLToPath } from 'url';
5
+ import { resolve } from 'path';
4
6
  export async function startServer() {
5
7
  // Check if we're running in stdio mode (e.g., via CLI)
6
8
  const isStdioMode = process.env.NODE_ENV === "cli" || process.argv.includes("--stdio");
@@ -14,6 +16,7 @@ export async function startServer() {
14
16
  console.log(`Feishu App ID: ${feishuConfig.appId.substring(0, 4)}...${feishuConfig.appId.substring(feishuConfig.appId.length - 4)}`);
15
17
  console.log(`Feishu App Secret: ${feishuConfig.appSecret.substring(0, 4)}...${feishuConfig.appSecret.substring(feishuConfig.appSecret.length - 4)}`);
16
18
  const server = new FeishuMcpServer(feishuConfig);
19
+ console.log(`isStdioMode:${isStdioMode}`);
17
20
  if (isStdioMode) {
18
21
  const transport = new StdioServerTransport();
19
22
  await server.connect(transport);
@@ -23,10 +26,17 @@ export async function startServer() {
23
26
  await server.startHttpServer(config.port);
24
27
  }
25
28
  }
26
- // If this file is being run directly, start the server
27
- if (import.meta.url === `file://${process.argv[1]}`) {
29
+ // 跨平台兼容的方式检查是否直接运行
30
+ const currentFilePath = fileURLToPath(import.meta.url);
31
+ const executedFilePath = resolve(process.argv[1]);
32
+ console.log(`meta.url:${currentFilePath} argv:${executedFilePath}`);
33
+ if (currentFilePath === executedFilePath) {
34
+ console.log(`startServer`);
28
35
  startServer().catch((error) => {
29
- console.error("Failed to start server:", error);
36
+ console.error('Failed to start server:', error);
30
37
  process.exit(1);
31
38
  });
32
39
  }
40
+ else {
41
+ console.log(`not startServer`);
42
+ }
package/dist/server.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
2
2
  import { z } from "zod";
3
- import { FeishuService } from "./services/feishu";
3
+ import { FeishuService } from "./services/feishu.js";
4
4
  import express from "express";
5
5
  import { SSEServerTransport } from "@modelcontextprotocol/sdk/server/sse.js";
6
6
  export const Logger = {
@@ -49,7 +49,6 @@ export class FeishuMcpServer {
49
49
  this.registerTools();
50
50
  }
51
51
  registerTools() {
52
- // 添加创建飞书文档工具
53
52
  // 添加创建飞书文档工具
54
53
  this.server.tool("create_feishu_doc", "Create a new Feishu document", {
55
54
  title: z.string().describe("Document title"),
@@ -1,5 +1,5 @@
1
1
  import axios, { AxiosError } from "axios";
2
- import { Logger } from "../server";
2
+ import { Logger } from "../server.js";
3
3
  export class FeishuService {
4
4
  constructor(appId, appSecret) {
5
5
  Object.defineProperty(this, "appId", {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "feishu-mcp",
3
- "version": "0.0.2",
3
+ "version": "0.0.3",
4
4
  "description": "Model Context Protocol server for Feishu integration",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",