Build a ServerIntermediate7 min09 / 10

Connect It to a Host

Wire a finished MCP server into a host like Claude Desktop, test it with the MCP Inspector, then ask a plain-English question and watch the server run the SQL for a real, grounded answer.

You've built a server — it exposes a query_sales tool and a schema://shop resource. But a server on its own does nothing. It waits, silently, on stdio for something to talk to it. That something is a host: Claude Desktop, an IDE, or your own agent. In this lesson we wire the server into a host, test it, and finally ask it a real question.

Think of it like

The host launches the server

Your server isn't a service you start and leave running. The host launches it for you — like a browser launching a helper process. You just tell the host how to start it: a command to run and the args to pass. When the host boots, it spawns your server, speaks MCP over stdio, and the connection is live.

#The config: point the host at your server

For Claude Desktop, that wiring lives in a single JSON file, claude_desktop_config.json. Each entry under mcpServers names a server and tells the host exactly how to launch it. Here's the config that wires in both the Node and the Python versions of our sales connector:

claude_desktop_config.json
{
  "mcpServers": {
    "sales-connector": {
      "command": "node",
      "args": ["/absolute/path/to/server.js"]
    },
    "sales-connector-python": {
      "command": "uv",
      "args": ["run", "server.py"]
    }
  }
}

Read it as a launch recipe. command is the program the host will run (node for the TypeScript build, uv for the Python one), and args are the arguments it passes. Together they say: "to start `sales-connector`, run `node /absolute/path/to/server.js`." The key ("sales-connector") is just the name the host shows you.

Common mistake

Paths must be ABSOLUTE

The host doesn't launch your server from your project folder — it launches it from wherever the host process happens to live. A relative path like ./server.js will not be found. Always use the full absolute path, e.g. /absolute/path/to/examples/node-mcp-server/server.js. This is the single most common reason a freshly-added server never shows up.

Quick check

In the mcpServers config, what do `command` and `args` actually do?

#Test it first with the MCP Inspector

Before you wire a server into a full agent, the easiest way to confirm it works is the MCP Inspector — a local UI that connects to your server, lists its tools and resources, and lets you call them by hand. No agent, no config editing, just a direct look at what your server exposes.

launch the MCP Inspector
# Node server
npm run inspect

# Python server
uv run mcp dev server.py

Either command opens a local web UI. You'll see query_sales and run_sql in the tool list and schema://shop under resources. Click a tool, fill in its arguments, and call it — the same tools/call an agent would send, but driven by you. If the Inspector can list and call your tools, a host will be able to as well.

Tip

Inspector = your MCP dev loop

Treat the Inspector as your fast feedback loop while building. It surfaces schema errors, bad argument validation, and broken queries immediately — long before you involve a real agent. Get it green in the Inspector, then connect it to a host.

#Now ask it a real question

With the server wired into a host, you don't call tools by hand anymore — you just talk. Ask the agent something a human would actually type:

> Who are our top 3 customers?

The agent reasons that this is a sales question, picks the query_sales tool, and sends a tools/call. Your server runs the real SQL against shop.db, rows come back, and the agent turns them into an answer grounded in real rows — not a guess, not a hallucination. You can just as easily ask "Which products are low on stock?" and it reaches for a different tool. Same loop, every question.

Quick check

In the database example, why is MCP safer than giving the model raw DB credentials?

Key takeaways

  • A host (Claude Desktop, an IDE, your own agent) LAUNCHES your server: the config gives it a `command` and `args` as a launch recipe.
  • In claude_desktop_config.json, each entry under `mcpServers` names a server and tells the host how to start it — Node via `node server.js`, Python via `uv run server.py`.
  • Paths in the config MUST be absolute; a relative path is the most common reason a server never connects.
  • The MCP Inspector (`npm run inspect` / `uv run mcp dev server.py`) is the fastest way to list and call your tools before involving a real agent.
  • Once wired in, a plain-English question like "Who are our top 3 customers?" makes the agent pick a tool, the server run the SQL, and you get an answer grounded in real rows — with the server as the safety boundary that holds the credentials.
Practice challenges
Test yourself · earn XP
0/4
Reorder the lines#1

Put the steps to get a finished MCP server working inside a host in the order you'd actually do them.

1
Restart the host so it launches the server as a subprocess over stdio
2
Ask the agent a plain-English question like "Who are our top 3 customers?" and get an answer grounded in real rows
3
Test the server directly with the MCP Inspector (npm run inspect / uv run mcp dev server.py)
4
Add an entry under mcpServers in claude_desktop_config.json with the command and absolute-path args
Fix the bug#2

A teammate added this to claude_desktop_config.json but the server never shows up in the host. What's the problem?

fix-bug
{
  "mcpServers": {
    "sales-connector": {
      "command": "node",
      "args": ["./server.js"]
    }
  }
}
Fill in the blank#3

Complete the config entry that wires the Python sales connector into Claude Desktop.

{
  "mcpServers": {
    "sales-connector-python": {
      "command": "",
      "args": ["", "server.py"]
    }
  }
}
Predict the output#4

Your server is wired into the host and you ask the agent: "Who are our top 3 customers?" What actually happens?

predict-output
// Server is connected. You type a plain-English question:
//   "Who are our top 3 customers?"
Your turn
Practice exercise

You've just finished a second MCP server, an analytics-connector, whose Python entry point lives at /Users/you/projects/analytics/server.py. Write the mcpServers block you'd add to claude_desktop_config.json to wire it into Claude Desktop alongside the existing sales-connector. Then, in one sentence each: (1) name the command you'd run to test analytics-connector in the MCP Inspector, and (2) explain what would happen if you used the relative path server.py in args instead of the absolute path.

Try it yourself — a starting point to build on:

starter.py
# Write your solution here