From the course: AI Productivity with MCP: How to Leverage MCP Servers with Claude

Smart email analysis and extraction

- AI can feel overwhelming, especially when it is not connected to the apps and tools that you use every single day. Now this is where model context protocol, or MCP, changes everything. In this course, I'll show you how to use MCP servers with Claude to automate tedious tasks, like turning your inbox chaos into actionable insights, transforming your database records into instant answers, and even converting your meeting notes into actionable to-dos, which are directly logged into your project management software. If your inbox decides your day, this lesson is going to flip that. I'm going to show you how you can connect Claude AI web application with your inbox. Without wasting any time, let's get straight into it to understand how we can do that. I am in my Claude AI web application, and in any new chat, if you click on search and tools, you'll see a bunch of these connectors here. You have some of these official connectors, which is Drive search, Gmail search, Calendar search. Now these are provided by Claude, Anthropic team. And if you scroll down a little bit and you click on Manage Connectors, it'll take you to this page with connectors. Now these are some of the official connectors provided by Anthropic, and we can further add some custom connectors as well. Now with Gmail, the issue is, the official connectors give you only read only access. So if I want to send or draft emails, I will not be able to do that using the official connectors. So the amount of stuff I can do with the official connectors is limited. I would use a custom connector in this case, and I have a custom connector here. Let me remove it and show you step by step how I add a custom connector, create my own MCP server, and then add it here. For this, we'll go straight to N8N, an AI automation software. So N8N, if you're not familiar with this software, you can look at LinkedIn's course library. There are a bunch of courses on N&N, it's very simple to learn and quickly build on top of. I'll show you step by step how I'm going to create an MCP server and how I'll connect my Gmail inbox with Claude. I'll click on add first step. This is a blank canvas, a new workflow that I am building. Add first step. In this panel, I'll search for MCP server trigger. So this workflow gets triggered through this node, so I'll click on this, and it opens up this configuration panel for me. From here, I am interested in this production URL. I'll copy this later to connect with Claude. Let's click outside to get out of it. Now this MCP server trigger, I can now add a bunch of different tools to this server. Now I'll decide the capability of this MCP server. Now I want to send email, I want to read a lot of emails, so I'll add two tools to this MCP server. If you want more based on your use case, you can add more. I'll click on this plus icon, tools, I'll search for Gmail, and from here the first thing that you'll have to do, you'll have to connect your Gmail account. So you click on this dropdown. I already have a bunch of my Gmail accounts connected. You'll click on create new Credential. You'll click on sign in with Google, and that's it. You'll be able to connect your Google account with N8N. Once your credentials are connected, you have provided them, tool description, set automatically, resource, message, operation, send. Nothing to change here. So now the email address of the recipient. I'll click on this AI button here. So I'll say let the model define this parameter. Based on what I'm seeing from Claude, this parameter will be auto-filled using AI. Similarly, the subject of the email will be automatically picked by the large language model, email type, text, message also will be picked automatically by AI. So this becomes my first tool, simple. I'll add another tool, again, Gmail tool, and this time I'm going to change the operation. I'm going to select, I want to read many emails. So I'll click this operation, which is get many, and here I'll add a filter. This filter is search filter. Based on the search query provided in Claude, in plain English, Claude would automatically frame that English query into a Gmail search query, and it will be automatically picked by AI. So I'll say search for those emails, let's say today's emails, and I'll pick only today's emails by drafting that search query. Great. I have this MCP server ready with two tools. If you want more tools, you can add more tools. Click on MCP server, double click, go to production URL, and then copy this URL. This is the URL that you would need to connect with your Claude AI application. Great. Click on save first, and then turn this inactive to active. You have to toggle this button right here. Now this workflow is active, so I'll be able to talk to this workflow, talk to this MCP server that we have just created on N8N. I'll go back to Claude, and you see in the connectors page I have this add custom connector button. I'll click on this, I'll add gmail_mcp_n8n. This is the name, you can provide any name. And then this is where you have to paste your Gmail MCP server URL. So paste it, add. In a few seconds, your Gmail MCP N8N server would be ready. If you click on configure, you'll see both of these tools are added. You can now get many emails or send a message. Now I'll open up a new chat. I'm going to type in my prompt, which is prioritize unread emails from last 24 hours, draft polite replies, label urgent versus later. That's it, this is my prompt. Now as soon as I click send, you can see Gmail MCP N8N server is ready. Claude would automatically figure out that this MCP server needs to be triggered and the request is going to go to my MCP server. You can see Claude wants to use Get many messages in Gmail from gmail_mcp_n8n. Allow once, and this is now going to fetch all the emails. And if I show you, these are a bunch of emails, "Any update on AB test design?" Comms app subscription, AI app subscription renewed. These are a bunch of emails that I've got. So let's see. So urgent require immediate response, AB test design update. Okay, that's great. That's a work email and it has drafted a reply as well. That's great. Then I have code review request from Agentiwise. Okay, thanks for raising a PR. Later, and then there are a bunch of like other emails which are categorized as later. Some of these are subscription payments, Comms app subscription, all of these other things. Great. If I want to, let's say, extract action items, extract all the action items from my inbox for today, which is basically last, let's say 12 hours. So now again, it is going to go through all of my emails, fetch all the action items, and then give me that complete list right here. So action items from last 12 hours. Immediate provide AB test update and deadline, review dashboard PR, financial actions, process subscription payments, acknowledge subscription. Great. Another thing that I can do is I can analyze all the invoices and subscription payments from my inbox. You can do last one week, last one month to stay on top of your monthly expenses. I'll just do last, let's say 12 hours, to see like how many financial payments we have made. So allow once. And it's going to go through all of those emails and then give you complete summary. So you can see a great Tableau formatting. I'll stay on top of, okay, outgoing, incoming, everything. So all of these are the subscriptions that I actually have in my inbox. App subscription, Comms app subscription, invoices now available for payment, all of those things. Great. So this is all the analysis that you can do. Further, if you want to send an email, let's say I want to send an email to this person reminding him that there is a discovery call later, discovery call request from a client for an automation project. Let's see if it is able. So you can see I am, like in all the earlier requests, we used get many tool, get many messages. This time we are going to be using send message tool from our Gmail MCP. So you can go to executions, and here you will find all of the executions. If you click on this one right here, this is a send a message. So if you double click, there was a message was sent, and I would've received a message in my other inbox. So let me open that up and show you that I would've gotten an email. Here we go. I have an email, work.harshit. "I hope this email finds you well. This is a friendly reminder that there is a discovery call request." And you can see there, the email was sent automatically with N8N. You can remove that. So head to the send email option, you can go back to the editor, double click on this from add option, append N8N attribution, you can turn this off. So now you would not see that message at the bottom of your email. So that's it. You have now the ability to chat in plain English and control your entire inbox. That's like pro level email management for you.

Contents