---
title: "Slack + MCP"
video_id: iCqQmeNFHOg
url: https://www.youtube.com/watch?v=iCqQmeNFHOg
workflow_page: https://workflows-of-ai.com/workflow/slack-mcp
language: en
captions: generated
---

0:00 This video is sponsored by Freel give.
0:02 If you need help with Drupal and get in
0:04 contact with us. So today I'm going to
0:07 do a video about a tool that I built
0:11 without writing a single line of code.
0:13 Um that is your typical chat with your
0:18 content uh chatbot or agent. So you can
0:22 see you know I have added some content
0:24 but with a twist. So, what are we going
0:25 to do here? We're going to go into Slack
0:28 and ask Slack via Drupalot, can you find
0:30 all article about men's health, mental
0:33 health? There should be this article
0:35 that's the only one that has something
0:37 to do with mental health. And it answers
0:39 back with an actual link to my website.
0:43 So, how does this work?
0:46 So, this time I will not actually show
0:48 you how to set it up. I will show you
0:50 how it is set up. Um, it took me pretty
0:54 long time to figure out some stuff in
0:56 ENCA, but if you know ECA well and if
0:58 you know agents API, well, you can
1:01 easily set this up in 30 minutes. And
1:05 the kicker is you don't need to write a
1:06 single line of code to get this working.
1:09 So, I just made a very ugly image here
1:12 of what's happening. You're you're a
1:15 user. You write something Slack. Slack
1:17 has something called events where you
1:19 can send events as web hooks. This is
1:22 being sent into a custom ECA web hook I
1:25 have set up and this is then triggering
1:28 the agent with whatever message this
1:30 person has sent here as long as it's to
1:33 the Drupal bot. Uh one of the tools that
1:36 the agent has. So it has the you know
1:40 possibility to look at the content but
1:41 it also has the possibility to via the
1:44 MCP client run the Slack MCP server. So
1:47 we have installed the Slack MCP server
1:49 on the same well in this case my local
1:52 machine uh that makes it possible to get
1:55 all the tools that available there and
1:57 one of the tools is to post an answer.
2:00 So that is the way that the agent can
2:02 actually post an answer in this case.
2:06 So what you need to have well you need
2:08 to have set up a event subscription to
2:11 some kind of uh a web hook and that's
2:15 what I've set up in this CCA then it it
2:19 probably looks more complex than it is
2:22 but it took some time to get it right.
2:24 So what's happening here that we get a a
2:27 web hook message
2:29 uh we say that anyone can push there
2:32 because Slack will never be
2:34 authenticated. Of course we get the
2:37 payload. I just log it just to be able
2:39 to uh debug it. So that step you don't
2:42 necessarily need un serialize this
2:45 payload. And the payload there are two
2:50 basic parts of the payload that's
2:52 important. So one thing is the first
2:54 time when you're setting it up, you have
2:56 to basically say that I am the owner of
2:58 this website, which means that if they
3:01 say send a challenge, you have to
3:02 respond with the same challenge to prove
3:05 that you own it. Uh so that's one way
3:09 it's I'm currently putting in a cache or
3:12 if there are instructions then the
3:14 actual instructions
3:16 uh we save those in a cache. I'm also
3:18 logging this and here you can see it
3:20 will only do that if it has a at@
3:22 drupalbot mention. So you can see it
3:25 should contain this. It's the ID of the
3:27 Drupal bot. Then the web hook uh
3:30 respawn. So if the challenge exists,
3:33 it's going to output the actual
3:34 challenge. Otherwise, we just output
3:37 nothing because the web hook doesn't
3:39 really care about the response when it's
3:41 being used after you have validated it.
3:44 uh and what uh took me some time to
3:48 understand because I didn't read the
3:50 documentation stupid as I am. I just saw
3:53 the agent getting triggered over and
3:55 over. It turns out that you have to uh
3:58 have a response within 3 seconds
4:00 otherwise Slack starts retrying again.
4:04 And since agents can take pretty long
4:07 time to run, this might be over 3
4:10 seconds. So what we do here is we're
4:11 actually outputting something. We're
4:13 throwing it out to the buffer. The web
4:14 server gets it and responds, but the PHP
4:17 continues running in the background. So
4:19 after the response is sent, we get the
4:21 instruction cache check so it exists.
4:24 Then we log this for debugging again. We
4:26 delete it so it doesn't run on every
4:28 page load of course. And then we trigger
4:31 the agent with this instructions. Then
4:35 um and that is the ECA model. Then that
4:41 is the first part that has now triggered
4:44 the agent. So what we have set up then
4:46 in the agent or no before we set up that
4:50 uh we have set up the MCP server because
4:52 the agent is going to need this. So we
4:55 have set up a slack MCP server uh that
5:01 is using it's this slack MCP server. So
5:05 it's just sitting there listening to a
5:07 port. Uh, and if you then add MCP
5:12 server, I'm going to edit it now. You
5:14 just say the host name. In this case,
5:16 it's outside of my Docker. That's why it
5:18 has this funny host name. You get all
5:20 the tools that's available. And those
5:22 are the tools that you can make
5:25 available to the agents. I've only done
5:27 Slack post message in this case, but you
5:29 see you can get channel history. You can
5:31 add a reaction or or do other stuff with
5:34 this MTB server. And then you can then
5:38 set up the uh uh agent
5:42 which is a pretty simple actually agent
5:46 it basically says you know go and find
5:48 something in rag if you don't find
5:50 anything say that um I have done videos
5:53 before on how to set up rag search but
5:55 what's important here then is you have
5:58 to make sure you use the slack post
6:00 message with the same output
6:03 u and then today's date is it's getting
6:06 today's date. So you can ask can you get
6:08 me the I don't know the latest or can
6:10 you get me an article within the last
6:12 week or something. The tools it has is
6:14 Slack post message and uh somewhere it
6:17 should have rag vector search as well.
6:20 That's the only two tools we have. We
6:22 have set that the rag vector search can
6:24 only search in articles.
6:27 Uh and we have set that the Slack post
6:29 message can only then post in this
6:32 specific channel that we had.
6:36 uh outside of that it is basically set
6:38 up as a normal uh
6:42 rag
6:44 agent. So how you would set it up with
6:46 the AI assistance framework. So the only
6:49 difference is here now we're running a
6:51 Slack MCP server that can answer and we
6:54 have a ECA agent that can trigger the
6:57 agent. Uh and yeah, that's it. We're
7:02 actually getting somewhere, especially
7:04 now when we're working together with
7:05 Jurgen with ECA, that there is so crazy
7:10 capabilities that you can do with Drupal
7:12 without developing anything.
7:15 Thank you for watching.
