Model Context Protocol (MCP) is an open protocol that standardizes how applications provide context to Large Language Models (LLMs). Think of MCP like a USB-C port for AI applications - providing a standardized way to connect AI models to different data sources and tools.
- Standardized Integration: Connect LLMs to various data sources and tools using a common protocol
- Tool Execution: Enable LLMs to perform actions through your server
- Resources Access: Expose data and content from your servers to LLMs
- Prompts Management: Create reusable prompt templates and workflows
- Sampling: Allow servers to request completions from LLMs
- Secure Communication: Built-in transport mechanisms for reliable data exchange
- MCP Host: Programs like Claude Desktop, IDEs, or AI tools that want to access data through MCP
- MCP Client: Protocol clients that maintain 1:1 connections with servers
- MCP Server: Lightweight programs that expose specific capabilities through the standardized Model Context Protocol
MCP includes two standard transport implementations:
- Enables communication through standard input and output streams
- Useful for local integrations and command-line tools
- Ideal for: building command-line tools, implementing local integrations, simple process communication, working with shell scripts
- Enables server-to-client streaming with HTTP POST requests for client-to-server communication
- Useful when: only server-to-client streaming is needed, working with restricted networks, implementing simple updates
- Security Warning: SSE transports can be vulnerable to DNS rebinding attacks if not properly secured
- Create project folder:
uv init mcpcrashcourse- Create server directory and files:
mkdir server
touch server/weather.py- Create virtualenv:
uv venv- Install MCP dependencies:
uv add "mcp[cli]"- Run your server:
uv run mcp dev server/weather.pyuv run mcp install server/weather.pyCreate a client file and integrate using libraries like langchain-groq.
A Dockerfile is provided to containerize your MCP server.
- Official Documentation: https://modelcontextprotocol.io/introduction
- Anthropic Blog: https://www.anthropic.com/news/model-context-protocol
- Official Servers: https://github.com/modelcontextprotocol/servers
- Python SDK: https://github.com/modelcontextprotocol/python-sdk
- VSCode Integration: https://code.visualstudio.com/docs/copilot/chat/mcp-servers
- Smithery (3rd party MCP Servers): https://smithery.ai/
- MCP-Use: https://github.com/mcp-use/mcp-use