@ignission/slack-task-mcp 0.2.8 → 0.2.9
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/package.json +1 -1
- package/src/agents/analyze.js +1 -1
- package/src/agents/draft-reply.js +1 -1
- package/src/auth.js +14 -9
- package/src/index.js +12 -11
package/package.json
CHANGED
package/src/agents/analyze.js
CHANGED
package/src/auth.js
CHANGED
|
@@ -11,11 +11,11 @@
|
|
|
11
11
|
import http from "node:http";
|
|
12
12
|
import open from "open";
|
|
13
13
|
import {
|
|
14
|
-
listWorkspaces,
|
|
15
|
-
saveCredentials,
|
|
16
|
-
deleteCredentialsByDomain,
|
|
17
14
|
deleteAllCredentials,
|
|
15
|
+
deleteCredentialsByDomain,
|
|
18
16
|
getCredentialsDir,
|
|
17
|
+
listWorkspaces,
|
|
18
|
+
saveCredentials,
|
|
19
19
|
} from "./credentials.js";
|
|
20
20
|
|
|
21
21
|
// 定数
|
|
@@ -154,7 +154,8 @@ async function startHybridOAuth(options = {}) {
|
|
|
154
154
|
|
|
155
155
|
// credentials を保存
|
|
156
156
|
const teamName = url.searchParams.get("team_name") || "Unknown";
|
|
157
|
-
const teamDomain =
|
|
157
|
+
const teamDomain =
|
|
158
|
+
url.searchParams.get("team_domain") || extractDomainFromTeamName(teamName);
|
|
158
159
|
const credentials = {
|
|
159
160
|
access_token: accessToken,
|
|
160
161
|
token_type: url.searchParams.get("token_type") || "user",
|
|
@@ -170,10 +171,12 @@ async function startHybridOAuth(options = {}) {
|
|
|
170
171
|
await saveCredentials(credentials);
|
|
171
172
|
|
|
172
173
|
res.writeHead(200, { "Content-Type": "text/html; charset=utf-8" });
|
|
173
|
-
res.end(
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
174
|
+
res.end(
|
|
175
|
+
htmlResponse(
|
|
176
|
+
"認証が完了しました!",
|
|
177
|
+
`ワークスペース: ${credentials.team_name}<br>このウィンドウを閉じてください。`,
|
|
178
|
+
),
|
|
179
|
+
);
|
|
177
180
|
|
|
178
181
|
console.log("");
|
|
179
182
|
console.log("✅ 認証が完了しました!");
|
|
@@ -289,7 +292,9 @@ export async function logout(options = {}) {
|
|
|
289
292
|
|
|
290
293
|
console.error(`❌ ワークスペース「${workspace}」が見つかりません`);
|
|
291
294
|
console.log("");
|
|
292
|
-
console.log(
|
|
295
|
+
console.log(
|
|
296
|
+
"`npx @ignission/slack-task-mcp auth status` で認証済みワークスペースを確認してください",
|
|
297
|
+
);
|
|
293
298
|
return false;
|
|
294
299
|
}
|
|
295
300
|
|
package/src/index.js
CHANGED
|
@@ -13,15 +13,15 @@ import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
|
13
13
|
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
14
14
|
import { WebClient } from "@slack/web-api";
|
|
15
15
|
import { z } from "zod";
|
|
16
|
-
import {
|
|
16
|
+
import { analyzeRequest } from "./agents/analyze.js";
|
|
17
|
+
import { draftReply } from "./agents/draft-reply.js";
|
|
17
18
|
import {
|
|
19
|
+
ensureDataDir,
|
|
18
20
|
getCredentialsByDomain,
|
|
19
21
|
getFirstCredentials,
|
|
20
22
|
listWorkspaces,
|
|
21
|
-
ensureDataDir,
|
|
22
23
|
} from "./credentials.js";
|
|
23
|
-
import {
|
|
24
|
-
import { draftReply } from "./agents/draft-reply.js";
|
|
24
|
+
import { getTasksPath } from "./paths.js";
|
|
25
25
|
|
|
26
26
|
// ============================================
|
|
27
27
|
// ツールパラメータ用 Zodスキーマ
|
|
@@ -335,9 +335,7 @@ server.tool(
|
|
|
335
335
|
const teamDomain = extractTeamDomain(url);
|
|
336
336
|
if (!teamDomain) {
|
|
337
337
|
return {
|
|
338
|
-
content: [
|
|
339
|
-
{ type: "text", text: "URLからワークスペースを特定できませんでした。" },
|
|
340
|
-
],
|
|
338
|
+
content: [{ type: "text", text: "URLからワークスペースを特定できませんでした。" }],
|
|
341
339
|
};
|
|
342
340
|
}
|
|
343
341
|
|
|
@@ -345,9 +343,10 @@ server.tool(
|
|
|
345
343
|
const slackClient = await getSlackClient(teamDomain);
|
|
346
344
|
if (!slackClient) {
|
|
347
345
|
const workspaces = await listWorkspaces();
|
|
348
|
-
const workspaceList =
|
|
349
|
-
|
|
350
|
-
|
|
346
|
+
const workspaceList =
|
|
347
|
+
workspaces.length > 0
|
|
348
|
+
? `\n認証済み: ${workspaces.map((w) => w.team_domain).join(", ")}`
|
|
349
|
+
: "";
|
|
351
350
|
return {
|
|
352
351
|
content: [
|
|
353
352
|
{
|
|
@@ -959,7 +958,9 @@ async function main() {
|
|
|
959
958
|
console.error("❌ Slack認証されていません。");
|
|
960
959
|
console.error(" `npx @ignission/slack-task-mcp auth login` を実行して認証してください。");
|
|
961
960
|
} else {
|
|
962
|
-
console.error(
|
|
961
|
+
console.error(
|
|
962
|
+
`✅ ${workspaces.length} ワークスペース認証済み: ${workspaces.map((w) => w.team_domain).join(", ")}`,
|
|
963
|
+
);
|
|
963
964
|
}
|
|
964
965
|
|
|
965
966
|
const transport = new StdioServerTransport();
|