> For the complete documentation index, see [llms.txt](https://riteshs4hu.gitbook.io/infosec-notes/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://riteshs4hu.gitbook.io/infosec-notes/artificial-intelligence/ai-agents/model-context-protocol-mcp/fundamental.md).

# Fundamental

**MCP (Model Context Protocol)** is an open standard created by Anthropic that enables AI models (such as Claude) to interact with external tools, data sources, and services in a standardised way.

{% embed url="<https://modelcontextprotocol.io/docs/getting-started/intro>" %}

Think of it like this:

```
Without MCP:
  Claude → can only use information from its training data

With MCP:
  Claude → MCP Server → Your FTP server
                      → Your database
                      → Your file system
                      → Your APIs
                      → Any custom service
```

MCP acts as a standardised plugin system, allowing any MCP-compatible AI client to communicate with any MCP server.

***

### The Three MCP Components

1\. Tools

Functions that the AI can execute.

```
connect_ftp
upload_file
search_files
calculate_hash
```

The AI decides when to call a tool based on the user's request.

2\. Resources

Read-only data that the AI can access.

```
ftp://sessions/active
ftp://transfers/recent
```

3\. Prompts

Reusable prompt templates for common tasks.

```
analyze_server
backup_planner
locate_sensitive_files
```

***

### How MCP Works

```
You:
"Connect to ftp.example.com and find all .log files"
                    │
                    ▼
               AI Client
        Reads your request
        Determines which tools are required
                    │
                    ▼
              MCP Protocol
      Sends a JSON request to the MCP server
                    │
                    ▼
              MCP Server
 Executes the requested operations
 Returns the results as JSON
                    │
                    ▼
               AI Client
      Interprets the results and responds
```

***

## MCP Transport Types

Transport defines how the AI client communicates with an MCP server.

***

### 1. stdio (Standard Input/Output)

```
Claude Desktop
      │
      │ Starts the server as a child process
      │ Communicates through stdin/stdout
      ▼
MCP Server (Local)
```

**Pros**

* Simple to configure
* No networking required
* No open ports
* Supported by Claude Desktop and Claude Code

**Cons**

* Must run on the same machine
* No remote access
* Single client

**Best for:** Local development and personal tools.

***

### 2. SSE (Server-Sent Events)

```
AI Client
      │
      │ HTTP + SSE
      ▼
MCP Server
```

**Pros**

* The server can run remotely
* Supports multiple clients
* Accessible over the network

**Cons**

* Requires an HTTP server
* Authentication must be implemented separately
* More setup than stdio

**Best for:** Remote servers, teams, and production environments.

***

### 3. WebSocket

```
Client
   │
   │ ws://server:8080/ws
   ▼
MCP Server
```

**Pros**

* Full duplex communication
* Low latency
* Suitable for real-time updates

**Cons**

* More complex
* Less commonly used for MCP

**Best for:** Interactive or real-time applications.

***

### 4. Streamable HTTP

```
Client
   │
   │ POST /mcp
   ▼
MCP Server
```

**Pros**

* Standard HTTP
* Proxy and firewall friendly
* Modern MCP transport

**Cons**

* Newer transport
* Not yet supported by every client

**Best for:** Modern production deployments.
