Skip to content

Commit 06938c8

Browse files
committed
Merge branch 'main' of https://github.com/modelcontextprotocol/servers into burkeholland-vscode-install-instructions
1 parent e27ca5c commit 06938c8

File tree

3 files changed

+69
-21
lines changed

3 files changed

+69
-21
lines changed

everything/everything.ts

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -114,16 +114,17 @@ export const createServer = () => {
114114

115115
let subscriptions: Set<string> = new Set();
116116
let subsUpdateInterval: NodeJS.Timeout | undefined;
117-
// Set up update interval for subscribed resources
117+
let stdErrUpdateInterval: NodeJS.Timeout | undefined;
118118

119+
// Set up update interval for subscribed resources
119120
subsUpdateInterval = setInterval(() => {
120121
for (const uri of subscriptions) {
121122
server.notification({
122123
method: "notifications/resources/updated",
123124
params: { uri },
124125
});
125126
}
126-
}, 5000);
127+
}, 10000);
127128

128129
let logLevel: LoggingLevel = "debug";
129130
let logsUpdateInterval: NodeJS.Timeout | undefined;
@@ -152,7 +153,21 @@ export const createServer = () => {
152153
};
153154
if (!isMessageIgnored(message.params.level as LoggingLevel))
154155
server.notification(message);
155-
}, 15000);
156+
}, 20000);
157+
158+
159+
// Set up update interval for stderr messages
160+
stdErrUpdateInterval = setInterval(() => {
161+
const shortTimestamp = new Date().toLocaleTimeString([], {
162+
hour: '2-digit',
163+
minute: '2-digit',
164+
second: '2-digit'
165+
});
166+
server.notification({
167+
method: "notifications/stderr",
168+
params: { content: `${shortTimestamp}: A stderr message` },
169+
});
170+
}, 30000);
156171

157172
// Helper method to request sampling from client
158173
const requestSampling = async (
@@ -676,6 +691,7 @@ export const createServer = () => {
676691
const cleanup = async () => {
677692
if (subsUpdateInterval) clearInterval(subsUpdateInterval);
678693
if (logsUpdateInterval) clearInterval(logsUpdateInterval);
694+
if (stdErrUpdateInterval) clearInterval(stdErrUpdateInterval);
679695
};
680696

681697
return { server, cleanup };

slack/README.md

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ MCP Server for the Slack API, enabling Claude to interact with Slack workspaces.
55
## Tools
66

77
1. `slack_list_channels`
8-
- List public channels in the workspace
8+
- List public or pre-defined channels in the workspace
99
- Optional inputs:
1010
- `limit` (number, default: 100, max: 200): Maximum number of channels to return
1111
- `cursor` (string): Pagination cursor for next page
@@ -102,7 +102,8 @@ Add the following to your `claude_desktop_config.json`:
102102
],
103103
"env": {
104104
"SLACK_BOT_TOKEN": "xoxb-your-bot-token",
105-
"SLACK_TEAM_ID": "T01234567"
105+
"SLACK_TEAM_ID": "T01234567",
106+
"SLACK_CHANNEL_IDS": "C01234567, C76543210"
106107
}
107108
}
108109
}
@@ -124,11 +125,14 @@ Add the following to your `claude_desktop_config.json`:
124125
"SLACK_BOT_TOKEN",
125126
"-e",
126127
"SLACK_TEAM_ID",
128+
"-e",
129+
"SLACK_CHANNEL_IDS",
127130
"mcp/slack"
128131
],
129132
"env": {
130133
"SLACK_BOT_TOKEN": "xoxb-your-bot-token",
131-
"SLACK_TEAM_ID": "T01234567"
134+
"SLACK_TEAM_ID": "T01234567",
135+
"SLACK_CHANNEL_IDS": "C01234567, C76543210"
132136
}
133137
}
134138
}

slack/index.ts

Lines changed: 43 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ interface GetUserProfileArgs {
5353
// Tool definitions
5454
const listChannelsTool: Tool = {
5555
name: "slack_list_channels",
56-
description: "List public channels in the workspace with pagination",
56+
description: "List public or pre-defined channels in the workspace with pagination",
5757
inputSchema: {
5858
type: "object",
5959
properties: {
@@ -221,23 +221,51 @@ class SlackClient {
221221
}
222222

223223
async getChannels(limit: number = 100, cursor?: string): Promise<any> {
224-
const params = new URLSearchParams({
225-
types: "public_channel",
226-
exclude_archived: "true",
227-
limit: Math.min(limit, 200).toString(),
228-
team_id: process.env.SLACK_TEAM_ID!,
229-
});
230-
231-
if (cursor) {
232-
params.append("cursor", cursor);
224+
const predefinedChannelIds = process.env.SLACK_CHANNEL_IDS;
225+
if (!predefinedChannelIds) {
226+
const params = new URLSearchParams({
227+
types: "public_channel",
228+
exclude_archived: "true",
229+
limit: Math.min(limit, 200).toString(),
230+
team_id: process.env.SLACK_TEAM_ID!,
231+
});
232+
233+
if (cursor) {
234+
params.append("cursor", cursor);
235+
}
236+
237+
const response = await fetch(
238+
`https://slack.com/api/conversations.list?${params}`,
239+
{ headers: this.botHeaders },
240+
);
241+
242+
return response.json();
233243
}
234244

235-
const response = await fetch(
236-
`https://slack.com/api/conversations.list?${params}`,
237-
{ headers: this.botHeaders },
238-
);
245+
const predefinedChannelIdsArray = predefinedChannelIds.split(",").map((id: string) => id.trim());
246+
const channels = [];
239247

240-
return response.json();
248+
for (const channelId of predefinedChannelIdsArray) {
249+
const params = new URLSearchParams({
250+
channel: channelId,
251+
});
252+
253+
const response = await fetch(
254+
`https://slack.com/api/conversations.info?${params}`,
255+
{ headers: this.botHeaders }
256+
);
257+
const data = await response.json();
258+
259+
if (data.ok && data.channel && !data.channel.is_archived) {
260+
channels.push(data.channel);
261+
}
262+
}
263+
264+
return {
265+
ok: true,
266+
channels: channels,
267+
response_metadata: { next_cursor: "" },
268+
};
241269
}
242270

243271
async postMessage(channel_id: string, text: string): Promise<any> {

0 commit comments

Comments
 (0)