@zelklab/seevo-mcp-server 0.1.1 → 0.1.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/auth.js CHANGED
@@ -68,6 +68,17 @@ export class AuthManager {
68
68
  throw new Error(`Failed to save auth token: ${error}`);
69
69
  }
70
70
  }
71
+ /**
72
+ * MCPトークンを設定(メモリ上のみ、ファイルには保存しない)
73
+ * ユーザーが手動で入力したトークンをセッション中のみ使用
74
+ */
75
+ setToken(token) {
76
+ // 30日間有効とみなす(実際の有効期限はバックエンドで管理)
77
+ this.authData = {
78
+ token,
79
+ expiresAt: Date.now() + 30 * 24 * 60 * 60 * 1000,
80
+ };
81
+ }
71
82
  /**
72
83
  * MCPトークンを取得
73
84
  */
package/dist/index.js CHANGED
@@ -21,7 +21,7 @@ const seeveClient = new SeeveClient(authManager);
21
21
  const TOOLS = [
22
22
  {
23
23
  name: "seevo_register_project",
24
- description: "現在のプロジェクトをSeevoに登録します。プロジェクトディレクトリを解析してサービス情報を自動抽出し、Seevoバックエンドに登録します。",
24
+ description: "現在のプロジェクトをSeevoに登録します。プロジェクトディレクトリを解析してサービス情報を自動抽出し、Seevoバックエンドに登録します。事前にseevo_set_tokenでトークンを設定する必要があります。",
25
25
  inputSchema: {
26
26
  type: "object",
27
27
  properties: {
@@ -37,21 +37,17 @@ const TOOLS = [
37
37
  },
38
38
  },
39
39
  {
40
- name: "seevo_login",
41
- description: "Seevoにログインして認証トークンを保存します。一度ログインすれば、以降の操作で自動的に認証されます。",
40
+ name: "seevo_set_token",
41
+ description: "Seevo MCPトークンを設定します。WebUIで発行したトークン(seevo_mcp_から始まる文字列)を入力してください。このトークンは1回のみ使用できます。",
42
42
  inputSchema: {
43
43
  type: "object",
44
44
  properties: {
45
- email: {
45
+ token: {
46
46
  type: "string",
47
- description: "メールアドレス",
48
- },
49
- password: {
50
- type: "string",
51
- description: "パスワード",
47
+ description: "WebUIで発行したSeevo MCPトークン(seevo_mcp_で始まる)",
52
48
  },
53
49
  },
54
- required: ["email", "password"],
50
+ required: ["token"],
55
51
  },
56
52
  },
57
53
  {
@@ -81,7 +77,7 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
81
77
  content: [
82
78
  {
83
79
  type: "text",
84
- text: "エラー: Seevoにログインしていません。先に seevo_login ツールでログインしてください。",
80
+ text: "エラー: Seevo MCPトークンが設定されていません。\n\n以下の手順でトークンを設定してください:\n1. Seevo WebUI (http://localhost:3000/dashboard/new) でMCPトークンを発行\n2. seevo_set_token ツールを使ってトークンを設定\n\n例: seevo_set_token(token=\"seevo_mcp_xxxxx\")",
85
81
  },
86
82
  ],
87
83
  };
@@ -112,30 +108,35 @@ Seevoダッシュボードで確認できます: http://localhost:3000/dashboard
112
108
  ],
113
109
  };
114
110
  }
115
- case "seevo_login": {
116
- const email = args?.email;
117
- const password = args?.password;
118
- if (!email || !password) {
111
+ case "seevo_set_token": {
112
+ const token = args?.token;
113
+ if (!token) {
114
+ return {
115
+ content: [
116
+ {
117
+ type: "text",
118
+ text: "エラー: tokenは必須です。\n\nWebUI (http://localhost:3000/dashboard/new) で発行したトークンを入力してください。",
119
+ },
120
+ ],
121
+ };
122
+ }
123
+ if (!token.startsWith("seevo_mcp_")) {
119
124
  return {
120
125
  content: [
121
126
  {
122
127
  type: "text",
123
- text: "エラー: emailとpasswordは必須です。",
128
+ text: "エラー: 無効なトークン形式です。トークンは 'seevo_mcp_' で始まる必要があります。\n\nWebUIで正しいMCPトークンを発行してください。",
124
129
  },
125
130
  ],
126
131
  };
127
132
  }
128
- const loginResult = await seeveClient.login(email, password);
133
+ // Set token in auth manager
134
+ authManager.setToken(token);
129
135
  return {
130
136
  content: [
131
137
  {
132
138
  type: "text",
133
- text: `✅ Seevoにログインしました!
134
-
135
- **ユーザー名**: ${loginResult.user.name}
136
- **メール**: ${loginResult.user.email}
137
-
138
- これで seevo_register_project ツールを使用できます。`,
139
+ text: `✅ Seevo MCPトークンを設定しました!\n\nこれで seevo_register_project ツールを使用できます。\n\n⚠️ このトークンは1回のプロジェクト登録のみ有効です。`,
139
140
  },
140
141
  ],
141
142
  };
@@ -0,0 +1,115 @@
1
+ #!/usr/bin/env node
2
+ import { analyzeProject } from "./analyzer.js";
3
+ import fetch from "node-fetch";
4
+ const SEEVO_API_URL = process.env.SEEVO_API_URL || "http://localhost:8080/api/v1";
5
+ async function registerProject(token, projectPath = process.cwd()) {
6
+ console.log("\n🚀 Seevo プロジェクト登録を開始します...\n");
7
+ // トークンの検証
8
+ if (!token || !token.startsWith("seevo_mcp_")) {
9
+ console.error("❌ エラー: 有効なSeevo MCPトークンを指定してください");
10
+ console.error(" トークンは 'seevo_mcp_' で始まる必要があります");
11
+ console.error("\n WebUI (http://localhost:3000/dashboard/new) でトークンを発行してください。\n");
12
+ process.exit(1);
13
+ }
14
+ try {
15
+ // プロジェクトを解析
16
+ console.log("📂 プロジェクトを解析中...");
17
+ const analysis = await analyzeProject(projectPath);
18
+ console.log(`✓ プロジェクト名: ${analysis.service_name}`);
19
+ console.log(`✓ 説明: ${analysis.description.substring(0, 100)}...`);
20
+ // Seevo APIに登録
21
+ console.log("\n📤 Seevoに登録中...");
22
+ const response = await fetch(`${SEEVO_API_URL}/apps`, {
23
+ method: "POST",
24
+ headers: {
25
+ "Content-Type": "application/json",
26
+ "Authorization": `Bearer ${token}`,
27
+ },
28
+ body: JSON.stringify(analysis),
29
+ });
30
+ if (!response.ok) {
31
+ const errorText = await response.text();
32
+ let errorMessage = errorText;
33
+ try {
34
+ const errorJson = JSON.parse(errorText);
35
+ errorMessage = errorJson.error || errorJson.message || errorText;
36
+ }
37
+ catch {
38
+ // JSON parse failed, use text as is
39
+ }
40
+ if (response.status === 401) {
41
+ console.error("\n❌ 認証エラー: トークンが無効または期限切れです");
42
+ console.error(" WebUIで新しいトークンを発行してください。\n");
43
+ }
44
+ else {
45
+ console.error(`\n❌ 登録エラー (${response.status}): ${errorMessage}\n`);
46
+ }
47
+ process.exit(1);
48
+ }
49
+ const result = await response.json();
50
+ // 成功メッセージ
51
+ console.log("\n" + "=".repeat(60));
52
+ console.log("✅ プロジェクトをSeevoに登録しました!");
53
+ console.log("=".repeat(60));
54
+ console.log(`\n📋 登録情報:`);
55
+ console.log(` サービス名: ${result.service_name}`);
56
+ console.log(` 説明: ${result.description}`);
57
+ console.log(` ターゲット: ${result.target}`);
58
+ if (result.tech_stack && result.tech_stack.length > 0) {
59
+ console.log(` 技術スタック: ${result.tech_stack.join(", ")}`);
60
+ }
61
+ if (result.features && result.features.length > 0) {
62
+ console.log(` 主な機能:`);
63
+ result.features.slice(0, 5).forEach(f => console.log(` - ${f}`));
64
+ }
65
+ console.log(`\n🔗 ダッシュボード: http://localhost:3000/dashboard/apps/${result.id}`);
66
+ console.log("\n💡 このトークンは使用済みとなり、再利用できません。\n");
67
+ }
68
+ catch (error) {
69
+ if (error instanceof Error) {
70
+ console.error(`\n❌ エラー: ${error.message}\n`);
71
+ }
72
+ else {
73
+ console.error(`\n❌ 予期しないエラー: ${String(error)}\n`);
74
+ }
75
+ process.exit(1);
76
+ }
77
+ }
78
+ // CLI実行
79
+ const args = process.argv.slice(2);
80
+ // ヘルプ表示
81
+ if (args.includes("--help") || args.includes("-h")) {
82
+ console.log("使い方:");
83
+ console.log(" seevo-register --token YOUR_TOKEN");
84
+ console.log(" seevo-register --token YOUR_TOKEN --path /path/to/project");
85
+ console.log("\n環境変数版:");
86
+ console.log(" SEEVO_TOKEN=YOUR_TOKEN seevo-register");
87
+ console.log("\nオプション:");
88
+ console.log(" --token TOKEN Seevo MCPトークン(必須、環境変数SEEVO_TOKENでも指定可)");
89
+ console.log(" --path PATH プロジェクトディレクトリのパス(省略時はカレントディレクトリ)");
90
+ console.log(" --help, -h ヘルプを表示\n");
91
+ process.exit(0);
92
+ }
93
+ // 引数をパース
94
+ let token = process.env.SEEVO_TOKEN || "";
95
+ let projectPath = process.cwd();
96
+ for (let i = 0; i < args.length; i++) {
97
+ const arg = args[i];
98
+ if (arg === "--token" && args[i + 1]) {
99
+ token = args[i + 1];
100
+ i++;
101
+ }
102
+ else if (arg === "--path" && args[i + 1]) {
103
+ projectPath = args[i + 1];
104
+ i++;
105
+ }
106
+ }
107
+ if (!token) {
108
+ console.error("❌ エラー: トークンが指定されていません\n");
109
+ console.log("使い方:");
110
+ console.log(" seevo-register --token YOUR_TOKEN");
111
+ console.log(" SEEVO_TOKEN=YOUR_TOKEN seevo-register\n");
112
+ console.log("WebUI (http://localhost:3000/dashboard/new) でトークンを発行してください。\n");
113
+ process.exit(1);
114
+ }
115
+ registerProject(token, projectPath);
package/dist/setup.js CHANGED
@@ -17,14 +17,8 @@ function getGlobalConfigPath() {
17
17
  throw new Error(`Unsupported OS: ${os}`);
18
18
  }
19
19
  }
20
- function setupMCP(token, isGlobal, projectPath) {
20
+ function setupMCP(isGlobal, projectPath) {
21
21
  console.log("\n🚀 Seevo MCP Server セットアップを開始します...\n");
22
- // トークンの検証
23
- if (!token || !token.startsWith("seevo_mcp_")) {
24
- console.error("❌ エラー: 有効なSeevo MCPトークンを指定してください");
25
- console.error(" トークンは 'seevo_mcp_' で始まる必要があります\n");
26
- process.exit(1);
27
- }
28
22
  const configPath = isGlobal
29
23
  ? getGlobalConfigPath()
30
24
  : join(projectPath || process.cwd(), ".mcp.json");
@@ -59,7 +53,6 @@ function setupMCP(token, isGlobal, projectPath) {
59
53
  command: "npx",
60
54
  args: ["-y", "@zelklab/seevo-mcp-server"],
61
55
  env: {
62
- SEEVO_MCP_TOKEN: token,
63
56
  SEEVO_API_URL: SEEVO_API_URL,
64
57
  },
65
58
  };
@@ -87,33 +80,17 @@ function setupMCP(token, isGlobal, projectPath) {
87
80
  }
88
81
  console.log(" 2. 以下のように話しかけてください:\n");
89
82
  console.log(' "このプロジェクトをSeevoに登録して"\n');
90
- if (!isGlobal) {
91
- console.log("⚠️ 重要:");
92
- console.log(" • .mcp.json ファイルには認証トークンが含まれています");
93
- console.log(" • このファイルを .gitignore に追加することを推奨します:");
94
- console.log(" echo '.mcp.json' >> .gitignore");
95
- console.log(" • または、チームで共有する場合は環境変数を使ってください\n");
96
- }
83
+ console.log(" 3. トークンの入力を求められたら、WebUIで発行したトークンを入力してください\n");
97
84
  console.log("📚 利用可能なツール:");
98
85
  console.log(" • seevo_register_project - プロジェクトを自動解析して登録");
99
- console.log(" • seevo_login - 別アカウントでログイン");
86
+ console.log(" • seevo_set_token - Seevoトークンを設定");
100
87
  console.log(" • seevo_logout - ログアウト\n");
101
88
  console.log("💡 ヒント:Claude Codeは自動的にプロジェクトを解析し、");
102
89
  console.log(" 目的、ターゲット、機能、技術スタックを理解します。\n");
103
90
  }
104
91
  // CLI実行
105
92
  const args = process.argv.slice(2);
106
- if (args.length === 0) {
107
- console.error("❌ エラー: トークンを指定してください\n");
108
- console.log("使い方:");
109
- console.log(" seevo-mcp-setup YOUR_TOKEN # デフォルト: ローカル");
110
- console.log(" seevo-mcp-setup YOUR_TOKEN --local # プロジェクトローカル(推奨)");
111
- console.log(" seevo-mcp-setup YOUR_TOKEN --global # グローバル設定");
112
- console.log(" seevo-mcp-setup YOUR_TOKEN --path /path/to/project # 別のプロジェクトに設定\n");
113
- process.exit(1);
114
- }
115
93
  // 引数をパース
116
- let token = "";
117
94
  let isGlobal = false;
118
95
  let projectPath;
119
96
  // setupコマンドが含まれている場合はスキップ
@@ -130,22 +107,18 @@ for (let i = startIndex; i < args.length; i++) {
130
107
  projectPath = args[i + 1];
131
108
  i++; // 次の引数をスキップ
132
109
  }
133
- else if (arg === "--token" && args[i + 1]) {
134
- token = args[i + 1];
135
- i++; // 次の引数をスキップ
136
- }
137
- else if (!arg.startsWith("--") && !token) {
138
- // フラグでなく、まだトークンが設定されていない場合
139
- token = arg;
110
+ else if (arg === "--help" || arg === "-h") {
111
+ console.log("使い方:");
112
+ console.log(" seevo-mcp-setup # デフォルト: ローカル");
113
+ console.log(" seevo-mcp-setup --local # プロジェクトローカル(推奨)");
114
+ console.log(" seevo-mcp-setup --global # グローバル設定");
115
+ console.log(" seevo-mcp-setup --path /path/to/project # 別のプロジェクトに設定\n");
116
+ process.exit(0);
140
117
  }
141
118
  }
142
- if (!token) {
143
- console.error("❌ エラー: トークンが見つかりません\n");
144
- process.exit(1);
145
- }
146
119
  // グローバルとプロジェクトパスが同時に指定された場合はエラー
147
120
  if (isGlobal && projectPath) {
148
121
  console.error("❌ エラー: --global と --path は同時に指定できません\n");
149
122
  process.exit(1);
150
123
  }
151
- setupMCP(token, isGlobal, projectPath);
124
+ setupMCP(isGlobal, projectPath);
package/package.json CHANGED
@@ -1,10 +1,11 @@
1
1
  {
2
2
  "name": "@zelklab/seevo-mcp-server",
3
- "version": "0.1.1",
3
+ "version": "0.1.3",
4
4
  "description": "MCP Server for Seevo - AI-powered project registration from Claude Code",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",
7
7
  "bin": {
8
+ "seevo-register": "./dist/register.js",
8
9
  "seevo-mcp-setup": "./dist/setup.js",
9
10
  "seevo-mcp-server": "./dist/index.js"
10
11
  },