Claude and My Email

I declared bankruptcy on my personal inbox a long time ago. There were tens of thousands of emails sitting in there, and my various folders and rules were only partly helping. Since I’ve been having fun with AI for quite some time now, I thought I might try to do something about it. Since I have multiple different providers (Google, Apple, my own mail server, and so on) I decided to have IMAP and SMTP be the common denominator.

I am very hesitant to run OpenClaw on any of the computers on my network, and I’m mostly spending time in Claude Code and the Claude App anyways, so I decided to build an MCP server with tools needed to facilitate the workflow, and then create a skill that can be scheduled in the Claude App. I quite like having the results rendered in proper tables and structured summaries.

The MCP Server

The first version was slow and token-heavy. I quickly realized that mail headers are enormous these days, so I changed the triage flow to be a bit more lightweight while still keeping access to the full headers when needed. There is still a lot of useful information in them.

I also discovered that the Claude app won’t accept binary data from MCP servers other than images, which meant I couldn’t directly access information in PDF attachments. Fortunately, there are great Java libraries for extracting text from PDFs, so adding that support was straightforward.

To make email reading more efficient, HTML emails are converted to Markdown. That cuts the size dramatically, whilst still preserving important structural cues for the AI.

Since this is an MCP server, I also didn’t want to require people to need to have a full Java runtime installed. And since the server doesn’t do especially heavy processing, peak runtime performance wasn’t the main concern. I decided to build it as a GraalVM native image and optimize for memory footprint and startup time instead.

Here is the MCP server, with instructions on how to install it in both Claude Code and the Claude App:
https://github.com/thegreystone/mcp-email

In early experiments, after interacting with it a bit, I asked it whether there were any email conversations with my friends where I dropped the ball. It identified two. Correctly. Ugh. I also asked it things like:

Please find any emails from my tax lawyers around the taxation year 2025, identify all the necessary documentation asked for, and provide an action plan for getting that documentation.

It did very well. Being able to read PDF attachments turned out to be especially useful.

I also often ask it to prepare drafts for me, especially when I need to communicate in German, for example with authorities or businesses. The draft ends up in the Drafts folder, properly set up with the right thread, recipients, and so on, leaving me only to decide whether to send it as-is or make a few edits first.

Initially, this was my favourite prompt:

Please help triage the emails in my inboxes. As per usual, flag anything that is actionable. Don’t hesitate to read emails that you are uncertain about. For anything actionable, provide an action plan. For anything non-actionable, file according to the folder layout.

Adding a Skill

Once the MCP server is installed, adding a skill to Claude is as easy as asking it to create one for itself. Claude has a skill-creator tool that it can use for this.

I asked it to do something along these lines (it was actually edited and improved a few times iteratively, so this is a rough approximation):

Please create a skill using the skill-creator that triages the email across all my accounts in parallel. Flag anything that is actionable. Don’t hesitate to read emails that you are uncertain about. For anything actionable, provide an action plan. For anything non-actionable, file according to the folder layout. At the end of the triage, provide a summary of everything that was done by folder.

The skill should:

  1. Load a persistent ACTIONABLE.md file at the start of each session (path configurable), carry forward unresolved items, and update it at the end.
  2. Run triageCompact on all accounts in parallel (unread first, then a pass over read-but-unfiled emails).
  3. Read full emails when context is needed (e.g. financial, GitHub notifications, ambiguous senders, shipping, calendar invites).
  4. Identify and move spam (will be used to train SpamAssassin later), leave pre-classified Junk alone.
  5. Flag actionable emails before filing.
  6. File everything according to the existing folder hierarchy (if an additional folder would be useful, suggest it).
  7. Cross-reference flagged emails against open ACTIONABLE.md items to detect resolutions.
  8. Produce a structured summary with action plan.

Key resolution logic: Only mark items resolved with positive evidence (delivery confirmed, payment received, PR closed, reply sent). When in doubt, keep open and ask.

Initially, the skill had no memory between sessions. Each scheduled run would rediscover the same actionable items, and it couldn’t tell whether something had been resolved since last time. This became obvious when I asked about an ongoing conversation with my tax lawyers; Claude couldn’t find it because the earlier session was no longer accessible. The fix was simple: a persistent ACTIONABLE.md file that the skill reads at the start of each triage and updates at the end. Open items carry forward, resolved ones get cleared (but only with positive evidence — a delivery confirmed, a payment received, a reply sent), and new items get added. Getting the file location right took a couple of iterations. Claude initially computed it via a convoluted relative path before I pointed out that with the workspace folder configured, ./ACTIONABLE.md was all it needed. It’s just a Markdown file on disk, but it gives the scheduled runs the continuity they were missing.

A quick note on SpamAssassin: the reason I move detected spam to a separate folder rather than deleting it is that I use it to train SpamAssassin. Over time, the obvious spam gets caught before it ever reaches Claude, saving tokens and triage effort.

With the skill installed in both Claude Code and the Claude App, there is no longer any need to write long prompts every time. You just run the skill.

Claude Cowork

With a skill, it becomes very easy to run the triage on a schedule. Simply go to the Cowork tab in Claude App, click on Scheduled on the left, and hit New task on the right.

image

Add the prompt you want to run, for example:

Triage my emails using the email skill.

Fill out the details, like the frequency (e.g. daily), the time (e.g. 18:30), the model to use for the work, and a folder where you want Claude to have read and write access.

Considerations

Let’s be clear about what this setup does: it autonomously moves, files, and flags your email. If it gets something wrong, an important email could end up in the wrong folder or, worse, in Spam. You should go into this with your eyes open.

I would not have tried this without a solid backup strategy for my emails. I do regular IMAP backups, so if something goes sideways, I can recover. That said, I’ve been running this daily for over two months now and haven’t lost anything. The skill is also deliberately conservative — it prefers moving emails to deleting them, and requires explicit approval for deletions.

You may also want to think about where you run the MCP server. I run it on a Mac mini that I mostly use for testing and that doesn’t contain anything sensitive. Running it in a virtual machine, or at least under a user account with tightly scoped permissions, is worth considering. The MCP server holds the IMAP and SMTP credentials and connects directly to your mail servers; Claude never sees those credentials. It only interacts with your email through the tools the MCP server exposes. This isn’t fundamentally different from how any email client works — Mail.app, Thunderbird, and Outlook all hold your credentials and maintain persistent connections to your mail servers. The difference is that this one takes actions autonomously, so please treat it accordingly.

There’s also the question of trust. The skill does a genuinely impressive job. It correctly identified dropped conversations with friends, it handles German-language correspondence with authorities, and it went from 30,000+ emails to fewer than ten in my inbox at any given time. But “impressive” isn’t “infallible.” I review the triage summaries after each run, and I’d recommend you do the same, at least until you’ve built up confidence in how it handles your particular email patterns. I may have to eat these words one day, but today I trust it to do a better job than me at keeping track of my ongoing email conversations.

TL;DR

I declared email bankruptcy at 30,000+ unread emails and built an MCP server exposing tools over IMAP/SMTP so Claude can triage, file, and draft replies across all my accounts — no third-party service required. A scheduled skill in Claude Cowork now runs the whole workflow daily, keeping my inbox down to a handful of actively tracked items.

A Pretty Shitty Week

I am writing this, since I often process crappy stuff by writing about it, and also since I know that my family isn’t reading my blog. A long time ago, my now oldest daughter Natalie (and therefore my wife and I) experienced what was then the scariest day of our life. We almost lost Natalie that time. Earlier this week it all came crashing over us again.

My daughter came home from school complaining about stomach ache. She said that it would probably pass in a bit, but my mind was already racing. We waited for a bit, but the pain didn’t seem natural and wasn’t getting any better. Given her history we weren’t taking any chances, and I convinced my daughter that it is better to go once too many and that she would sleep better tonight if a doctor told her that it wasn’t anything scary. I drove directly to the nearest large hospital, LUKS, and went straight for the emergency room. Meanwhile my wife stayed at home to search for a letter from the Karolinska Hospital describing her prior medical history.

When we arrived Natalie was already in a lot of pain, but her usual brave self. I told the emergency crew about her previous history and they hooked her up to fluids. Meanwhile my wife had found the letter and sent a photo of it to my phone. The emergency crew read it and asked me to email it to them. I believe this made them take this more seriously, which was turned out to be good.

They did an ultra sound, after which they called the surgeons who in turn asked for a CT scan. Whilst waiting for the CT scan to be done, the nurse asked me how I was doing. I must admit that I broke down. As a parent, I guess one of the hardest things you do is to try to stay clear headed and strong for your kids, and try not to show them how scared you are. I was terrified, and all the memories from that day almost 15 years ago came crashing down over me again.

After this we were directed to an emergency room, and they put in a stomach probe through my daughter’s nose. Everyone was friendly and professional, but my heart broke when I heard my daughter ask the nurse “will I die”, and the nurse replied “many things will have to go wrong for that to happen”. That is such a dumb thing to say to very scared 16 year old girl. Natalie looked over at me, absolutely terrified. I tried my best to reassure her and to let her know that nothing was going to happen, and that she was at the best possible place and that she was getting the best possible care.

They tried to blow air through the probe to get things started and gave her fluids and painkillers. They said they wanted to avoid surgery if they could, and wanted to wait to see if the treatment would sort it out. Meanwhile I tried calling my insurance company to ask if there was any way I could stay with her. I was certainly not going to leave her there alone. I couldn’t get through, but luckily I had installed the insurance company app, and it turned out I had a Flex insurance which allowed for “Rooming In”, which meant we got a room for just the two of us and that I could stay with her. We got to the room at 2 am or so. She was still in pain, and it was hard for her sleep with the tubes and lines. She is such a strong kid though.

For a while it seemed like the treatment was improving things a little. My wife gathered some clothes for Natalie and she came over to stay with her, and I went home to take care of the other kids. Then things went downhill. Yesterday they made the decision to perform surgery. They had three options. They said that they would try to do peephole surgery, but that in the worst case they’d have to open her up, with another two options there. If we were lucky it would be over in 15 minutes. She was rolled into surgery around 9 a.m., and we didn’t hear anything back until after 11. My wife got to see her after 12. Apparently there were three separate places where there intestines were obstructed.

Today she is on the mend. She has eaten a little bit of soup, and as far as I know she got to keep it. She’ll likely be in the hospital for a few more days, but it looks like the crisis has been averted for this time. Please, pretty please, let this be the last and final one. I’m not sure I can stand watching her in that kind of pain again.