DEV Community

Saras Growth Space
Saras Growth Space

Posted on

What Is an MCP Server (And What Actually Happens Behind the Scenes)

So far, we’ve covered:

  • why MCP exists
  • what MCP is
  • what tools are

Now let’s answer a key question:

When the model decides to use a tool… who actually runs it?


🧠 Simple Definition

An MCP server is:

The component that exposes tools and executes them.


⚠️ Important Clarification

An MCP server is not just your backend.

It is:

  • a layer on top of your backend
  • designed specifically for LLM interaction

🧩 What the MCP Server Does

It has three main responsibilities:


1. Expose Tools

It tells the system:

  • what tools exist
  • what they do
  • what inputs they need

This is what the model “sees”.


2. Validate Inputs

Before running anything, it checks:

  • are required fields present?
  • are types correct?

This prevents bad or unsafe execution.


3. Execute Logic

This is where real work happens:

  • database queries
  • API calls
  • business logic

🔄 What Happens During Execution

Let’s walk through a simple flow.

User asks:

“Show my last 3 orders”


Step 1 — Model decides

It generates:

{
  "tool": "get_user_orders",
  "arguments": {
    "user_id": "123",
    "limit": 3
  }
}
Enter fullscreen mode Exit fullscreen mode

Step 2 — Request reaches the server

The MCP server receives this request.


Step 3 — Validation

It checks:

  • is user_id present?
  • is limit a number?

Step 4 — Execution

It runs something like:

SELECT * FROM orders WHERE user_id = 123 LIMIT 3
Enter fullscreen mode Exit fullscreen mode

Step 5 — Response

It sends structured data back.


Step 6 — Model formats response

The model turns it into:

“Here are your last 3 orders…”


🧠 Key Insight

The model never:

  • touches your database
  • calls APIs directly
  • runs any code

👉 The MCP server does all of that.


🔥 Why This Layer Matters

This separation gives you:

  • better security
  • cleaner architecture
  • controlled execution
  • reusable systems

🧭 Mental Model

Think of it like a restaurant:

  • Model → decides what to order
  • MCP server → kitchen that prepares it
  • Tools → items on the menu

The model doesn’t cook.
The server does.


⚠️ Common Mistakes


Treating MCP server like a normal backend

It needs to be LLM-friendly, not just functional.


Exposing raw APIs directly

LLMs need:

  • clear names
  • structured inputs
  • simple actions

Skipping validation

This can lead to:

  • crashes
  • incorrect actions
  • security issues

🧠 What the MCP Server Does NOT Do

It does NOT:

  • decide which tool to use
  • understand user intent
  • generate responses

👉 That’s the model’s job.


🧭 Why This Is Important

This separation is the foundation of MCP:

  • model decides
  • server executes

🧭 What’s Next

Now that we understand the execution layer,
there’s one missing piece:

Who connects the model and the server?

That’s the MCP client — the component that makes everything work together.

Top comments (0)