The basics of MCP (Model Context Protocol) 2025
What MCP Solves
The Model Context Protocol (MCP) is an open standard for connecting AI applications to external data sources, tools, and development environments.
Anthropic: Introducing the Model Context Protocol (November 26, 2024)
Without a shared protocol, every LLM host (such as Claude Desktop, Cursor, or a custom agent) needs a custom plugin for every external tool (databases, browsers, issue trackers). MCP replaces that $M \times N$ integration matrix with a single JSON-RPC client-server protocol—similar to what the Language Server Protocol (LSP) did for code editors.
Walkthrough: Generating E2E Tests with Playwright MCP
A practical use case for MCP in frontend engineering is closing the browser verification loop. Instead of guessing DOM selectors from static source files, an LLM coding assistant can drive a real headless or headed browser through Playwright MCP, inspect the live accessibility tree, and generate verified Playwright tests.
Start the Playwright MCP server on a local port:
npx @playwright/mcp@latest --port 8931Connect your editor (e.g., Cursor) to the MCP endpoint and prompt it to inspect the live local dev server and write an E2E test:
Example prompt used in the recording:
ゴール
- Playwright用のE2Eテストの作成
作成するテスト
- /news/mcp-2025 に対するテスト
テスト作成方法
- PlaywrightのMCPを使ってローカルの開発環境にアクセスして要素を解析してください。そして、解析した要素をベースにE2Eテストを作成してください。Execute the generated Playwright test suite against the application:
Protocol Primitives
MCP defines a host-client-server topology over JSON-RPC 2.0 (typically via local stdio pipes or Streamable HTTP). A host application spawns or connects to one or more MCP servers, each of which can expose three primitives:
- Resources: Read-only context (files, database records, logs) identified by URI.
- Prompts: Parameterized templates for recurring workflows.
- Tools: Executable functions with JSON Schema inputs that the model can invoke.
Capabilities and transport requirements are negotiated at initialization, so clients and servers must explicitly verify protocol revision compatibility rather than assuming every MCP endpoint supports the same feature set:
Security and Trust Boundaries
Giving an LLM access to an MCP server is equivalent to granting shell or API execution rights to whatever credentials that server holds. The MCP specification treats tool descriptions and outputs as untrusted input unless the server itself is trusted, and requires the host application to enforce human-in-the-loop approval.
When running MCP servers in engineering or production workflows:
- Pin server artifacts: Run only audited MCP server binaries or packages pinned by commit hash or version.
- Scope credentials to least privilege: Pass read-only tokens or sandboxed directories to the server process; never expose production admin credentials to a local dev agent.
- Require confirmation for state-changing tools: Gate writes, network mutations, and command execution behind explicit user confirmation in the host UI.
- Validate tool schemas strictly: Validate arguments and return payloads against strict schemas independent of natural-language tool descriptions.
- Scrub secrets from logs and context: Keep API keys and session tokens out of model context windows and JSON-RPC trace logs.
- Test prompt-injection paths: Assume untrusted web pages, issues, or logs read via an MCP Resource will attempt to trigger state-changing MCP Tools (confused-deputy attacks).
References:
Pre-Adoption Checklist
Before enabling a third-party MCP server for a team:
- Verify the exact server source repository, release artifact, and protocol revision.
- List every tool and resource the server registers at startup.
- Run against isolated test fixtures with scoped credentials first.
- Inspect raw JSON-RPC request/response traffic for unexpected data exfiltration.
- Test timeout, cancellation, and malformed-input handling.
Reviewed and updated on September 1, 2026 against the 2025-11-25 specification.