@zelklab/seevo-mcp-server 0.1.2 → 0.1.4
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/index.js +16 -1
- package/dist/register.js +115 -0
- package/package.json +2 -1
package/dist/index.js
CHANGED
|
@@ -177,8 +177,23 @@ Seevoダッシュボードで確認できます: http://localhost:3000/dashboard
|
|
|
177
177
|
};
|
|
178
178
|
}
|
|
179
179
|
});
|
|
180
|
-
// Start server
|
|
180
|
+
// Start server or run CLI
|
|
181
181
|
async function main() {
|
|
182
|
+
const args = process.argv.slice(2);
|
|
183
|
+
// CLI mode: handle subcommands
|
|
184
|
+
if (args.length > 0 && args[0] === 'register') {
|
|
185
|
+
// Dynamically import and run register command
|
|
186
|
+
// register.ts executes its top-level code when imported
|
|
187
|
+
await import('./register.js');
|
|
188
|
+
return;
|
|
189
|
+
}
|
|
190
|
+
if (args.length > 0 && args[0] === 'setup') {
|
|
191
|
+
// Dynamically import and run setup command
|
|
192
|
+
// setup.ts executes its top-level code when imported
|
|
193
|
+
await import('./setup.js');
|
|
194
|
+
return;
|
|
195
|
+
}
|
|
196
|
+
// MCP Server mode: start stdio server
|
|
182
197
|
const transport = new StdioServerTransport();
|
|
183
198
|
await server.connect(transport);
|
|
184
199
|
console.error("Seevo MCP Server running on stdio");
|
package/dist/register.js
ADDED
|
@@ -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/package.json
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zelklab/seevo-mcp-server",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.4",
|
|
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
|
},
|