How to Connect an MCP Server to an AI Agent: A Step-by-Step Guide
A step-by-step walkthrough of connecting an MCP server to a desktop agent — where to find a server, what to fill in, how to pass tokens, and what to do if the tools don't show up. Using Doka as the example.
Connecting an MCP server sounds scarier than it actually is. In essence, it's a way to give an agent a new set of tools — access to a database, a tracker, a messenger — and it's set up with a couple of fields. But newcomers tend to trip on the same spots, so let's go through the whole thing: where to get a server, what to fill in, and what to do if it doesn't work.
If this is the first time you're hearing about MCP at all, start with a short explanation of what it is — this article assumes the general idea already makes sense to you.
What actually happens when you connect one
It helps to understand the mechanics, and then the steps stop feeling like magic. An MCP server is a separate small program that gives an agent a set of tools. In Doka it works like this: every time a task starts, the app launches all enabled servers, collects their tools, and lets the model use them right alongside the built-in ones.
Servers run locally, as regular processes on your machine. So "connecting a server" in practice means: specifying the command it starts with and the parameters it needs.
Step 1. Find the server you need
First, decide what you want to give the agent access to, and find a ready-made server for it. The ecosystem is large: there are servers for popular trackers, databases, messengers, storage — many of them open source. I've put together a roundup of common options in the article on useful MCP servers.
The main thing you need from the server you pick is its README. It always states two things: which command starts it, and which parameters (usually access tokens) it needs. That's what you'll carry over into the settings.
Step 2. Open the server settings
In Doka, open the right panel and find the "MCP Servers" tab (the server-rack icon). Click "Add server" — a form with a few fields opens. Let's go through each one, since this is where people get tripped up most.
Step 3. Fill in the fields
There aren't many fields, but each has its own role:
- Name — how the server will show up in the list. Any name that makes sense to you, like "Telegram" or "Postgres — analytics." It doesn't affect anything besides convenience.
- Launch command — what the server starts with. Take it straight from the server's README.
- Arguments — extra parameters for the command, one per line. Also from the README.
- Environment variables — this is where tokens and access keys go, as
KEY=VALUE, one per line. Check the server's documentation for the variable names.
Put tokens and access keys in environment variables, not in the arguments. That way they're stored locally in the app's settings and don't end up on screen unnecessarily. Don't post them anywhere or paste them into chats.
Step 4. Turn it on and save
Flip the "enabled" toggle and save. The settings survive an app restart, so this is a one-time step. On the next task, the agent will see the new tools and be able to call them — nothing extra to launch, Doka starts the servers itself.
Test it with a simple request. If you connected a database, try "describe what's in this database." For a Telegram server, "show me the latest messages from this chat." The answer tells you right away whether the connection works.
If the tools don't show up
The most common situation for newcomers is "I connected it, and the agent doesn't see anything." Usually the cause is one of three things.
First, check that the server's toggle is on — a disabled server doesn't start. Second, make sure the launch command actually works: often the needed program isn't installed on the system, or the path to it is wrong. You can test the command separately, outside Doka. Third, check the environment variables: if the server needs a token and it's missing or wrong, the server will start but won't work.
One more detail: the MCP Servers tab only exists in the desktop app. It's not available in browser mode, since there's nowhere to run local processes there.
A word on security
MCP gives an agent real access, so treat it that way, not as a harmless setting. Connect services for a specific task and with the minimum permissions needed. For databases, for instance, it's reasonable to start with read-only access — the agent answers questions but changes nothing. Widen it later, once you've confirmed everything works as expected.
What's next
Once you've set up one server, you'll connect any other the same way — the mechanics never change, only the command and parameters from the README do. From here you can keep growing the agent to fit your own workflow, adding the services you actually use. Download Doka for free.