How MCP Servers, Resources, Tools, and Prompts work together
mainThe Model Context Protocol (MCP) standardizes how LLM applications interact with external data and functionality:
- Server: The core interface (e.g.,
FastMCP) that manages connections, protocol compliance, and message routing. - Resources: Similar to GET endpoints in REST; they provide read-only data to be loaded into the LLM's context (e.g.,
config://app). - Tools: Similar to POST endpoints; they allow the LLM to execute code or perform actions that have side effects (e.g.,
calculate_bmi). - Prompts: Reusable templates that define interaction patterns for the LLM (e.g., a
review_codetemplate).