DEV Community

shibayu36
shibayu36

Posted on

Added File Search and Canvas Retrieval to slack-explorer-mcp

(This is an English translation of my original Japanese article: 日本語版はこちら)

slack-explorer-mcp is an MCP server that lets AI agents search and retrieve Slack messages and threads. It's useful for investigating historical context like "why was this designed this way?" from Slack. For details, see Making Historical Context Easily Discoverable from Slack with AI - Building slack-explorer-mcp.

I added search_files and get_canvas_content tools so that AI agents can also read files and canvases shared on Slack.

search_files Tool

This tool searches for files within Slack, including canvases, PDFs, images, and more. You can filter results by file type, channel, user, and date range.

With slack-explorer-mcp installed, you can search Slack files like this:

  • "Search for PDFs shared in the dev-team channel"
  • "Search for canvases containing the word 'design document'"

get_canvas_content Tool

This tool retrieves HTML content by specifying a canvas ID. It can fetch up to 20 canvases at once.

I wanted AI to be able to read Slack canvas content, but file search alone doesn't return the actual content — you need to download it separately. Since the best approach for feeding content to AI varies by file format, I started with canvas support only.

When you retrieve canvas content, it returns HTML. The original canvas HTML contained a lot of unnecessary ID attributes and style information, which was wasteful in terms of token usage. So I made it automatically strip unnecessary attributes before returning the content. This reduces token consumption when passing the content to AI.

For example, you can:

  • Search for canvases and then have the AI summarize their content
  • Have the AI answer questions based on the content of a specific canvas

Summary

If you have slack-explorer-mcp set up with your AI agent tools, you can now search Slack files and retrieve canvas content. Try it out when you want to use AI to search files in Slack or have it read canvas content.

References

Top comments (0)