@sena-ai/tools-slack 0.0.1
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/__tests__/mcp-protocol.test.d.ts +2 -0
- package/dist/__tests__/mcp-protocol.test.d.ts.map +1 -0
- package/dist/__tests__/mcp-protocol.test.js +21 -0
- package/dist/__tests__/mcp-protocol.test.js.map +1 -0
- package/dist/__tests__/slackTools.test.d.ts +2 -0
- package/dist/__tests__/slackTools.test.d.ts.map +1 -0
- package/dist/__tests__/slackTools.test.js +16 -0
- package/dist/__tests__/slackTools.test.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -0
- package/dist/mcp-server.d.ts +2 -0
- package/dist/mcp-server.d.ts.map +1 -0
- package/dist/mcp-server.js +216 -0
- package/dist/mcp-server.js.map +1 -0
- package/dist/slackTools.d.ts +10 -0
- package/dist/slackTools.d.ts.map +1 -0
- package/dist/slackTools.js +23 -0
- package/dist/slackTools.js.map +1 -0
- package/package.json +26 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mcp-protocol.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/mcp-protocol.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { describe, it, expect } from 'vitest';
|
|
2
|
+
// Test the tool definitions are well-formed
|
|
3
|
+
const tools = [
|
|
4
|
+
{ name: 'slack_get_messages', requiredArgs: ['channelId'] },
|
|
5
|
+
{ name: 'slack_post_message', requiredArgs: ['channelId', 'text'] },
|
|
6
|
+
{ name: 'slack_list_channels', requiredArgs: [] },
|
|
7
|
+
{ name: 'slack_upload_file', requiredArgs: ['channelId', 'content', 'filename'] },
|
|
8
|
+
{ name: 'slack_download_file', requiredArgs: ['fileId'] },
|
|
9
|
+
];
|
|
10
|
+
describe('Slack MCP tool definitions', () => {
|
|
11
|
+
it('exposes 5 tools', () => {
|
|
12
|
+
expect(tools).toHaveLength(5);
|
|
13
|
+
});
|
|
14
|
+
it('all tools have names', () => {
|
|
15
|
+
for (const tool of tools) {
|
|
16
|
+
expect(tool.name).toBeDefined();
|
|
17
|
+
expect(tool.name).toMatch(/^slack_/);
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
});
|
|
21
|
+
//# sourceMappingURL=mcp-protocol.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mcp-protocol.test.js","sourceRoot":"","sources":["../../src/__tests__/mcp-protocol.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAE7C,4CAA4C;AAC5C,MAAM,KAAK,GAAG;IACZ,EAAE,IAAI,EAAE,oBAAoB,EAAE,YAAY,EAAE,CAAC,WAAW,CAAC,EAAE;IAC3D,EAAE,IAAI,EAAE,oBAAoB,EAAE,YAAY,EAAE,CAAC,WAAW,EAAE,MAAM,CAAC,EAAE;IACnE,EAAE,IAAI,EAAE,qBAAqB,EAAE,YAAY,EAAE,EAAE,EAAE;IACjD,EAAE,IAAI,EAAE,mBAAmB,EAAE,YAAY,EAAE,CAAC,WAAW,EAAE,SAAS,EAAE,UAAU,CAAC,EAAE;IACjF,EAAE,IAAI,EAAE,qBAAqB,EAAE,YAAY,EAAE,CAAC,QAAQ,CAAC,EAAE;CAC1D,CAAA;AAED,QAAQ,CAAC,4BAA4B,EAAE,GAAG,EAAE;IAC1C,EAAE,CAAC,iBAAiB,EAAE,GAAG,EAAE;QACzB,MAAM,CAAC,KAAK,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,CAAA;IAC/B,CAAC,CAAC,CAAA;IAEF,EAAE,CAAC,sBAAsB,EAAE,GAAG,EAAE;QAC9B,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;YACzB,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,WAAW,EAAE,CAAA;YAC/B,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,SAAS,CAAC,CAAA;QACtC,CAAC;IACH,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"slackTools.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/slackTools.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { describe, it, expect } from 'vitest';
|
|
2
|
+
import { slackTools } from '../slackTools.js';
|
|
3
|
+
describe('slackTools', () => {
|
|
4
|
+
it('creates a ToolPort with correct name and type', () => {
|
|
5
|
+
const tool = slackTools({ botToken: 'xoxb-test-token' });
|
|
6
|
+
expect(tool.name).toBe('slack');
|
|
7
|
+
expect(tool.type).toBe('mcp-stdio');
|
|
8
|
+
});
|
|
9
|
+
it('generates MCP config with token in env', () => {
|
|
10
|
+
const tool = slackTools({ botToken: 'xoxb-test-token' });
|
|
11
|
+
const config = tool.toMcpConfig({ name: 'claude' });
|
|
12
|
+
expect(config.command).toBe('node');
|
|
13
|
+
expect(config.env.SLACK_BOT_TOKEN).toBe('xoxb-test-token');
|
|
14
|
+
});
|
|
15
|
+
});
|
|
16
|
+
//# sourceMappingURL=slackTools.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"slackTools.test.js","sourceRoot":"","sources":["../../src/__tests__/slackTools.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAC7C,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAE7C,QAAQ,CAAC,YAAY,EAAE,GAAG,EAAE;IAC1B,EAAE,CAAC,+CAA+C,EAAE,GAAG,EAAE;QACvD,MAAM,IAAI,GAAG,UAAU,CAAC,EAAE,QAAQ,EAAE,iBAAiB,EAAE,CAAC,CAAA;QAExD,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;QAC/B,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,CAAA;IACrC,CAAC,CAAC,CAAA;IAEF,EAAE,CAAC,wCAAwC,EAAE,GAAG,EAAE;QAChD,MAAM,IAAI,GAAG,UAAU,CAAC,EAAE,QAAQ,EAAE,iBAAiB,EAAE,CAAC,CAAA;QACxD,MAAM,MAAM,GAAG,IAAI,CAAC,WAAW,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAQ,CAAA;QAE1D,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;QACnC,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,eAAe,CAAC,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAA;IAC5D,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAC5C,YAAY,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAA"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mcp-server.d.ts","sourceRoot":"","sources":["../src/mcp-server.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,216 @@
|
|
|
1
|
+
import { WebClient } from '@slack/web-api';
|
|
2
|
+
import { createInterface } from 'node:readline';
|
|
3
|
+
const SLACK_BOT_TOKEN = process.env.SLACK_BOT_TOKEN;
|
|
4
|
+
if (!SLACK_BOT_TOKEN) {
|
|
5
|
+
console.error('SLACK_BOT_TOKEN is required');
|
|
6
|
+
process.exit(1);
|
|
7
|
+
}
|
|
8
|
+
const slack = new WebClient(SLACK_BOT_TOKEN);
|
|
9
|
+
// === Tool definitions ===
|
|
10
|
+
const tools = [
|
|
11
|
+
{
|
|
12
|
+
name: 'slack_get_messages',
|
|
13
|
+
description: 'Get messages from a Slack channel or thread',
|
|
14
|
+
inputSchema: {
|
|
15
|
+
type: 'object',
|
|
16
|
+
properties: {
|
|
17
|
+
channelId: { type: 'string', description: 'Channel ID' },
|
|
18
|
+
threadTs: { type: 'string', description: 'Thread timestamp (optional)' },
|
|
19
|
+
limit: { type: 'number', description: 'Max messages to return (default 20)' },
|
|
20
|
+
},
|
|
21
|
+
required: ['channelId'],
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
name: 'slack_post_message',
|
|
26
|
+
description: 'Post a message to a Slack channel or thread',
|
|
27
|
+
inputSchema: {
|
|
28
|
+
type: 'object',
|
|
29
|
+
properties: {
|
|
30
|
+
channelId: { type: 'string', description: 'Channel ID' },
|
|
31
|
+
text: { type: 'string', description: 'Message text' },
|
|
32
|
+
threadTs: { type: 'string', description: 'Thread timestamp (optional, for replying in thread)' },
|
|
33
|
+
},
|
|
34
|
+
required: ['channelId', 'text'],
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
name: 'slack_list_channels',
|
|
39
|
+
description: 'List accessible Slack channels',
|
|
40
|
+
inputSchema: {
|
|
41
|
+
type: 'object',
|
|
42
|
+
properties: {
|
|
43
|
+
limit: { type: 'number', description: 'Max channels to return (default 100)' },
|
|
44
|
+
types: { type: 'string', description: 'Channel types (default "public_channel,private_channel")' },
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
name: 'slack_upload_file',
|
|
50
|
+
description: 'Upload content as a file to a Slack channel',
|
|
51
|
+
inputSchema: {
|
|
52
|
+
type: 'object',
|
|
53
|
+
properties: {
|
|
54
|
+
channelId: { type: 'string', description: 'Channel ID' },
|
|
55
|
+
content: { type: 'string', description: 'File content' },
|
|
56
|
+
filename: { type: 'string', description: 'Filename' },
|
|
57
|
+
title: { type: 'string', description: 'File title (optional)' },
|
|
58
|
+
},
|
|
59
|
+
required: ['channelId', 'content', 'filename'],
|
|
60
|
+
},
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
name: 'slack_download_file',
|
|
64
|
+
description: 'Download a file from Slack by file ID',
|
|
65
|
+
inputSchema: {
|
|
66
|
+
type: 'object',
|
|
67
|
+
properties: {
|
|
68
|
+
fileId: { type: 'string', description: 'Slack file ID' },
|
|
69
|
+
},
|
|
70
|
+
required: ['fileId'],
|
|
71
|
+
},
|
|
72
|
+
},
|
|
73
|
+
];
|
|
74
|
+
// === Tool implementations ===
|
|
75
|
+
async function executeTool(name, args) {
|
|
76
|
+
switch (name) {
|
|
77
|
+
case 'slack_get_messages': {
|
|
78
|
+
const { channelId, threadTs, limit = 20 } = args;
|
|
79
|
+
const params = { channel: channelId, limit };
|
|
80
|
+
let result;
|
|
81
|
+
if (threadTs) {
|
|
82
|
+
params.ts = threadTs;
|
|
83
|
+
result = await slack.conversations.replies(params);
|
|
84
|
+
}
|
|
85
|
+
else {
|
|
86
|
+
result = await slack.conversations.history(params);
|
|
87
|
+
}
|
|
88
|
+
const messages = (result.messages ?? []).map((m) => ({
|
|
89
|
+
user: m.user,
|
|
90
|
+
text: m.text,
|
|
91
|
+
ts: m.ts,
|
|
92
|
+
thread_ts: m.thread_ts,
|
|
93
|
+
}));
|
|
94
|
+
return JSON.stringify(messages, null, 2);
|
|
95
|
+
}
|
|
96
|
+
case 'slack_post_message': {
|
|
97
|
+
const { channelId, text, threadTs } = args;
|
|
98
|
+
const params = { channel: channelId, text };
|
|
99
|
+
if (threadTs)
|
|
100
|
+
params.thread_ts = threadTs;
|
|
101
|
+
const result = await slack.chat.postMessage(params);
|
|
102
|
+
return JSON.stringify({ ok: result.ok, ts: result.ts });
|
|
103
|
+
}
|
|
104
|
+
case 'slack_list_channels': {
|
|
105
|
+
const { limit = 100, types = 'public_channel,private_channel' } = args;
|
|
106
|
+
const result = await slack.conversations.list({ limit, types });
|
|
107
|
+
const channels = (result.channels ?? []).map((c) => ({
|
|
108
|
+
id: c.id,
|
|
109
|
+
name: c.name,
|
|
110
|
+
is_private: c.is_private,
|
|
111
|
+
num_members: c.num_members,
|
|
112
|
+
}));
|
|
113
|
+
return JSON.stringify(channels, null, 2);
|
|
114
|
+
}
|
|
115
|
+
case 'slack_upload_file': {
|
|
116
|
+
const { channelId, content, filename, title } = args;
|
|
117
|
+
const result = await slack.filesUploadV2({
|
|
118
|
+
channel_id: channelId,
|
|
119
|
+
content,
|
|
120
|
+
filename,
|
|
121
|
+
title: title ?? filename,
|
|
122
|
+
});
|
|
123
|
+
return JSON.stringify({ ok: true, file_id: result.file?.id });
|
|
124
|
+
}
|
|
125
|
+
case 'slack_download_file': {
|
|
126
|
+
const { fileId } = args;
|
|
127
|
+
const info = await slack.files.info({ file: fileId });
|
|
128
|
+
const file = info.file;
|
|
129
|
+
if (!file?.url_private) {
|
|
130
|
+
return JSON.stringify({ error: 'File URL not available' });
|
|
131
|
+
}
|
|
132
|
+
// Fetch the file content using the bot token
|
|
133
|
+
const response = await fetch(file.url_private, {
|
|
134
|
+
headers: { Authorization: `Bearer ${SLACK_BOT_TOKEN}` },
|
|
135
|
+
});
|
|
136
|
+
const text = await response.text();
|
|
137
|
+
return JSON.stringify({
|
|
138
|
+
name: file.name,
|
|
139
|
+
mimetype: file.mimetype,
|
|
140
|
+
size: file.size,
|
|
141
|
+
content: text.length > 50000 ? text.slice(0, 50000) + '\n...(truncated)' : text,
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
default:
|
|
145
|
+
throw new Error(`Unknown tool: ${name}`);
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
// === JSON-RPC server ===
|
|
149
|
+
function send(msg) {
|
|
150
|
+
process.stdout.write(JSON.stringify(msg) + '\n');
|
|
151
|
+
}
|
|
152
|
+
function handleRequest(id, method, params) {
|
|
153
|
+
switch (method) {
|
|
154
|
+
case 'initialize':
|
|
155
|
+
send({
|
|
156
|
+
jsonrpc: '2.0',
|
|
157
|
+
id,
|
|
158
|
+
result: {
|
|
159
|
+
protocolVersion: '2024-11-05',
|
|
160
|
+
capabilities: { tools: {} },
|
|
161
|
+
serverInfo: { name: 'sena-slack-mcp', version: '0.0.1' },
|
|
162
|
+
},
|
|
163
|
+
});
|
|
164
|
+
break;
|
|
165
|
+
case 'tools/list':
|
|
166
|
+
send({
|
|
167
|
+
jsonrpc: '2.0',
|
|
168
|
+
id,
|
|
169
|
+
result: { tools },
|
|
170
|
+
});
|
|
171
|
+
break;
|
|
172
|
+
case 'tools/call':
|
|
173
|
+
executeTool(params.name, params.arguments ?? {})
|
|
174
|
+
.then((text) => {
|
|
175
|
+
send({
|
|
176
|
+
jsonrpc: '2.0',
|
|
177
|
+
id,
|
|
178
|
+
result: { content: [{ type: 'text', text }] },
|
|
179
|
+
});
|
|
180
|
+
})
|
|
181
|
+
.catch((err) => {
|
|
182
|
+
send({
|
|
183
|
+
jsonrpc: '2.0',
|
|
184
|
+
id,
|
|
185
|
+
result: {
|
|
186
|
+
content: [{ type: 'text', text: `Error: ${err.message}` }],
|
|
187
|
+
isError: true,
|
|
188
|
+
},
|
|
189
|
+
});
|
|
190
|
+
});
|
|
191
|
+
break;
|
|
192
|
+
default:
|
|
193
|
+
send({
|
|
194
|
+
jsonrpc: '2.0',
|
|
195
|
+
id,
|
|
196
|
+
error: { code: -32601, message: `Method not found: ${method}` },
|
|
197
|
+
});
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
// Main loop
|
|
201
|
+
const rl = createInterface({ input: process.stdin });
|
|
202
|
+
rl.on('line', (line) => {
|
|
203
|
+
if (!line.trim())
|
|
204
|
+
return;
|
|
205
|
+
try {
|
|
206
|
+
const msg = JSON.parse(line);
|
|
207
|
+
if (msg.method && msg.id !== undefined) {
|
|
208
|
+
handleRequest(msg.id, msg.method, msg.params);
|
|
209
|
+
}
|
|
210
|
+
// Notifications (no id) — just ignore
|
|
211
|
+
}
|
|
212
|
+
catch {
|
|
213
|
+
// Ignore malformed lines
|
|
214
|
+
}
|
|
215
|
+
});
|
|
216
|
+
//# sourceMappingURL=mcp-server.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mcp-server.js","sourceRoot":"","sources":["../src/mcp-server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAC1C,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAA;AAE/C,MAAM,eAAe,GAAG,OAAO,CAAC,GAAG,CAAC,eAAe,CAAA;AACnD,IAAI,CAAC,eAAe,EAAE,CAAC;IACrB,OAAO,CAAC,KAAK,CAAC,6BAA6B,CAAC,CAAA;IAC5C,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;AACjB,CAAC;AAED,MAAM,KAAK,GAAG,IAAI,SAAS,CAAC,eAAe,CAAC,CAAA;AAE5C,2BAA2B;AAE3B,MAAM,KAAK,GAAG;IACZ;QACE,IAAI,EAAE,oBAAoB;QAC1B,WAAW,EAAE,6CAA6C;QAC1D,WAAW,EAAE;YACX,IAAI,EAAE,QAAQ;YACd,UAAU,EAAE;gBACV,SAAS,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,YAAY,EAAE;gBACxD,QAAQ,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,6BAA6B,EAAE;gBACxE,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,qCAAqC,EAAE;aAC9E;YACD,QAAQ,EAAE,CAAC,WAAW,C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,OAAO,EAAE,EAAE,CAAC;wBAC1D,OAAO,EAAE,IAAI;qBACd;iBACF,CAAC,CAAA;YACJ,CAAC,CAAC,CAAA;YACJ,MAAK;QAEP;YACE,IAAI,CAAC;gBACH,OAAO,EAAE,KAAK;gBACd,EAAE;gBACF,KAAK,EAAE,EAAE,IAAI,EAAE,CAAC,KAAK,EAAE,OAAO,EAAE,qBAAqB,MAAM,EAAE,EAAE;aAChE,CAAC,CAAA;IACN,CAAC;AACH,CAAC;AAED,YAAY;AACZ,MAAM,EAAE,GAAG,eAAe,CAAC,EAAE,KAAK,EAAE,OAAO,CAAC,KAAK,EAAE,CAAC,CAAA;AACpD,EAAE,CAAC,EAAE,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,EAAE;IACrB,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE;QAAE,OAAM;IACxB,IAAI,CAAC;QACH,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAA;QAC5B,IAAI,GAAG,CAAC,MAAM,IAAI,GAAG,CAAC,EAAE,KAAK,SAAS,EAAE,CAAC;YACvC,aAAa,CAAC,GAAG,CAAC,EAAE,EAAE,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,MAAM,CAAC,CAAA;QAC/C,CAAC;QACD,sCAAsC;IACxC,CAAC;IAAC,MAAM,CAAC;QACP,yBAAyB;IAC3B,CAAC;AACH,CAAC,CAAC,CAAA"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { ToolPort } from '@sena-ai/core';
|
|
2
|
+
export type SlackToolsOptions = {
|
|
3
|
+
botToken: string;
|
|
4
|
+
};
|
|
5
|
+
/**
|
|
6
|
+
* Creates a ToolPort for Slack MCP tools.
|
|
7
|
+
* Exposes: get_messages, post_message, list_channels, upload_file, download_file
|
|
8
|
+
*/
|
|
9
|
+
export declare function slackTools(options: SlackToolsOptions): ToolPort;
|
|
10
|
+
//# sourceMappingURL=slackTools.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"slackTools.d.ts","sourceRoot":"","sources":["../src/slackTools.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAA0B,MAAM,eAAe,CAAA;AAErE,MAAM,MAAM,iBAAiB,GAAG;IAC9B,QAAQ,EAAE,MAAM,CAAA;CACjB,CAAA;AAED;;;GAGG;AACH,wBAAgB,UAAU,CAAC,OAAO,EAAE,iBAAiB,GAAG,QAAQ,CAkB/D"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Creates a ToolPort for Slack MCP tools.
|
|
3
|
+
* Exposes: get_messages, post_message, list_channels, upload_file, download_file
|
|
4
|
+
*/
|
|
5
|
+
export function slackTools(options) {
|
|
6
|
+
const { botToken } = options;
|
|
7
|
+
return {
|
|
8
|
+
name: 'slack',
|
|
9
|
+
type: 'mcp-stdio',
|
|
10
|
+
toMcpConfig(_runtime) {
|
|
11
|
+
// The MCP server is shipped as part of this package
|
|
12
|
+
// It wraps @slack/web-api operations as MCP tool calls
|
|
13
|
+
return {
|
|
14
|
+
command: 'node',
|
|
15
|
+
args: [new URL('../dist/mcp-server.js', import.meta.url).pathname],
|
|
16
|
+
env: {
|
|
17
|
+
SLACK_BOT_TOKEN: botToken,
|
|
18
|
+
},
|
|
19
|
+
};
|
|
20
|
+
},
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=slackTools.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"slackTools.js","sourceRoot":"","sources":["../src/slackTools.ts"],"names":[],"mappings":"AAMA;;;GAGG;AACH,MAAM,UAAU,UAAU,CAAC,OAA0B;IACnD,MAAM,EAAE,QAAQ,EAAE,GAAG,OAAO,CAAA;IAE5B,OAAO;QACL,IAAI,EAAE,OAAO;QACb,IAAI,EAAE,WAAW;QACjB,WAAW,CAAC,QAAqB;YAC/B,oDAAoD;YACpD,uDAAuD;YACvD,OAAO;gBACL,OAAO,EAAE,MAAM;gBACf,IAAI,EAAE,CAAC,IAAI,GAAG,CAAC,uBAAuB,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,QAAQ,CAAC;gBAClE,GAAG,EAAE;oBACH,eAAe,EAAE,QAAQ;iBAC1B;aACF,CAAA;QACH,CAAC;KACF,CAAA;AACH,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@sena-ai/tools-slack",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"exports": {
|
|
6
|
+
".": {
|
|
7
|
+
"types": "./dist/index.d.ts",
|
|
8
|
+
"import": "./dist/index.js"
|
|
9
|
+
}
|
|
10
|
+
},
|
|
11
|
+
"files": ["dist"],
|
|
12
|
+
"bin": {
|
|
13
|
+
"sena-slack-mcp": "./dist/mcp-server.js"
|
|
14
|
+
},
|
|
15
|
+
"scripts": {
|
|
16
|
+
"build": "tsc -b",
|
|
17
|
+
"dev": "tsc -b --watch"
|
|
18
|
+
},
|
|
19
|
+
"dependencies": {
|
|
20
|
+
"@sena-ai/core": "workspace:*",
|
|
21
|
+
"@slack/web-api": "^7.0.0"
|
|
22
|
+
},
|
|
23
|
+
"devDependencies": {
|
|
24
|
+
"typescript": "^5.8.0"
|
|
25
|
+
}
|
|
26
|
+
}
|