Akonadi MCP Server: let your AI assistant access your KDE PIM data

A few weeks ago, kdepim-addons gained a new component: akonadimcpprotocol, an MCP (Model Context Protocol) server that gives an AI assistant, or any MCP-compatible client, access to your Akonadi data: contacts, calendars, to-dos and mail.

Requirement: ktextaddons 2.3.0

The server is built on the MCP library from ktextaddons (TextAutoGenerateTextMcpProtocolCore and TextAutoGenerateTextMcpProtocolWidgets). You need ktextaddons 2.3.0 or later. If CMake cannot find KF6TextAutoGenerateTextMcpProtocolWidgets, the akonadi-mcp-server directory is skipped without any error. So update ktextaddons before you rebuild kdepim-addons.

The CMake option OPTION_ADD_MPCPROTOCOL (on by default) controls whether the server is built.

What the server provides

The server provides about thirty MCP tools, grouped by area:

Contacts

  • contact_search: search by name or email address, with a choice of fields to return (email, phone, location, birthday);
  • contact_list_address_books, contact_group_expand, contact_upcoming_birthdays;
  • contact_create, contact_update, contact_delete, contact_group_create.

Calendar and to-dos

  • calendar_list, calendar_events, calendar_free_busy, calendar_todo_list;
  • calendar_create_event, calendar_create_todo, calendar_create_journal;
  • calendar_update_incidence, calendar_delete_incidence.

Mail (with KMail)

  • mail_search, mail_open (shows the message in a read-only KMail viewer window);
  • mail_create: creates a draft in the Drafts folder. The mail is never sent;
  • mail_edit, mail_reply, mail_forward: open a KMail composer, and you decide whether to send;
  • mail_mark, mail_move;
  • mail_list_identities, mail_create_identity, mail_create_transport (SMTP setup; the password is stored in the wallet).

Miscellaneous

  • akonadi_resources_status: status of the Akonadi resources.

Safety: confirmation before any change

Language models make mistakes. Each tool is therefore classified as read-only, modifying or destructive. By default, any tool that changes data (creating, updating or deleting items, moving a mail…) triggers a desktop notification. It shows the tool being called and its arguments, with Accept and Reject buttons.

Plasma notification "MCP tool asks confirmation": Run "Delete Contact"? with Accept and Reject buttons
The server asks for confirmation before deleting a contact.
  • If you do not answer within 60 seconds, the action is rejected.
  • Only one confirmation can be pending at a time, so a client calling tools in a loop cannot flood you with notifications.
  • Read-only tools run directly.

You can turn this off in the configuration, but I recommend keeping it on.

This server-side check works with any client. Some clients add their own check on top. For example, KAIChat shows the tool description and its arguments before the call even reaches the server:

KAIChat dialog: the MCP server akonadimcpprotocol wants to run the tool contact_delete, with Allow, Always Allow This Server and Deny buttons
KAIChat asks before running contact_delete.

Configuration and startup

The server is disabled by default. To enable it, open the KMail settings: they now include an Akonadi MCP Server page. There you can:

  • enable the server;
  • choose whether to ask for confirmation before changes;
  • choose the URL it listens on (for example http://127.0.0.1:8767/mcp);
  • require an authentication token, which you can regenerate and copy into your client’s configuration.
Akonadi MCP Server page in the KMail settings: Enabled, confirmation option, URL, authentication token
The Akonadi MCP Server page in the KMail settings.

Once enabled, the server starts automatically with your Plasma session. Configuration changes reach it right away over D-Bus, without a restart.

The server uses the MCP Streamable HTTP transport. For a quick test, you can also start it by hand with the URL to listen on. The configuration file is then ignored:

akonadimcpprotocol --url http://127.0.0.1:8767/mcp

Then add that URL as an MCP server in your client (KAIChat, another AI assistant, an editor, etc.), along with the token if you enabled it.

A few examples

  • « What are my appointments tomorrow? Am I free on Thursday afternoon? »
  • « Whose birthdays are coming up this week? »
  • « Find Mary’s latest email about the budget and prepare a reply. »
  • « Add a to-do to review the merge request before Friday. »

What’s next?

The project is still young and more tools will come. Feedback, bug reports and merge requests are welcome at invent.kde.org/pim/kdepim-addons.

Remember: ktextaddons 2.3.0 is required to use the Akonadi MCP server.

Add a Comment

Votre adresse e-mail ne sera pas publiée. Les champs obligatoires sont indiqués avec *