← Back to Blog

Model Context Protocol Deep Dive: How MCP Tools, Resources and Prompts Talk to Your IDE

Educational guide explaining how Model Context Protocol works, how tools, resources, and prompts communicate with your IDE, and how MCP Shark helps you understand these interactions.

What is Model Context Protocol?

Model Context Protocol (MCP) is a standardized communication protocol that enables AI assistants and development tools to interact with external data sources and services. It provides a structured way for IDEs like Cursor, Windsurf, and other MCP-compatible IDEs to:

  • Access tools that can perform actions (file operations, API calls, etc.)
  • Read resources that provide data (databases, APIs, file systems)
  • Use prompts that guide AI behavior and provide context

MCP servers implement these capabilities, and MCP clients (your IDE) communicate with servers over HTTP or stdio to access their functionality.

The MCP Architecture

MCP Clients (Your IDE)

Your IDE acts as an MCP client, making requests to MCP servers. When you use AI features in your IDE:

  • The IDE identifies what tools, resources, or prompts it needs
  • It sends HTTP requests (or stdio messages) to the appropriate MCP server
  • It receives responses and integrates them into your workflow

Popular MCP clients include Cursor, Windsurf, and other MCP-compatible IDEs.

MCP Servers

MCP servers provide specific capabilities:

  • They register available tools, resources, and prompts
  • They handle requests from clients
  • They execute operations and return results
  • They can be local (stdio) or remote (HTTP)

Examples include file system servers, database servers, API integration servers, and custom development tools.

MCP Shark: The Observability Layer

MCP Shark sits between clients and servers, acting as a transparent proxy that:

  • Intercepts all HTTP communication
  • Logs requests and responses
  • Provides real-time monitoring
  • Enables forensic analysis

This gives you complete visibility into how MCP works in practice.

MCP Tools: Executing Actions

What Are Tools?

Tools are functions that MCP servers can execute. They represent actions that can be performed, such as:

  • Reading or writing files
  • Making API calls
  • Executing shell commands
  • Querying databases
  • Performing calculations or transformations

How Tools Work

The tool lifecycle:

  1. Discovery: Client calls tools/list to get available tools
  2. Registration: Server returns tool definitions with names, descriptions, and parameters
  3. Invocation: Client calls tools/call with tool name and arguments
  4. Execution: Server executes the tool and returns results
  5. Response: Client receives the result and integrates it

MCP Shark captures all these interactions, showing you exactly what tools are called, with what parameters, and what they return.

Example: File Reading Tool

When your IDE needs to read a file:

  1. IDE calls tools/call with tool name "read_file" and path parameter
  2. MCP server receives the request and reads the file
  3. Server returns file contents in the response
  4. IDE displays the file content to you

MCP Shark shows you the complete request/response cycle, including headers, parameters, and file contents.

MCP Resources: Accessing Data

What Are Resources?

Resources are data sources that MCP servers can provide. They represent information that can be accessed, such as:

  • Database records
  • API endpoints
  • File system contents
  • Configuration data
  • External service data

How Resources Work

Resource access flow:

  1. Discovery: Client calls resources/list to get available resources
  2. Listing: Server returns resource URIs and metadata
  3. Access: Client calls resources/read with resource URI
  4. Retrieval: Server fetches and returns resource data
  5. Usage: Client uses the data in AI context or displays it

Example: Database Resource

When your IDE needs database information:

  1. IDE calls resources/list to see available database tables
  2. Server returns list of resource URIs like "db://users", "db://products"
  3. IDE calls resources/read with "db://users" URI
  4. Server queries database and returns user data
  5. IDE includes this data in AI context for better responses

MCP Prompts: Guiding AI Behavior

What Are Prompts?

Prompts are templates or instructions that guide how AI assistants interact with MCP servers. They provide:

  • Context about available tools and resources
  • Guidelines for when to use specific capabilities
  • Examples of proper usage
  • Best practices and constraints

How Prompts Work

Prompt integration:

  1. Discovery: Client calls prompts/list to get available prompts
  2. Retrieval: Server returns prompt templates with variables
  3. Integration: Client includes prompts in AI context
  4. Usage: AI uses prompts to guide tool and resource usage

Example: Code Review Prompt

A code review MCP server might provide a prompt like:

"When reviewing code, use the read_file tool to examine 
relevant files, then provide structured feedback on 
code quality, security, and best practices."

This prompt guides the AI to use specific tools in a structured way for code reviews.

Communication Protocol: JSON-RPC over HTTP

MCP uses JSON-RPC 2.0 over HTTP for communication. This means:

  • All requests are HTTP POST requests
  • Request bodies contain JSON-RPC method calls
  • Responses are JSON-RPC responses
  • Each request has a unique ID for correlation

Example JSON-RPC request:

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "read_file",
    "arguments": {
      "path": "/path/to/file.txt"
    }
  }
}

MCP Shark captures these JSON-RPC messages, making it easy to understand the exact protocol being used.

How MCP Shark Helps You Understand MCP

MCP Shark provides complete visibility into MCP communication:

  • See the Protocol: View exact JSON-RPC messages being exchanged
  • Understand Flow: Track how tools, resources, and prompts are discovered and used
  • Debug Issues: Identify where communication breaks down
  • Learn Patterns: Understand how different MCP servers work
  • Optimize Performance: Identify bottlenecks and inefficiencies

By capturing all HTTP traffic, MCP Shark gives you a complete picture of MCP in action.

Real-World Example: Complete MCP Session

Here's what happens when you use an MCP server in your IDE:

  1. IDE connects to MCP server via MCP Shark proxy
  2. IDE calls tools/list - MCP Shark captures request/response
  3. IDE calls resources/list - MCP Shark captures request/response
  4. IDE calls prompts/list - MCP Shark captures request/response
  5. You use AI feature that needs a tool
  6. IDE calls tools/call - MCP Shark captures request/response
  7. Tool executes and returns result
  8. IDE integrates result into your workflow

MCP Shark shows you every step of this process, making MCP transparent and understandable.

Next Steps

Continue learning about MCP:

Start understanding MCP communication

Download MCP Shark and begin exploring how MCP works in practice.