agentic-terminal
Provides web search capabilities through DuckDuckGo, allowing AI agents to perform internet searches and retrieve search results.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@agentic-terminalrunls -lain the current directory and summarize the output"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
MCP Masterclass - Complete Guide For Beginners
A comprehensive, hands-on course that teaches you everything about Model Context Protocol (MCP) - from creating your first MCP server to deploying production-ready applications using Docker and cloud-native architectures.
š Table of Contents
Related MCP server: MCP Terminal Server
š¤ What is MCP?
Model Context Protocol (MCP) is a standardized protocol that enables seamless communication between AI models and external tools/systems. It allows:
š Tool Integration: Connect AI models to custom tools and services
š Universal Communication: Standardized way for LLMs to interact with resources
š Multi-Transport Support: Use stdio, HTTP, or custom transports
š”ļø Type-Safe: Full type support and validation
š” Remote Execution: Execute tools on remote servers
š Course Overview
This masterclass takes you on a complete journey through MCP development:
Beginner āā Intermediate āā Advanced āā Production
ā ā ā ā
CH-1 CH-2,3 CH-4,5 CH-6Whether you're an AI enthusiast, developer, or DevOps engineer, this course has something for you!
ā Prerequisites
Python 3.12+ (MCP requires modern Python)
Git for version control
Docker (for Chapter 6)
Basic Python knowledge (async/await, decorators)
API familiarity (helpful for understanding HTTP transport)
Terminal/Command Line comfort
šÆ Getting Started
1. Clone the Repository
git clone https://github.com/yourusername/MCP_Masterclass.git
cd MCP_Masterclass2. Set Up Python Environment
Using uv (recommended - faster than pip):
uv venv .venv
source .venv/bin/activate # On Windows: .venv\Scripts\activateOr using traditional venv:
python -m venv .venv
source .venv/bin/activate # On Windows: .venv\Scripts\activate3. Install Dependencies
uv pip install -r pyproject.toml
# or
pip install -e .The project includes:
fastmcp- FastMCP framework for building MCP serverslangchain- For integration with language modelslangchain-mcp-adapters- Bridge between LangChain and MCPmcp- Official MCP specification implementationagentic-terminal- Terminal-based MCP tools
4. Verify Installation
python main.py
# Expected output: "Hello from mcp-masterclass!"š Course Structure
Chapter 1: Creating Your First MCP Server š±
File: CH-1_CreateMCP/
Learn the fundamentals of MCP by building a basic server:
1_first_mcpserver_stdio.py: Build a simple MCP server using stdio transport
Basic tool definition with
@mcp.tool()decoratorFetch and process data patterns
Running server locally
2_python_client.py: Create a Python client to connect to the MCP server
Understand client-server communication
Making tool calls programmatically
3_langchain_client.py: Integrate MCP with LangChain
Use MCP tools with language models
Automatic tool discovery and binding
Key Learnings:
FastMCP framework basics
Stdio transport protocol
Async function handling
Tool documentation with docstrings
Chapter 2: HTTP Transport & Scalability š
File: CH-2_HTTP_MCP/
Scale your MCP servers for real-world applications:
1_http_mcp.py: Build an HTTP-based MCP server
Streamable HTTP transport
Network accessibility
Multi-client support
Running on port 8050
2_langchain_client.py: Connect LangChain to HTTP MCP server
Remote server communication
HTTP client setup
Tool availability over network
Key Learnings:
HTTP transport vs Stdio
Scalability considerations
Network security basics
Multi-client architectures
Chapter 3: Integrating 3rd Party MCPs š
File: CH-3_3rdParty_MCPs/
Leverage community MCP servers in your applications:
community_mcp.py: Use open-source community MCP servers
Discovering available MCPs
Integration patterns
Popular community tools
tavily_mcp.py: Integrate Tavily search MCP
Real-world API integration
Web search capabilities
Data enrichment workflows
Key Learnings:
MCP ecosystem exploration
Third-party tool integration
Composition and orchestration
API key management
Chapter 4: Publishing to PyPI š¦
File: CH-4_PyPI_MCP/ & MCP_PYPI/
Package and distribute your MCP as a Python package:
1_test_package.py: Test your packaged MCP
2_client.py: Use the published package as a client
MCP_PYPI/: Complete package structure
pyproject.toml: Package configurationsrc/agentic_terminal/: Agentic terminal implementationtools.py: Custom tool definitionsmain.py: Entry point
Key Learnings:
Python package structure
PyPI publishing workflow
Package versioning and dependency management
Entry points and CLI tools
Chapter 5: MCP Gateway & Orchestration šÆ
File: CH-5_MCP_Gateway/
Build a unified gateway to manage multiple MCP servers:
gateway.py: Central gateway for orchestrating multiple MCPs
Mounting multiple MCP servers
Request routing
Tool discovery and aggregation
Unified interface to many tools
Example: integrating duckduckgo-mcp-server
Key Learnings:
Gateway pattern architecture
MCP composition and mounting
Load balancing concepts
Tool proxy implementations
Chapter 6: Containerization & Docker š³
File: CH-6_MCP_Docker/
Deploy MCP servers in production using Docker:
Dockerfile: Multi-stage Docker configuration
Base image: Python 3.11-slim
Pre-installed tools (duckduckgo-mcp-server, agentic_terminal)
FastMCP runtime
requirements.txt: Python dependencies for container
app/gateway.py: Gateway application for containerized deployment
Key Learnings:
Dockerfile best practices
Multi-stage builds
Container environment setup
Production deployment patterns
Tool availability in containers
šļø Project Architecture
MCP_Masterclass/
ā
āāā CH-1_CreateMCP/ # Basics: Stdio-based MCP
ā āāā 1_first_mcpserver_stdio.py
ā āāā 2_python_client.py
ā āāā 3_langchain_client.py
ā
āāā CH-2_HTTP_MCP/ # HTTP Transport & Scalability
ā āāā 1_http_mcp.py
ā āāā 2_langchain_client.py
ā
āāā CH-3_3rdParty_MCPs/ # Integration Patterns
ā āāā community_mcp.py
ā āāā tavily_mcp.py
ā
āāā CH-4_PyPI_MCP/ # Packaging
ā āāā 1_test_package.py
ā āāā 2_client.py
ā
āāā CH-5_MCP_Gateway/ # Orchestration
ā āāā gateway.py
ā
āāā CH-6_MCP_Docker/ # Production Deployment
ā āāā Dockerfile
ā āāā requirements.txt
ā āāā app/
ā āāā gateway.py
ā
āāā MCP_PYPI/ # PyPI Package Structure
ā āāā pyproject.toml
ā āāā README.md
ā āāā src/
ā āāā agentic_terminal/
ā āāā __init__.py
ā āāā main.py
ā āāā tools.py
ā
āāā Notes/ # Course Notes
ā āāā MCP-Masterclass.png
ā
āāā pyproject.toml # Main project config
āāā package.json # NPM metadata
āāā main.py # Entry point
āāā README.md # This fileš” Key Features
Progressive Learning Path
Start with basics (stdio servers)
Progress to HTTP scalability
Learn composition and orchestration
Deploy with Docker
Hands-On Examples
Every concept includes working code
Multiple integration patterns
Real-world scenarios (search, processing)
Production-Ready
Docker containerization
Gateway architecture
Multi-server orchestration
PyPI packaging
Community Integration
Third-party MCP servers
Popular tools (Tavily, DuckDuckGo)
Integration patterns
Extensibility examples
š ļø Technologies
Technology | Purpose | Version |
FastMCP | MCP framework | 3.2.4+ |
Python | Programming language | 3.12+ |
Docker | Containerization | Latest |
LangChain | LLM framework integration | 1.2.17+ |
Async/Await | Concurrent operations | Built-in Python |
HTTP | Network transport | Standard |
Stdio | Local process communication | Standard |
UV | Package management | Latest |
š Quick Start Guide
Example 1: Run the First MCP Server
# Navigate to Chapter 1
cd CH-1_CreateMCP
# Activate your virtual environment
source .venv/bin/activate # or .venv\Scripts\activate on Windows
# Run the MCP server
python 1_first_mcpserver_stdio.pyExample 2: Connect a Python Client
# In another terminal, with venv activated
cd CH-1_CreateMCP
python 2_python_client.pyExample 3: Use with LangChain
cd CH-1_CreateMCP
python 3_langchain_client.pyExample 4: HTTP Server
cd CH-2_HTTP_MCP
python 1_http_mcp.py
# Server runs on http://localhost:8050Example 5: Gateway Architecture
cd CH-5_MCP_Gateway
python gateway.pyExample 6: Docker Deployment
cd CH-6_MCP_Docker
docker build -t mcp-masterclass .
docker run -p 8050:8050 mcp-masterclassš Running Examples
Setup for Examples
Install all dependencies:
uv pip install -r pyproject.tomlEnsure Python 3.12+ is active:
python --versionSet any required API keys in environment variables
Running Individual Examples
Each chapter can be run independently:
# Chapter 1 - Basic Server
cd CH-1_CreateMCP && python 1_first_mcpserver_stdio.py
# Chapter 2 - HTTP Server
cd CH-2_HTTP_MCP && python 1_http_mcp.py
# Chapter 5 - Gateway
cd CH-5_MCP_Gateway && python gateway.py
# Chapter 6 - Docker
cd CH-6_MCP_Docker && docker build -t mcp . && docker run mcpDebugging
Enable verbose output for MCP debugging:
# Set debug environment variable
export MCP_DEBUG=1
python your_mcp_file.pyā FAQ
Q: Do I need GPU support?
A: No, MCP servers run on CPU. GPU is only needed if running large language models locally.
Q: Can I use MCP with other frameworks besides LangChain?
A: Yes! MCP is framework-agnostic. It works with any LLM framework that supports the MCP protocol.
Q: What's the difference between Stdio and HTTP transport?
A:
Stdio: Local communication, lower latency, single machine
HTTP: Network communication, scalable, accessible remotely
Q: How do I add my own tools to an MCP server?
A: Use the @mcp.tool() decorator:
@mcp.tool()
async def my_tool(param: str):
"""Tool description."""
return {"result": "your result"}Q: Is MCP production-ready?
A: Yes! The project includes Docker containerization and gateway patterns for production deployment.
Q: How do I integrate external APIs?
A: Tools can make HTTP calls internally. See Chapter 3 for Tavily integration example.
Q: Can I run multiple MCP servers together?
A: Yes! Use the gateway pattern (Chapter 5) to orchestrate multiple servers.
Q: What's the purpose of PyPI publishing?
A: It allows others to install and use your MCP server as a package: pip install your-mcp-server
š Resources
Official Documentation
Community
MCP GitHub Repository
FastMCP GitHub Issues
LangChain Discord Community
Related Tutorials
MCP Tool Creation Best Practices
LLM Integration Patterns
Docker & Kubernetes for AI
Learning Path
Beginner: Read Chapter 1-2 documentation
Intermediate: Work through Chapter 3-4 examples
Advanced: Study Chapter 5-6 architecture
Expert: Extend with your own MCPs
š§ Troubleshooting
Issue: Python version not compatible
Solution: Ensure Python 3.12+ is installed
python --version # Should show 3.12.x or higherIssue: FastMCP import error
Solution: Reinstall dependencies
uv pip install --force-reinstall fastmcpIssue: Port already in use
Solution: Use a different port or kill the process
# On Windows
netstat -ano | findstr :8050
# On Linux/Mac
lsof -i :8050Issue: Docker build fails
Solution: Clear Docker cache and rebuild
docker system prune -a
docker build --no-cache -t mcp-masterclass .š¬ Contributing
We welcome contributions! Areas for enhancement:
Additional example MCPs
Documentation improvements
Additional transport protocols
Testing suite expansion
Deployment examples (Kubernetes, Cloud Run, etc.)
š Learning Outcomes
After completing this masterclass, you will be able to:
ā Create and deploy MCP servers using FastMCP ā Understand and implement different transport protocols ā Integrate with LangChain and other frameworks ā Compose multiple MCPs into orchestrated systems ā Package and publish MCP tools to PyPI ā Deploy MCPs using Docker and containerization ā Design scalable, production-ready MCP architectures ā Troubleshoot and debug MCP applications
This server cannot be deployed
Maintenance
Related MCP Connectors
OCR, transcription, file extraction, and image generation for AI agents via MCP.
Your org's AI agents, tasks, runs, search, and brain files as MCP tools and resources.
Automate 1,000+ services from any MCP-compatible AI agent: build Applets, run actions and queries.
Let AI agents query data and act across all your business apps via MCP.
Related MCP Servers
- AlicenseAqualityBmaintenanceAllows Claude desktop app to execute terminal commands and edit files on your computer through MCP, with features including command execution, process management, and diff-based file editing.26122,945 npm9,665MIT
- AlicenseNot gradedqualityFmaintenanceProvides cross-platform terminal access through MCP, enabling AI assistants to create and manage interactive terminal sessions, execute commands, and capture visual snapshots on Windows, Linux, and macOS.1MIT
- AlicenseNot gradedqualityBmaintenanceExposes an interactive terminal over MCP, enabling remote shell command execution, file operations, and directory management via ChatGPT or Claude Desktop.2MIT
- FlicenseNot gradedqualityAmaintenanceExposes VS Code terminals as MCP tools, allowing AI agents to create, execute commands, read output, list, and kill terminals across multiple workspaces.-