MCP Core Features
MCP Core Features
Section titled “MCP Core Features”MCP provides a structured way for AI models to interact with their environment. This interaction is primarily facilitated through features offered by MCP Servers and complemented by capabilities on the MCP Client side.
Server-Side Core Features
Section titled “Server-Side Core Features”MCP Servers are the backbone of context provision, exposing data and functionality through three main abstractions: Resources, Prompts, and Tools.
Resources
Section titled “Resources”Resources represent contextual data that an LLM can access. Think of them as nouns – pieces of information that describe the environment or provide background. MCP Servers expose resources, and Clients can query these resources to fetch relevant information for the LLM.
- Nature: Typically read-only data, but can also include metadata or pointers to larger data objects.
- Examples: File contents, database records, calendar entries, email threads, environment variables, current application state, project structure.
- Interaction: Clients can typically list available resources, get details about a specific resource (its schema or content), and ‘sample’ or retrieve the content of a resource.
- Purpose: To provide the LLM with factual information it needs to understand a situation or answer a query.
{ "jsonrpc": "2.0", "method": "mcp.resources.get", "params": { "resourceId": "file:///Users/dev/project/main.py" }, "id": "req-123" } // Example: Server responding with resource content { "jsonrpc": "2.0", "result": { "contentType": "text/plain", "content": "print('Hello, MCP!')" }, "id": "req-123" }Prompts
Section titled “Prompts”Prompts in MCP are more than just static text; they are server-defined, often dynamic, suggestions or templates that can guide the LLM’s interaction or help formulate its requests. They act as pre-defined ways to interact with the server’s capabilities or data, often tailored to specific tasks.
- Nature: Can be static text, templates requiring variable substitution, or even dynamically generated suggestions based on current context.
- Examples: “Summarize this document: {document_id}”, “Suggest a commit message for these changes: {diff}”, “What are the active issues assigned to me?”, “Translate ‘{text}’ to {language}.”
- Interaction: Clients can request available prompts. Selecting or using a prompt might involve the client providing some input, which the server then uses to generate a more complete instruction or query for the LLM, or even directly perform an action that provides context.
- Purpose: To streamline common tasks, guide LLM behavior, reduce the need for complex prompt engineering on the client-side, and expose server capabilities in a more user-friendly way.
Tools represent actions or operations that an LLM can request the MCP Server to execute. These are the verbs in the MCP world, allowing the LLM to effect change or perform computations beyond its inherent capabilities.
- Nature: Executable functions or procedures with defined inputs and outputs.
- Examples: Running a script, sending an email, calling an external API, creating a file, executing a database query, refactoring code.
- Interaction: Clients (often prompted by an LLM) can request the execution of a tool, providing necessary arguments. The Server executes the tool and returns the result (or status) to the Client, which then feeds back to the LLM.
- Purpose: To allow LLMs to interact with the environment in a functional way, perform actions, and retrieve results from computations or external systems. This aligns with concepts like OpenAI’s Function Calling or ReAct patterns.
{ "jsonrpc": "2.0", "method": "mcp.tools.execute", "params": { "toolId": "git.createBranch", "arguments": { "branchName": "feature/new-ui", "fromBranch": "main" } }, "id": "req-456" } // Example: Server responding with tool execution result { "jsonrpc": "2.0", "result": { "success": true, "message": "Branch 'feature/new-ui' created successfully from 'main'." }, "id": "req-456" }Client-Side Core Features
Section titled “Client-Side Core Features”While much of the heavy lifting for providing context is done by MCP Servers, MCP Clients (and the Host applications they run in) also have key responsibilities and features.
Sampling
Section titled “Sampling”Sampling is a crucial client-side (or client-directed) process of selecting and retrieving relevant portions of Resources to provide to the LLM. LLMs have context window limitations, so it’s often impractical or impossible to send the entire content of all potentially relevant resources. Sampling addresses this by intelligently extracting the most pertinent information.
- Nature: A process of selection and summarization, often guided by the LLM’s current task or query, user focus, or heuristics.
- Examples: Extracting only the relevant functions from a code file, summarizing a long document, picking the most recent emails from a thread, selecting active code blocks based on cursor position.
- Interaction: The Client, possibly in conjunction with the Host application’s understanding of user context (e.g., open files, cursor position in an IDE), decides which parts of which resources to sample. It then requests these specific samples from the MCP Server or processes raw resource data.
- Purpose: To provide the LLM with a concise yet comprehensive view of the context, fitting within its operational limits and focusing its attention on the most relevant data. Effective sampling is key to making LLMs useful in information-rich environments.
Clients are responsible for discovering servers, making requests for resources, prompts, and tools, handling responses, and managing the overall communication flow. They also play a role in presenting information to the user and relaying LLM requests to the server.