How MCP Servers Work: Resources, Prompts, and Tools

A deep dive into the three core primitives of the Model Context Protocol architecture and how servers expose local context to AI clients.

Back to Mcp Guide

To understand how an MCP Server functions in practice, you must dive into the specific mechanics of the client-server relationship. The AI model (or the application hosting the model) acts as the Client. The service sitting next to your database, API, or file system acts as the Server.

When the client connects to the server, the connection is established via a standardized JSON-RPC protocol, typically over stdio for local processes or Server-Sent Events (SSE) over HTTPS for remote connections. Once the connection is established, the client initiates a discovery phase. It asks the server: "What can you do?"

The server responds by exposing three distinct capabilities—often referred to as the primitives of the Model Context Protocol: Resources, Prompts, and Tools. Understanding how these three primitives interact is crucial for building robust organizational memory systems.

1. Resources: Exposing Read-Only Data

Resources are the simplest and most foundational capability of an MCP Server. They allow the server to expose read-only data to the AI client in a structured, hierarchical format. Think of Resources as a highly-structured, virtual file system that the AI can browse and read on demand.

For example, if you deploy an MCP server connected to your corporate GitHub organization, it might expose a resource URI structured like this: github://repos/memora/core-api/pulls/405.

When the user asks the AI to review pull request #405, the AI client recognizes that the GitHub MCP server can provide this resource. The client sends a request to read that specific URI. The MCP Server fetches the raw code diff from the GitHub API, formats it into an LLM-optimized text string, and returns it to the client. The AI client then pulls this entire text block into its AI context window, allowing it to "read" the code and provide a review.

Resources are highly effective for large, static pieces of context—such as configuration files, specific database rows, or wiki pages—that the AI needs to ingest before generating a response.

2. Prompts: Pre-Configured Context Templates

Prompts are the second primitive. They allow the MCP Server to provide the client with predefined, highly tuned prompt templates that are specifically optimized for the unique data structures the server holds.

Often, users do not know how to craft the perfect prompt to get the best results out of an enterprise system. A Jira MCP server, for instance, might expose a summarize_sprint prompt. When a user selects this prompt in their AI client interface, they are prompted to input a sprint ID.

The magic happens on the server side: the MCP Server intercepts the sprint ID, automatically queries Jira for all tickets associated with that sprint, fetches the status of each ticket, and injects all of that raw data into a carefully crafted prompt template. The final, enriched prompt is then sent to the LLM.

This ensures that the AI receives consistent, perfectly formatted instructions every single time, drastically reducing hallucinations and improving the quality of the output without relying on the end-user's prompt engineering skills.

3. Tools: Executable Actions and Agentic AI

While Resources and Prompts are essentially read-only operations designed to provide context, Tools allow the AI client to take action. Tools are executable functions that the server exposes, enabling the foundation of Agentic AI.

An MCP server connected to an internal Postgres database might expose a run_sql_query tool. The workflow looks like this:

  1. The user asks a natural language question: "How many new users signed up yesterday?"
  2. The AI Client analyzes the question and realizes it needs to query the database.
  3. The AI Client dynamically generates a valid SQL query based on its understanding of the database schema.
  4. The AI Client calls the run_sql_query Tool on the Postgres MCP Server, passing the generated SQL as a parameter.
  5. The MCP Server executes the SQL query against the local database.
  6. The MCP Server receives the raw tabular data, formats it into JSON, and returns it to the Client.
  7. The AI Client synthesizes that raw JSON data into a human-readable conversational answer for the user.

Tools are what transform an AI from a passive chatbot into an active, autonomous participant in your corporate workflow. By exposing safe, well-defined Tools through MCP Servers, enterprises can build agents capable of automating complex, multi-step tasks across their entire software ecosystem.


Next in this series:

Read: MCP vs. REST APIs

Quick Knowledge Check

Why do standard vector search systems fail on complex technical context?

Was this article helpful?