burtenshaw commited on
Commit
ebf5210
·
1 Parent(s): b507a9f

first draft

Browse files
.github/workflows/build_documentation.yml ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ name: Build documentation
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - main
7
+ workflow_dispatch:
8
+
9
+ jobs:
10
+ build:
11
+ uses: huggingface/doc-builder/.github/workflows/build_main_documentation.yml@main
12
+ with:
13
+ commit_sha: ${{ github.sha }}
14
+ package: mcp-course
15
+ path_to_docs: units
16
+ build_command: doc-builder build mcp-course units --build_dir build/mcp-course
17
+ deploy_to_hub: true
18
+ languages: en
.github/workflows/build_pr_documentation.yml ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ name: Build PR Documentation
2
+
3
+ on:
4
+ pull_request:
5
+
6
+ concurrency:
7
+ group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
8
+ cancel-in-progress: true
9
+
10
+ jobs:
11
+ build:
12
+ uses: huggingface/doc-builder/.github/workflows/build_pr_documentation.yml@main
13
+ with:
14
+ commit_sha: ${{ github.event.pull_request.head.sha }}
15
+ pr_number: ${{ github.event.number }}
16
+ package: mcp-course
17
+ path_to_docs: units
18
+ additional_args: --not_python_module
19
+ languages: en
README.md ADDED
@@ -0,0 +1,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # The Model Context Protocol (MCP) Course
2
+
3
+ If you like the course, **don't hesitate to ⭐ star this repository**. This helps us to **make the course more visible 🤗**.
4
+
5
+ ## Content
6
+
7
+ The course is divided into 4 units. These will take you from **the basics of Model Context Protocol to a final project implementing MCP in an AI application**.
8
+
9
+ Sign up here (it's free) 👉 [Coming Soon]
10
+
11
+ You can access the course here 👉 [Coming Soon]
12
+
13
+ | Unit | Topic | Description |
14
+ | ------- | --------------------------------------------------- | ------------------------------------------------------------------------------------------------------- |
15
+ | 0 | Welcome to the Course | Welcome, guidelines, necessary tools, and course overview. |
16
+ | 1 | Introduction to Model Context Protocol | Definition of MCP, key concepts, and its role in connecting AI models with external data and tools. |
17
+ | 2 | Understanding MCP Architecture and Core Concepts | Explore the MCP architecture, communication protocols, and core primitives. |
18
+ | 3 | Building with MCP: Practical Development | Learn to implement MCP clients and servers using available SDKs and frameworks. |
19
+ | 4 | Advanced Topics, Security, and the Future of MCP | Explore advanced features, security considerations, and the future roadmap of MCP. |
20
+
21
+ ## Prerequisites
22
+
23
+ * Basic understanding of AI and LLM concepts
24
+ * Familiarity with software development principles and API concepts
25
+ * Experience with at least one programming language (Python or TypeScript examples will be emphasized)
26
+
27
+ ## Contribution Guidelines
28
+
29
+ If you want to contribute to this course, you're welcome to do so. Feel free to open an issue or submit a pull request. For specific contributions, here are some guidelines:
30
+
31
+ ### Small typo and grammar fixes
32
+
33
+ If you find a small typo or grammar mistake, please fix it yourself and submit a pull request. This is very helpful for students.
34
+
35
+ ### New unit
36
+
37
+ If you want to add a new unit, **please create an issue in the repository, describe the unit, and why it should be added**. We will discuss it and if it's a good addition, we can collaborate on it.
38
+
39
+ ## Citing the project
40
+
41
+ To cite this repository in publications:
42
+
43
+ ```
44
+ @misc{mcp-course,
45
+ author = {Your Name},
46
+ title = {The Model Context Protocol Course},
47
+ year = {2025},
48
+ howpublished = {\url{https://github.com/yourusername/mcp-course}},
49
+ note = {GitHub repository},
50
+ }
51
+ ```
requirements.txt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ hf-doc-builder>=0.5.0
2
+ mdx_truly_sane_lists
3
+ pyyaml
units/en/_toctree.yml ADDED
@@ -0,0 +1,74 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ - title: "0. Welcome to the MCP Course"
2
+ sections:
3
+ - local: unit0/introduction
4
+ title: Welcome to the MCP Course
5
+
6
+ - title: "1. Introduction to Model Context Protocol"
7
+ sections:
8
+ - local: unit1/introduction
9
+ title: Introduction to Model Context Protocol (MCP)
10
+ - local: unit1/what-is-mcp
11
+ title: What is Model Context Protocol (MCP)?
12
+ - local: unit1/key-concepts
13
+ title: Key Concepts and Terminology
14
+ - local: unit1/quiz1
15
+ title: Unit 1 Quiz
16
+
17
+ - title: "2. Understanding MCP Architecture and Core Concepts"
18
+ sections:
19
+ - local: unit2/introduction
20
+ title: Understanding MCP Architecture and Core Concepts
21
+ - local: unit2/architectural-components
22
+ title: Architectural Components
23
+ - local: unit2/communication-protocol
24
+ title: The Communication Protocol
25
+ - local: unit2/capabilities
26
+ title: Understanding MCP Capabilities
27
+ - local: unit2/quiz2
28
+ title: Unit 2 Quiz
29
+
30
+ - title: "3. Building with MCP: Practical Development"
31
+ sections:
32
+ - local: unit3/introduction
33
+ title: Introduction
34
+ - local: unit3/environment-setup
35
+ title: Setting Up Your Development Environment & SDKs
36
+ - local: unit3/building-server
37
+ title: Building Your First MCP Server
38
+ - local: unit3/server-capabilities
39
+ title: Implementing Server Capabilities
40
+ - local: unit3/developing-clients
41
+ title: Developing MCP Clients
42
+ - local: unit3/configuration
43
+ title: Configuration, Authentication, and Debugging
44
+ - local: unit3/mcp-ecosystem
45
+ title: Navigating the MCP Ecosystem
46
+ - local: unit3/gradio-mcp
47
+ title: "Hugging Face Gradio MCP Integration"
48
+ - local: unit3/hub-mcp-servers
49
+ title: "Working with MCP Servers on Hugging Face Hub"
50
+ - local: unit3/tiny-agents-mcp
51
+ title: "Building with Tiny Agents and MCP"
52
+ - local: unit3/practical-exercise
53
+ title: "Practical Exercise: MCP Interaction Walkthrough"
54
+ - local: unit3/quiz
55
+ title: Unit 3 Quiz
56
+
57
+ - title: "4. Advanced Topics, Security, and the Future of MCP"
58
+ sections:
59
+ - local: unit4/introduction
60
+ title: Introduction
61
+ - local: unit4/advanced-features
62
+ title: Exploring Advanced MCP Features
63
+ - local: unit4/security
64
+ title: Security Deep Dive - Threats and Mitigation Strategies
65
+ - local: unit4/limitations
66
+ title: Limitations, Challenges, and Comparisons
67
+ - local: unit4/huggingface-ecosystem
68
+ title: Hugging Face's Ecosystem and Future Contributions
69
+ - local: unit4/future
70
+ title: The Future of MCP - Roadmap and Standardization
71
+ - local: unit4/final-project
72
+ title: Final Project - Building a Complete MCP Application
73
+ - local: unit4/certification
74
+ title: Certification and Next Steps
units/en/unit0/_toctree.yml ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ - title: 0. Setup
2
+ sections:
3
+ - local: unit0/introduction
4
+ title: Welcome to the MCP Course
5
+ - local: unit0/onboarding
6
+ title: 🤗 Onboarding (Optional)
7
+ - local: unit0/discord
8
+ title: Discord 101
9
+
10
+ - title: Live Session 1
11
+ sections:
12
+ - local: unit0/livesession1
13
+ title: How the course works and Q&A
units/en/unit0/introduction.mdx ADDED
@@ -0,0 +1,153 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Welcome to the 🤗 Model Context Protocol (MCP) Course
2
+
3
+ ![MCP Course thumbnail](https://placeholder-for-mcp-course-thumbnail.com/image.png)
4
+
5
+ Welcome to the most exciting topic in AI today: **Model Context Protocol (MCP)**!
6
+
7
+ This free course will take you on a journey, **from beginner to expert**, in understanding, using, and building applications with MCP.
8
+
9
+ This first unit will help you onboard:
10
+
11
+ * Discover the **course's syllabus**.
12
+ * **Choose the path** you're going to take (either self-audit or certification process).
13
+ * **Get more information about the certification process and the deadlines**.
14
+ * Get to know the team behind the course.
15
+ * Create your **account**.
16
+ * **Sign-up to our Discord server**, and meet your classmates and us.
17
+
18
+ Let's get started!
19
+
20
+ ## What to expect from this course?
21
+
22
+ In this course, you will:
23
+
24
+ * 📖 Study Model Context Protocol in **theory, design, and practice.**
25
+ * 🧑‍💻 Learn to **use established MCP SDKs and frameworks**.
26
+ * 💾 **Share your projects** and explore applications created by the community.
27
+ * 🏆 Participate in challenges where you will **evaluate your MCP implementations against other students'.**
28
+ * 🎓 **Earn a certificate of completion** by completing assignments.
29
+
30
+ And more!
31
+
32
+ At the end of this course, you'll understand **how MCP works and how to build your own AI applications that leverage external data and tools using the latest MCP standards**.
33
+
34
+ Don't forget to **sign up to the course!**
35
+
36
+ (We are respectful of your privacy. We collect your email address to be able to **send you the links when each Unit is published and give you information about the challenges and updates**).
37
+
38
+ ## What does the course look like?
39
+
40
+ The course is composed of:
41
+
42
+ * _Foundational Units_: where you learn MCP **concepts in theory**.
43
+ * _Hands-on_: where you'll learn **to use established MCP SDKs** to build your applications. These hands-on sections will have pre-configured environments.
44
+ * _Use case assignments_: where you'll apply the concepts you've learned to solve a real-world problem that you'll choose.
45
+ * _The Challenge_: you'll get to put your implementation to compete against other implementations in a challenge. There will also be a leaderboard for you to compare performance.
46
+
47
+ This **course is a living project, evolving with your feedback and contributions!** Feel free to open issues and PRs in GitHub, and engage in discussions in our Discord server.
48
+
49
+ After you have gone through the course, you can also send your feedback 👉 using this form [LINK TO FEEDBACK FORM]
50
+
51
+ ## What's the syllabus?
52
+
53
+ Here is the **general syllabus for the course**. A more detailed list of topics will be released with each unit.
54
+
55
+ | Chapter | Topic | Description |
56
+ | ------- | ------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------- |
57
+ | 0 | Onboarding | Set you up with the tools and platforms that you will use. |
58
+ | 1 | MCP Fundamentals | Explain core concepts, architecture, and components of Model Context Protocol. Show a simple use case using MCP. |
59
+ | 2 | Architecture and Core Concepts | Understand the MCP architecture, communication protocols, and core primitives like Tools, Resources, and Prompts. |
60
+ | 3 | Practical Development | Learn to implement MCP clients and servers using available SDKs and frameworks. |
61
+ | 4 | Advanced Topics and Security | Explore advanced features, security considerations, and the future roadmap of MCP. |
62
+
63
+ ## What are the prerequisites?
64
+
65
+ To be able to follow this course, you should have:
66
+
67
+ * Basic understanding of AI and LLM concepts
68
+ * Familiarity with software development principles and API concepts
69
+ * Experience with at least one programming language (Python or TypeScript examples will be emphasized)
70
+
71
+ ## What tools do I need?
72
+
73
+ You only need 2 things:
74
+
75
+ * _A computer_ with an internet connection.
76
+ * An _Account_: to access the course resources and create projects. If you don't have an account yet, you can create one **here** (it's free).
77
+
78
+ ## The Certification Process
79
+
80
+ ### Two paths
81
+
82
+ You can choose to follow this course _in audit mode_, or do the activities and _get one of the two certificates we'll issue_.
83
+
84
+ If you audit the course, you can participate in all the challenges and do assignments if you want, and **you don't need to notify us**.
85
+
86
+ The certification process is **completely free**:
87
+
88
+ * _To get a certification for fundamentals_: you need to complete Unit 1 of the course. This is intended for students that want to get up to date with the latest trends in MCP.
89
+ * _To get a certificate of completion_: you need to complete Unit 1, one of the use case assignments we'll propose during the course, and the final challenge.
90
+
91
+ There's a deadline for the certification process: all the assignments must be finished before **July 1st 2025**.
92
+
93
+ ![Deadline](https://placeholder-for-deadline-image.com/image.png)
94
+
95
+ ## What is the recommended pace?
96
+
97
+ Each chapter in this course is designed **to be completed in 1 week, with approximately 3-4 hours of work per week**.
98
+
99
+ Since there's a deadline, we provide you a recommended pace:
100
+
101
+ ![Recommended Pace](https://placeholder-for-pace-image.com/image.png)
102
+
103
+ ## How to get the most out of the course?
104
+
105
+ To get the most out of the course, we have some advice:
106
+
107
+ 1. Join study groups in Discord: studying in groups is always easier. To do that, you need to join our discord server and verify your account.
108
+ 2. **Do the quizzes and assignments**: the best way to learn is through hands-on practice and self-assessment.
109
+ 3. **Define a schedule to stay in sync**: you can use our recommended pace schedule below or create yours.
110
+
111
+ ![Course advice](https://placeholder-for-advice-image.com/image.png)
112
+
113
+ ## Who are we
114
+
115
+ About the authors:
116
+
117
+ ### Author 1
118
+
119
+ Author 1 is an AI engineer and has built and deployed MCP applications in production. Author 1 will be your main instructor for this course.
120
+
121
+ * Follow Author 1 on GitHub
122
+ * Follow Author 1 on Twitter
123
+ * Follow Author 1 on LinkedIn
124
+
125
+ ### Author 2
126
+
127
+ Author 2 is an AI engineer and has delivered multiple courses across various platforms. Author 2's goal is to make the course accessible to everyone.
128
+
129
+ * Follow Author 2 on GitHub
130
+ * Follow Author 2 on Twitter
131
+ * Follow Author 2 on LinkedIn
132
+
133
+ ## Acknowledgments
134
+
135
+ We would like to extend our gratitude to the following individuals for their invaluable contributions to this course:
136
+
137
+ * **Contributor 1** – For guidance and expertise in reviewing the materials.
138
+ * **Contributor 2** – For amazing demo applications.
139
+ * **Contributor 3** – For help on the course content.
140
+
141
+ ## I found a bug, or I want to improve the course
142
+
143
+ Contributions are **welcome** 🤗
144
+
145
+ * If you _found a bug 🐛 in a notebook_, please open an issue and **describe the problem**.
146
+ * If you _want to improve the course_, you can open a Pull Request.
147
+ * If you _want to add a full section or a new unit_, the best is to open an issue and **describe what content you want to add before starting to write it so that we can guide you**.
148
+
149
+ ## I still have questions
150
+
151
+ Please ask your question in our discord server #mcp-course-questions.
152
+
153
+ Now that you have all the information, let's get on board ⛵
units/en/unit1/_toctree.yml ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ - title: 1. Introduction to Model Context Protocol
2
+ sections:
3
+ - local: unit1/introduction
4
+ title: Introduction
5
+ - local: unit1/what-is-mcp
6
+ title: What is Model Context Protocol?
7
+ - local: unit1/quiz1
8
+ title: Quick Quiz 1
9
+ - local: unit1/key-concepts
10
+ title: Key Concepts of Model Context Protocol
11
+ - local: unit1/integration-challenges
12
+ title: The Integration Challenges MCP Solves
13
+ - local: unit1/quiz2
14
+ title: Quick Quiz 2
15
+ - local: unit1/benefits-goals
16
+ title: Key Benefits and Goals of MCP
17
+ - local: unit1/example-project
18
+ title: A Simple MCP Integration Example
19
+ - local: unit1/finalquiz
20
+ title: Unit 1 Final Quiz
units/en/unit1/introduction.mdx ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Introduction to Model Context Protocol (MCP)
2
+
3
+ Welcome to Unit 1 of the MCP Course! In this unit, we'll explore the fundamentals of Model Context Protocol.
4
+
5
+ ## What You Will Learn
6
+
7
+ In this unit, you will:
8
+
9
+ * Understand what Model Context Protocol is and why it's important
10
+ * Learn the key concepts and terminology associated with MCP
11
+ * Explore the integration challenges that MCP solves
12
+ * Walk through the key benefits and goals of MCP
13
+ * See a simple example of MCP integration in action
14
+
15
+ By the end of this unit, you'll have a solid understanding of the foundational concepts of MCP and be ready to dive deeper into its architecture and implementation in the next unit.
16
+
17
+ ## Importance of MCP
18
+
19
+ The AI ecosystem is evolving rapidly, with Large Language Models (LLMs) and other AI systems becoming increasingly capable. However, these models are often limited by their training data and lack access to real-time information or specialized tools. This limitation hinders the potential of AI systems to provide truly relevant, accurate, and helpful responses in many scenarios.
20
+
21
+ This is where Model Context Protocol (MCP) comes in. MCP enables AI models to connect with external data sources, tools, and environments, allowing for the seamless transfer of information and capabilities between AI systems and the broader digital world. This interoperability is crucial for the growth and adoption of truly useful AI applications.
22
+
23
+ ## Overview of Unit 1
24
+
25
+ Here's a brief overview of what we'll cover in this unit:
26
+
27
+ 1. **What is Model Context Protocol?** - We'll start by defining what MCP is and discussing its role in the AI ecosystem.
28
+ 2. **Key Concepts** - We'll explore the fundamental concepts and terminology associated with MCP.
29
+ 3. **Integration Challenges** - We'll examine the problems that MCP aims to solve, particularly the "M×N Integration Problem."
30
+ 4. **Benefits and Goals** - We'll discuss the key benefits and goals of MCP, including standardization, enhanced AI capabilities, and interoperability.
31
+ 5. **Simple Example** - Finally, we'll walk through a simple example of MCP integration to see how it works in practice.
32
+
33
+ Let's dive in and explore the exciting world of Model Context Protocol!
units/en/unit1/quiz1.mdx ADDED
@@ -0,0 +1,48 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Quick Quiz 1
2
+
3
+ <CourseQuiz>
4
+ <Question
5
+ question="What is the primary purpose of Model Context Protocol (MCP)?"
6
+ choice1="To replace all existing AI models with a single unified model"
7
+ choice2="To enable interoperability between AI models and external data/tools"
8
+ choice3="To create a new programming language for AI development"
9
+ choice4="To increase the training data size for all LLMs"
10
+ answer={2}
11
+ />
12
+
13
+ <Question
14
+ question="Which of the following is NOT a common problem that MCP aims to solve?"
15
+ choice1="AI models' inability to access real-time information"
16
+ choice2="The M×N integration problem between AI apps and tools"
17
+ choice3="Reducing the need for AI models entirely"
18
+ choice4="Inconsistent implementations of tool integration"
19
+ answer={3}
20
+ />
21
+
22
+ <Question
23
+ question="The 'USB-C for AI applications' analogy for MCP refers to:"
24
+ choice1="The physical hardware interface required for AI models"
25
+ choice2="The universal connector that enables different AI systems to plug into various data sources and tools"
26
+ choice3="The power delivery specifications for AI hardware"
27
+ choice4="The physical shape of AI processing units"
28
+ answer={2}
29
+ />
30
+
31
+ <Question
32
+ question="Which of the following is a key component of the MCP architecture?"
33
+ choice1="A centralized repository of all AI training data"
34
+ choice2="A server that exposes capabilities like Tools, Resources, and Prompts"
35
+ choice3="A regulatory body that approves all AI models"
36
+ choice4="A hardware accelerator for AI processing"
37
+ answer={2}
38
+ />
39
+
40
+ <Question
41
+ question="How can MCP be best described in terms of its standardization benefits?"
42
+ choice1="It forces all AI models to use the same training data"
43
+ choice2="It transforms the M×N integration problem into a more manageable M+N problem"
44
+ choice3="It eliminates the need for any custom integrations"
45
+ choice4="It prevents any further development of new AI tools"
46
+ answer={2}
47
+ />
48
+ </CourseQuiz>
units/en/unit1/what-is-mcp.mdx ADDED
@@ -0,0 +1,100 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # What is Model Context Protocol (MCP)?
2
+
3
+ Model Context Protocol (MCP) is an open standard designed to define a universal way for AI models, particularly Large Language Models (LLMs), to connect with external data sources, tools, and environments. It provides a standardized framework for AI applications to access the context they need to provide more relevant, accurate, and helpful responses.
4
+
5
+ ## Definition
6
+
7
+ At its core, MCP refers to a set of standardized rules, conventions, and technologies that allow for structured communication between AI models and external systems. It provides the infrastructure necessary for AI systems to access information and capabilities in a secure, standardized manner.
8
+
9
+ Think of MCP as the "USB-C for AI applications" – a universal connector that enables different AI systems to plug into various data sources and tools, allowing them to work together despite their inherent differences.
10
+
11
+ ## MCP and the Hugging Face Ecosystem
12
+
13
+ Hugging Face has embraced MCP as a key standard in the AI ecosystem, offering several implementations and tools to make working with MCP more accessible:
14
+
15
+ - **MCP Servers on Hugging Face**: The community has contributed various MCP servers that can be discovered, shared, and deployed directly from the Hugging Face Hub.
16
+ - **Gradio MCP Integration**: Hugging Face's Gradio now supports MCP, allowing developers to quickly create web interfaces for their MCP-enabled applications.
17
+
18
+ This integration with the Hugging Face ecosystem makes deploying and sharing MCP components more straightforward, enabling wider adoption of this important standard.
19
+
20
+ ## Why Do We Need MCP?
21
+
22
+ ### The AI Integration Challenge
23
+
24
+ The AI ecosystem has expanded dramatically, with numerous models and applications designed for specific use cases:
25
+
26
+ - **AI Assistants**: Like Claude, ChatGPT, and other conversational AIs
27
+ - **Coding Assistants**: Like GitHub Copilot, Cursor, and Codeium
28
+ - **Specialized Agents**: For document processing, data analysis, or domain-specific tasks
29
+ - **Enterprise AI Applications**: Custom AI solutions for organizations
30
+ - Many others with specific features and optimizations
31
+
32
+ Each of these AI applications might need access to similar external systems:
33
+
34
+ - **File Systems**: To read and write documents
35
+ - **APIs**: Like GitHub, Slack, or Google Drive
36
+ - **Databases**: For querying and retrieving structured data
37
+ - **Custom Tools**: Organization-specific systems and functions
38
+
39
+ This creates what's known as the "M×N Integration Problem" - with M different AI applications and N different tools or data sources, you potentially need M×N custom integrations without a standard.
40
+
41
+ ### The M×N Integration Problem
42
+
43
+ Without a standard like MCP, connecting M AI applications to N external tools creates several problems:
44
+
45
+ 1. **Integration Complexity**: Each AI app needs custom code for each external tool (M×N integrations)
46
+ 2. **Maintenance Burden**: Changes in any tool or AI system can break multiple integrations
47
+ 3. **Inconsistent Implementations**: Each integration might handle similar functions differently
48
+ 4. **Limited Model Utility**: AI models are restricted to static training data without access to real-time context
49
+ 5. **Development Inefficiency**: Developers waste time creating redundant integrations
50
+
51
+ ### Benefits of MCP
52
+
53
+ Model Context Protocol solves these problems by enabling:
54
+
55
+ 1. **Standardization**: A universal protocol for AI connectivity that replaces fragmented approaches
56
+ 2. **Simplified Integration**: Reducing complexity from M×N to M+N integrations
57
+ 3. **Enhanced AI Capabilities**: Giving models access to real-time data and specialized tools
58
+ 4. **Interoperability**: Allowing easier swapping of AI models and tools, avoiding lock-in
59
+ 5. **Improved Security**: Providing structured access patterns and potential for centralized control
60
+ 6. **Community Collaboration**: Platforms like Hugging Face enable sharing and reusing MCP components
61
+
62
+ ## Evolution of MCP
63
+
64
+ The journey toward standardized AI connectivity has evolved through several stages:
65
+
66
+ ### 1. Early LLM Limitations (2020-2022)
67
+ - AI models operated with only their training data
68
+ - No standardized way to access external information or tools
69
+ - Custom integrations were required for each use case
70
+
71
+ ### 2. Function Calling & Plugins (2022-2023)
72
+ - Introduction of function calling APIs by OpenAI and others
73
+ - Development of plugin ecosystems for specific AI platforms
74
+ - Proprietary approaches dominated, leading to fragmentation
75
+
76
+ ### 3. Cross-Platform Standards (2023-2024)
77
+ - Emergence of interoperability initiatives
78
+ - Growing need for AI models to access real-time context
79
+ - Move toward open standards for AI connectivity
80
+
81
+ ### 4. Model Context Protocol (2024-Present)
82
+ - Release of MCP as an open standard initially by Anthropic
83
+ - Growing ecosystem of clients, servers, and frameworks on platforms like Hugging Face
84
+ - Industry collaboration on standardization efforts
85
+
86
+ MCP represents the latest evolution in this journey, moving beyond proprietary solutions toward true AI interoperability.
87
+
88
+ ## Key Components of MCP
89
+
90
+ An effective Model Context Protocol implementation typically includes these essential components:
91
+
92
+ 1. **Host**: The AI application that interacts with users
93
+ 2. **Client**: The component within the Host that connects to a Server
94
+ 3. **Server**: An external program that exposes capabilities
95
+ 4. **Tools**: Executable functions the AI can call
96
+ 5. **Resources**: Data sources the AI can access
97
+ 6. **Prompts**: Pre-defined templates for interactions
98
+ 7. **Transports**: Communication methods like stdio or HTTP+SSE
99
+
100
+ In the next section, we'll explore these key concepts in more detail to understand how MCP works at a technical level.
units/en/unit2/_toctree.yml ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ - title: 2. Understanding MCP Architecture and Core Concepts
2
+ sections:
3
+ - local: unit2/introduction
4
+ title: Introduction
5
+ - local: unit2/architecture
6
+ title: MCP Architecture - Hosts, Clients, and Servers
7
+ - local: unit2/core-primitives
8
+ title: Core Primitives - Tools, Resources, Prompts, and Sampling
9
+ - local: unit2/communication-protocols
10
+ title: Communication Protocols - JSON-RPC, stdio, HTTP+SSE
11
+ - local: unit2/interaction-lifecycle
12
+ title: The MCP Interaction Lifecycle
13
+ - local: unit2/quiz
14
+ title: Unit 2 Quiz
units/en/unit2/introduction.mdx ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Understanding MCP Architecture and Core Concepts
2
+
3
+ Welcome to Unit 2 of the MCP Course! In this unit, we'll dive deeper into the technical architecture and core concepts of the Model Context Protocol.
4
+
5
+ ## What You Will Learn
6
+
7
+ In this unit, you will:
8
+
9
+ * Understand the client-server architecture of MCP and the roles of Hosts, Clients, and Servers
10
+ * Learn about MCP's core primitives: Tools, Resources, Prompts, and Sampling
11
+ * Explore the communication protocols that power MCP interactions
12
+ * Trace through a complete MCP interaction lifecycle
13
+ * Understand how these architectural components work together in real implementations
14
+
15
+ By the end of this unit, you'll have a comprehensive understanding of MCP's technical foundation, enabling you to build and integrate MCP components effectively.
16
+
17
+ ## Why Architecture Matters
18
+
19
+ Understanding the architecture of MCP is crucial for several reasons:
20
+
21
+ * **Effective Implementation**: A clear mental model of how MCP components interact allows you to implement or integrate MCP correctly.
22
+ * **Troubleshooting**: Knowledge of the architecture helps you diagnose and fix issues when they arise.
23
+ * **Design Decisions**: Understanding the "why" behind MCP's design helps you make appropriate decisions for your use case.
24
+ * **Security Considerations**: The architecture has implications for security that are essential to understand before deployment.
25
+ * **Performance Optimization**: Knowing how data flows through MCP helps optimize for performance.
26
+
27
+ ## The Components We'll Explore
28
+
29
+ MCP's architecture consists of several key components that work together to enable AI models to access external context and capabilities. In this unit, we'll examine:
30
+
31
+ 1. **Client-Server Architecture**: The foundational structure of MCP, including Hosts (the AI applications), Clients (protocol handlers within hosts), and Servers (providing capabilities).
32
+
33
+ 2. **Core Primitives**: The fundamental building blocks of MCP interactions:
34
+ - Tools: Executable functions the model can call
35
+ - Resources: Data sources the application can access
36
+ - Prompts: Pre-defined templates or workflows
37
+ - Sampling: Server-initiated model interactions
38
+
39
+ 3. **Communication Protocols**: The standardized methods for exchanging information:
40
+ - JSON-RPC: The message format for requests, responses, and notifications
41
+ - Transports: stdio (for local servers) and HTTP+SSE/Streamable HTTP (for remote servers)
42
+
43
+ 4. **Interaction Lifecycle**: The sequence of steps in an MCP interaction, from initialization to termination.
44
+
45
+ Let's begin our exploration of MCP's architecture and core concepts, which will provide the foundation for the practical development we'll cover in Unit 3.
units/en/unit3/_toctree.yml ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ - title: "3. Building with MCP: Practical Development"
2
+ sections:
3
+ - local: unit3/introduction
4
+ title: Introduction
5
+ - local: unit3/environment-setup
6
+ title: Setting Up Your Development Environment & SDKs
7
+ - local: unit3/building-server
8
+ title: Building Your First MCP Server
9
+ - local: unit3/server-capabilities
10
+ title: Implementing Server Capabilities
11
+ - local: unit3/developing-clients
12
+ title: Developing MCP Clients
13
+ - local: unit3/configuration
14
+ title: Configuration, Authentication, and Debugging
15
+ - local: unit3/mcp-ecosystem
16
+ title: Navigating the MCP Ecosystem
17
+ - local: unit3/gradio-mcp
18
+ title: "Hugging Face Gradio MCP Integration"
19
+ - local: unit3/hub-mcp-servers
20
+ title: "Working with MCP Servers on Hugging Face Hub"
21
+ - local: unit3/practical-exercise
22
+ title: "Practical Exercise: MCP Interaction Walkthrough"
23
+ - local: unit3/quiz
24
+ title: Unit 3 Quiz
units/en/unit3/gradio-mcp.mdx ADDED
@@ -0,0 +1,215 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Hugging Face Gradio MCP Integration
2
+
3
+ Hugging Face's Gradio framework offers a powerful way to build and deploy web interfaces for AI applications. With its MCP integration, Gradio now makes it easier than ever to create interactive interfaces for MCP-enabled AI systems as well as building MCP servers in just a few lines of code.
4
+
5
+ ## What is Gradio MCP?
6
+
7
+ Gradio MCP is an extension of the popular Gradio framework that allows developers to:
8
+
9
+ 1. Create web interfaces for MCP-enabled applications with minimal code
10
+ 2. Build MCP servers that can be used by any MCP client (like Claude, Cursor, or Cline)
11
+ 3. Visualize and debug MCP interactions through a user-friendly interface
12
+ 4. Deploy MCP applications to the Hugging Face Spaces platform with a single click
13
+ 5. Share MCP capabilities with others through an intuitive UI
14
+
15
+ This integration bridges the gap between powerful MCP functionality and accessible user interfaces, making MCP-enabled AI systems more usable and shareable.
16
+
17
+ ## Building an MCP Server with Gradio
18
+
19
+ According to the [official Hugging Face blog post](https://huggingface.co/blog/gradio-mcp), turning any Gradio app into an MCP server is remarkably simple. Here's how:
20
+
21
+ ### Installation
22
+
23
+ First, install Gradio with the MCP extra:
24
+
25
+ ```bash
26
+ pip install "gradio[mcp]"
27
+ ```
28
+
29
+ ### Creating a Simple MCP Server
30
+
31
+ Here's an example of a letter-counting tool exposed as an MCP server:
32
+
33
+ ```python
34
+ import gradio as gr
35
+
36
+ def letter_counter(word, letter):
37
+ """Count the occurrences of a specific letter in a word.
38
+
39
+ Args:
40
+ word: The word or phrase to analyze
41
+ letter: The letter to count occurrences of
42
+
43
+ Returns:
44
+ The number of times the letter appears in the word
45
+ """
46
+ return word.lower().count(letter.lower())
47
+
48
+ demo = gr.Interface(
49
+ fn=letter_counter,
50
+ inputs=["text", "text"],
51
+ outputs="number",
52
+ title="Letter Counter",
53
+ description="Count how many times a letter appears in a word"
54
+ )
55
+
56
+ demo.launch(mcp_server=True)
57
+ ```
58
+
59
+ That's it! The only addition is the `mcp_server=True` parameter in the `launch()` method. When you run this app, it will:
60
+
61
+ 1. Start the regular Gradio web interface
62
+ 2. Start the MCP server
63
+ 3. Print the MCP server URL in the console
64
+
65
+ ### How Gradio MCP Works
66
+
67
+ Gradio automatically converts your Python functions into MCP tools that can be used by LLMs. The docstring of your function is used to generate the description of the tool and its parameters, making it seamless to expose functionality to MCP clients.
68
+
69
+ The MCP server will be accessible at:
70
+ ```
71
+ http://your-server:port/gradio_api/mcp/sse
72
+ ```
73
+
74
+ To use this server with an MCP client (like Claude Desktop, Cursor, or Cline), you simply need to add this URL to your client's configuration:
75
+
76
+ ```json
77
+ {
78
+ "mcpServers": {
79
+ "gradio": {
80
+ "url": "http://your-server:port/gradio_api/mcp/sse"
81
+ }
82
+ }
83
+ }
84
+ ```
85
+
86
+ ## Key Features of Gradio MCP
87
+
88
+ ### Tool Conversion
89
+
90
+ Each API endpoint in your Gradio app is automatically converted into an MCP tool with a corresponding name, description, and input schema. To view the available tools and their schemas, you can visit:
91
+ ```
92
+ http://your-server:port/gradio_api/mcp/schema
93
+ ```
94
+
95
+ Or go to the "View API" link in the footer of your Gradio app and click on "MCP".
96
+
97
+ ### Environment Variable Support
98
+
99
+ There are two ways to enable MCP server functionality:
100
+
101
+ 1. Using the `mcp_server` parameter as shown above:
102
+ ```python
103
+ demo.launch(mcp_server=True)
104
+ ```
105
+
106
+ 2. Using environment variables:
107
+ ```bash
108
+ export GRADIO_MCP_SERVER=True
109
+ ```
110
+
111
+ ### File Handling
112
+
113
+ The server automatically handles file data conversions, including:
114
+ - Converting base64-encoded strings to file data
115
+ - Processing image files and returning them in the correct format
116
+ - Managing temporary file storage
117
+
118
+ It is strongly recommended to pass input images and files as full URLs ("http://..." or "https://...") as MCP clients do not always handle local files correctly.
119
+
120
+ ### Hosted MCP Servers on Hugging Face Spaces
121
+
122
+ You can publish your Gradio application for free on Hugging Face Spaces, which will give you a free hosted MCP server. This allows you to share your MCP tools with others easily.
123
+
124
+ For example, you can try out the MCP tools from [this Space](https://huggingface.co/spaces/abidlabs/mcp-tools) by adding the following configuration to your MCP client:
125
+
126
+ ```json
127
+ {
128
+ "mcpServers": {
129
+ "gradio": {
130
+ "url": "https://abidlabs-mcp-tools.hf.space/gradio_api/mcp/sse"
131
+ }
132
+ }
133
+ }
134
+ ```
135
+
136
+ ## Advanced Usage
137
+
138
+ ### Multiple Tools in One Server
139
+
140
+ You can expose multiple tools from a single Gradio app:
141
+
142
+ ```python
143
+ import gradio as gr
144
+
145
+ def add(a, b):
146
+ """Add two numbers together.
147
+
148
+ Args:
149
+ a: The first number
150
+ b: The second number
151
+
152
+ Returns:
153
+ The sum of the two numbers
154
+ """
155
+ return a + b
156
+
157
+ def multiply(a, b):
158
+ """Multiply two numbers together.
159
+
160
+ Args:
161
+ a: The first number
162
+ b: The second number
163
+
164
+ Returns:
165
+ The product of the two numbers
166
+ """
167
+ return a * b
168
+
169
+ demo = gr.Blocks()
170
+
171
+ with demo:
172
+ with gr.Tab("Addition"):
173
+ a1 = gr.Number()
174
+ b1 = gr.Number()
175
+ output1 = gr.Number()
176
+ gr.Interface(fn=add, inputs=[a1, b1], outputs=output1)
177
+
178
+ with gr.Tab("Multiplication"):
179
+ a2 = gr.Number()
180
+ b2 = gr.Number()
181
+ output2 = gr.Number()
182
+ gr.Interface(fn=multiply, inputs=[a2, b2], outputs=output2)
183
+
184
+ demo.launch(mcp_server=True)
185
+ ```
186
+
187
+ This will expose both the `add` and `multiply` functions as separate MCP tools.
188
+
189
+ ### Client Integration
190
+
191
+ Gradio can also serve as an MCP client, allowing you to create interfaces that connect to MCP servers. This will be covered in more detail in our hub-mcp-servers section.
192
+
193
+ ## Example Projects
194
+
195
+ Hugging Face hosts several example projects demonstrating Gradio MCP integration:
196
+
197
+ 1. **[MCP Tools Demo](https://huggingface.co/spaces/abidlabs/mcp-tools)**: A collection of useful MCP tools built with Gradio
198
+ 2. **[Kokoro MCP](https://huggingface.co/spaces/fdaudens/kokoro-mcp)**: A text-to-speech application exposed as an MCP server
199
+ 3. **MCP Multi-Tool Demo**: Showcases multiple MCP servers working together in a single interface
200
+
201
+ These examples provide excellent starting points for your own Gradio MCP applications.
202
+
203
+ ## Best Practices
204
+
205
+ When building with Gradio MCP, consider these best practices:
206
+
207
+ 1. **Provide Clear Documentation**: Use detailed docstrings to help LLMs understand how to use your tools
208
+ 2. **Use Type Hints**: Add Python type hints to your functions to help Gradio generate accurate schemas
209
+ 3. **Error Handling**: Implement robust error handling to provide helpful feedback
210
+ 4. **Consider Statelessness**: Design your tools to be stateless when possible
211
+ 5. **Security Considerations**: Be mindful of tool permissions, especially in shared deployments
212
+
213
+ By following these practices, you can create robust, user-friendly MCP applications using Gradio that seamlessly integrate with LLM applications.
214
+
215
+ In the next section, we'll explore working with MCP servers on the Hugging Face Hub.
units/en/unit3/hub-mcp-servers.mdx ADDED
@@ -0,0 +1,154 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Working with MCP Servers on Hugging Face Hub
2
+
3
+ The Hugging Face Hub provides a centralized platform for discovering, sharing, and deploying MCP servers. This ecosystem approach dramatically simplifies working with MCP by providing a community-driven repository of reusable components.
4
+
5
+ ## The MCP Server Ecosystem on Hugging Face
6
+
7
+ The Hugging Face Hub hosts a growing collection of MCP servers covering various functionalities:
8
+
9
+ - **Data Access Servers**: For accessing files, databases, and APIs
10
+ - **Tool Servers**: Providing utilities like code execution, data analysis, and web browsing
11
+ - **Integration Servers**: Connecting to third-party services like Slack, GitHub, and Google Workspace
12
+ - **Specialized Servers**: For domain-specific tasks like image generation, document processing, and more
13
+
14
+ This shared ecosystem eliminates the need to build common MCP servers from scratch, allowing developers to focus on their unique application requirements.
15
+
16
+ ## Finding MCP Servers on the Hub
17
+
18
+ ### Searching for MCP Servers
19
+
20
+ You can discover MCP servers on the Hugging Face Hub using:
21
+
22
+ 1. **The Hub Search**: Visit [huggingface.co](https://huggingface.co) and search for "mcp-server" or specific functionality like "mcp-server-github"
23
+ 2. **Tags**: Browse servers tagged with "mcp", "mcp-server", or related categories
24
+ 3. **Collections**: Explore curated collections of MCP servers for specific domains or use cases
25
+
26
+ ### MCP Server Cards
27
+
28
+ Each MCP server on the Hub includes a detailed card with:
29
+
30
+ - **Description**: Overview of the server's functionality
31
+ - **Installation Instructions**: How to set up and run the server
32
+ - **Configuration Options**: Available settings and their default values
33
+ - **Authentication Requirements**: Details on required credentials or tokens
34
+ - **Examples**: Sample code for integrating the server into your applications
35
+ - **Limitations**: Known issues or constraints
36
+
37
+ These cards make it easy to evaluate and compare different servers to find the one that best meets your needs.
38
+
39
+ ## Using Hub MCP Servers in Your Projects
40
+
41
+ ### Installation
42
+
43
+ Most Hub MCP servers can be installed via pip:
44
+
45
+ ```bash
46
+ pip install "mcp-server-github @ git+https://huggingface.co/mcp-servers/github.git"
47
+ ```
48
+
49
+ Or cloned directly:
50
+
51
+ ```bash
52
+ git clone https://huggingface.co/mcp-servers/github
53
+ cd github
54
+ pip install -e .
55
+ ```
56
+
57
+ ### Basic Usage
58
+
59
+ Once installed, you can use a Hub MCP server like any other MCP server:
60
+
61
+ ```python
62
+ # Python example using a GitHub MCP server from the Hub
63
+ from mcp.client import McpClient
64
+ from mcp_server_github import GitHubMcpServer
65
+
66
+ # Start the server
67
+ server = GitHubMcpServer(
68
+ auth_token="your_github_token",
69
+ repo_owner="your_username",
70
+ repo_name="your_repo"
71
+ )
72
+ server.start()
73
+
74
+ # Connect a client
75
+ client = McpClient("github")
76
+ client.connect_to_server_stdio(server.get_stdio_connection())
77
+
78
+ # List available tools
79
+ tools = client.list_tools()
80
+ print(f"Available tools: {[tool.name for tool in tools]}")
81
+
82
+ # Call a tool
83
+ result = client.call_tool("create_issue", {
84
+ "title": "Test issue",
85
+ "body": "This is a test issue created via MCP"
86
+ })
87
+ print(f"Issue created: {result}")
88
+ ```
89
+
90
+ ### Configuration
91
+
92
+ Hub MCP servers typically offer various configuration options:
93
+
94
+ ```python
95
+ # Example with comprehensive configuration
96
+ server = FileSystemMcpServer(
97
+ root_directory="/path/to/files",
98
+ allowed_extensions=[".txt", ".md", ".py"],
99
+ read_only=True,
100
+ max_file_size=10_000_000, # 10MB
101
+ concurrency_limit=5
102
+ )
103
+ ```
104
+
105
+ The specific options available depend on the server, but they are documented in the server's Hub card and README.
106
+
107
+ ## Contributing MCP Servers to the Hub
108
+
109
+ ### Creating a New MCP Server
110
+
111
+ If you've developed an MCP server that might be useful to others, sharing it on the Hub is straightforward:
112
+
113
+ 1. **Prepare Your Code**: Ensure your server is well-documented and follows MCP best practices
114
+ 2. **Create a Repository**: Set up a new repository on the Hugging Face Hub using the web interface or the `huggingface-cli`
115
+ 3. **Push Your Code**: Upload your server code to the repository
116
+ 4. **Add a README**: Create a detailed README.md describing your server, its functionality, and usage instructions
117
+ 5. **Add Tags**: Tag your repository with "mcp", "mcp-server", and other relevant tags
118
+
119
+ ### Best Practices for Hub MCP Servers
120
+
121
+ When contributing to the Hub, follow these best practices:
122
+
123
+ 1. **Standardized Structure**: Use a consistent project structure with a clear entry point
124
+ 2. **Comprehensive Documentation**: Document all functionality, configuration options, and examples
125
+ 3. **Error Handling**: Implement robust error handling and meaningful error messages
126
+ 4. **Security Considerations**: Document security implications and recommended precautions
127
+ 5. **Version Management**: Use semantic versioning and maintain a changelog
128
+ 6. **Tests**: Include tests to verify functionality and prevent regressions
129
+
130
+ Following these practices ensures your server is accessible and useful to the community.
131
+
132
+ ## Example: Deploying a Hub MCP Server to Spaces
133
+
134
+ You can deploy MCP servers from the Hub to Hugging Face Spaces for easy access:
135
+
136
+ 1. **Create a New Space**: Set up a Space using the Gradio or Streamlit framework
137
+ 2. **Install the Server**: Add the server as a dependency in your requirements.txt
138
+ 3. **Create a Web Interface**: Build a simple UI for configuring and using the server
139
+ 4. **Deploy**: Push your code to the Space
140
+
141
+ This approach allows you to provide a user-friendly interface for your MCP server, making it accessible to users who may not be comfortable with command-line tools.
142
+
143
+ ## Community Collaboration on MCP Servers
144
+
145
+ The Hugging Face Hub facilitates collaboration on MCP servers through:
146
+
147
+ 1. **Discussions**: Engage with other developers on server functionality and improvements
148
+ 2. **Pull Requests**: Contribute enhancements or fixes to existing servers
149
+ 3. **Issue Tracking**: Report and track bugs or feature requests
150
+ 4. **Version History**: View changes over time and roll back to previous versions if needed
151
+
152
+ This collaborative environment accelerates the development and refinement of MCP servers, benefiting the entire community.
153
+
154
+ In the next section, we'll explore building with Tiny Agents and MCP, combining efficient agent architectures with the power of external tools.
units/en/unit3/introduction.mdx ADDED
@@ -0,0 +1,68 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Building with MCP: Practical Development
2
+
3
+ Welcome to Unit 3 of the MCP Course! In this unit, we'll roll up our sleeves and dive into the practical aspects of developing with Model Context Protocol.
4
+
5
+ ## What You Will Learn
6
+
7
+ In this unit, you will:
8
+
9
+ * Set up a development environment with the necessary MCP SDKs
10
+ * Learn how to build MCP servers that expose capabilities to AI models
11
+ * Implement server capabilities like Tools, Resources, and Prompts
12
+ * Develop MCP clients that can connect to and utilize these servers
13
+ * Configure connections, authentication, and debug MCP interactions
14
+ * Navigate the growing MCP ecosystem of clients, servers, and platforms
15
+ * Walk through a complete MCP interaction from end to end
16
+ * Leverage Hugging Face's tools and platforms for MCP development
17
+
18
+ By the end of this unit, you'll have the practical skills needed to implement MCP in your own projects, both on the server side (exposing capabilities) and the client side (consuming capabilities in AI applications).
19
+
20
+ ## Hugging Face's MCP Ecosystem
21
+
22
+ Hugging Face offers several powerful tools that simplify MCP development and deployment:
23
+
24
+ ### Gradio MCP Integration
25
+
26
+ Hugging Face's Gradio framework now provides native support for MCP, allowing you to:
27
+ * Create user-friendly web interfaces for your MCP-enabled applications
28
+ * Easily visualize and interact with MCP server capabilities
29
+ * Deploy MCP applications with minimal configuration
30
+ * Share your MCP implementations with the community
31
+
32
+ ### MCP Servers on Hugging Face Hub
33
+
34
+ The Hugging Face Hub serves as a central repository for sharing and discovering MCP servers:
35
+ * Browse a growing collection of community-contributed MCP servers
36
+ * Deploy pre-built MCP servers with one click
37
+ * Share your own MCP server implementations
38
+ * Collaborate with others to improve existing servers
39
+
40
+ ## The Value of Practical Implementation
41
+
42
+ While understanding the theory and architecture of MCP is essential, hands-on implementation provides several unique benefits:
43
+
44
+ * **Concrete Understanding**: Translating concepts into working code solidifies your understanding of MCP's principles.
45
+ * **Debugging Skills**: You'll learn to diagnose and resolve common issues that arise in real-world implementations.
46
+ * **Integration Patterns**: You'll discover effective patterns for integrating MCP with existing systems and applications.
47
+ * **Developer Experience**: You'll gain familiarity with the tools and SDKs that streamline MCP development.
48
+ * **Best Practices**: Working examples provide models for secure, efficient, and maintainable MCP implementations.
49
+ * **Community Engagement**: Building with Hugging Face's tools connects you to a vibrant ecosystem of MCP developers.
50
+
51
+ ## What We'll Build
52
+
53
+ Throughout this unit, we'll focus on developing practical components of the MCP ecosystem:
54
+
55
+ 1. **MCP Servers**: We'll build servers that expose various capabilities, from simple file access to API integrations, using official SDKs in languages like Python and TypeScript.
56
+
57
+ 2. **Server Capabilities**: We'll implement each type of MCP capability:
58
+ - Tools that provide executable functions
59
+ - Resources that offer data access
60
+ - Prompts that structure interactions
61
+
62
+ 3. **MCP Clients**: We'll develop client-side code that connects to servers, discovers their capabilities, and integrates them into AI applications.
63
+
64
+ 4. **Configuration & Debugging**: We'll explore approaches for configuring connections, handling authentication, and debugging MCP interactions using tools like the MCP Inspector.
65
+
66
+ 5. **Hugging Face Integrations**: We'll implement MCP applications using Hugging Face's Gradio, Hub, and other tools to take advantage of their robust infrastructure and community.
67
+
68
+ Let's begin our journey into practical MCP development, where theory meets implementation to create powerful AI applications with access to the context and tools they need.
units/en/unit3/tiny-agents-mcp.mdx ADDED
@@ -0,0 +1 @@
 
 
1
+
units/en/unit4/_toctree.yml ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ - title: 4. Advanced Topics, Security, and the Future of MCP
2
+ sections:
3
+ - local: unit4/introduction
4
+ title: Introduction
5
+ - local: unit4/advanced-features
6
+ title: Exploring Advanced MCP Features
7
+ - local: unit4/security
8
+ title: Security Deep Dive - Threats and Mitigation Strategies
9
+ - local: unit4/limitations
10
+ title: Limitations, Challenges, and Comparisons
11
+ - local: unit4/huggingface-ecosystem
12
+ title: Hugging Face's Ecosystem and Future Contributions
13
+ - local: unit4/future
14
+ title: The Future of MCP - Roadmap and Standardization
15
+ - local: unit4/final-project
16
+ title: Final Project - Building a Complete MCP Application
17
+ - local: unit4/certification
18
+ title: Certification and Next Steps
units/en/unit4/huggingface-ecosystem.mdx ADDED
@@ -0,0 +1,173 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Hugging Face's Ecosystem and Future Contributions
2
+
3
+ Hugging Face has emerged as a key player in the MCP ecosystem, providing tools, platforms, and resources that accelerate the adoption and implementation of this important standard. In this section, we'll explore Hugging Face's current contributions to MCP and their future roadmap for enhancing the ecosystem.
4
+
5
+ ## Current Ecosystem Contributions
6
+
7
+ ### MCP Server Hub
8
+
9
+ Hugging Face's Hub provides a centralized repository for MCP servers, offering several advantages:
10
+
11
+ - **Discovery**: Easily find existing MCP servers for common use cases
12
+ - **Versioning**: Track changes and updates to server implementations
13
+ - **Documentation**: Access comprehensive guides on server configuration and usage
14
+ - **Community**: Engage with developers and share improvements
15
+
16
+ This collaborative approach through the Hub significantly reduces the effort required to build and maintain MCP servers, allowing developers to focus on creating innovative applications rather than reinventing infrastructure.
17
+
18
+ ### Gradio MCP Integration
19
+
20
+ Hugging Face's Gradio framework brings MCP to a broader audience through:
21
+
22
+ - **Simplified UI Creation**: Build interfaces for MCP-enabled applications with minimal code
23
+ - **Interactive Demos**: Create shareable demos showcasing MCP capabilities
24
+ - **Visualization Tools**: Monitor and debug MCP interactions through visual tools
25
+ - **One-Click Deployment**: Deploy MCP applications to Spaces with a single command
26
+
27
+ This integration makes MCP more accessible to developers who may not be familiar with the underlying protocol details but want to leverage its capabilities in their applications.
28
+
29
+ ### Tiny Agents Framework
30
+
31
+ Hugging Face's work on Tiny Agents extends MCP to resource-constrained environments:
32
+
33
+ - **Efficient Implementation**: Run MCP-enabled agents on edge devices and low-resource environments
34
+ - **Specialized Model Support**: Leverage smaller, task-specific models while maintaining MCP capabilities
35
+ - **Optimized Context Management**: Efficiently handle context with limited model context windows
36
+ - **Pipeline Architecture**: Build multi-stage agent workflows that leverage MCP at each step
37
+
38
+ This framework democratizes access to advanced agent capabilities, allowing MCP to be used in a wider range of applications and environments.
39
+
40
+ ### Educational Resources
41
+
42
+ Hugging Face has contributed significantly to MCP education through:
43
+
44
+ - **Blog Posts**: In-depth articles explaining MCP concepts and implementations
45
+ - **Tutorials**: Step-by-step guides for building MCP applications
46
+ - **Example Projects**: Ready-to-run examples demonstrating MCP capabilities
47
+ - **Course Materials**: Comprehensive courses like this one that teach MCP from fundamentals to advanced topics
48
+
49
+ These resources have helped create a knowledgeable community of MCP developers who continue to push the boundaries of what's possible with this standard.
50
+
51
+ ## Future Roadmap and Initiatives
52
+
53
+ ### Enhanced MCP Server Registry
54
+
55
+ Hugging Face is developing an enhanced registry for MCP servers with features like:
56
+
57
+ - **Automated Verification**: Ensure servers comply with the MCP specification
58
+ - **Performance Metrics**: Track and compare server performance characteristics
59
+ - **Compatibility Badges**: Indicate compatibility with different MCP versions and features
60
+ - **Usage Analytics**: Provide insights into the most widely used servers and tools
61
+
62
+ This registry will make it easier to discover reliable, high-quality MCP servers for specific use cases.
63
+
64
+ ### MCP Inference API
65
+
66
+ Hugging Face is working on extending their Inference API to support MCP:
67
+
68
+ - **Hosted MCP Servers**: Access popular MCP servers through a managed API
69
+ - **Pay-as-you-go Access**: Use MCP capabilities without managing infrastructure
70
+ - **Enterprise Integrations**: Connect enterprise systems to MCP using secure, managed endpoints
71
+ - **Scalability**: Automatically scale MCP servers based on demand
72
+
73
+ This service will reduce the barrier to entry for organizations wanting to leverage MCP without building and maintaining their own server infrastructure.
74
+
75
+ ### Cross-Framework Compatibility
76
+
77
+ Hugging Face is actively working on ensuring MCP compatibility across different AI frameworks:
78
+
79
+ - **Transformers Integration**: Seamless integration between Transformers models and MCP
80
+ - **PEFT Support**: Use Parameter-Efficient Fine-Tuning with MCP-enabled models
81
+ - **Accelerate Compatibility**: Optimize MCP server performance with Accelerate
82
+ - **Datasets Integration**: Connect MCP servers directly to Hugging Face Datasets
83
+
84
+ These integrations will create a more cohesive ecosystem where MCP can be used with existing Hugging Face tools.
85
+
86
+ ### MCP Standards Contributions
87
+
88
+ Hugging Face is contributing to the MCP specification itself:
89
+
90
+ - **Protocol Extensions**: Proposing enhancements to address limitations and add features
91
+ - **Testing Frameworks**: Developing tools to verify MCP implementation compliance
92
+ - **Reference Implementations**: Creating exemplary implementations of the MCP standard
93
+ - **Community Engagement**: Organizing discussions and feedback on MCP evolution
94
+
95
+ By actively participating in the standardization process, Hugging Face helps ensure MCP remains open, robust, and aligned with real-world needs.
96
+
97
+ ## Case Study: MCP Platform at Scale
98
+
99
+ To illustrate Hugging Face's vision for MCP, let's examine a hypothetical large-scale deployment that leverages their ecosystem:
100
+
101
+ ### Enterprise MCP Platform
102
+
103
+ Consider a large enterprise that has deployed an MCP platform using Hugging Face tools:
104
+
105
+ 1. **MCP Server Hub**: The organization maintains a private hub of MCP servers for different internal systems:
106
+ - Document management system
107
+ - HR records and policies
108
+ - Customer relationship management
109
+ - Financial reporting
110
+ - Product knowledge base
111
+
112
+ 2. **Deployment Infrastructure**:
113
+ - Critical servers run on dedicated infrastructure
114
+ - Less-critical servers are deployed as Spaces
115
+ - Development and testing servers use local deployments with versioning
116
+
117
+ 3. **User Interfaces**:
118
+ - Department-specific dashboards built with Gradio
119
+ - Internal chatbot with access to appropriate MCP servers
120
+ - Integration with existing enterprise applications
121
+
122
+ 4. **Security and Governance**:
123
+ - Centralized authentication and authorization
124
+ - Comprehensive logging and auditing
125
+ - Regular security reviews and updates
126
+
127
+ This platform allows the organization to leverage AI across their operations while maintaining security and governance controls.
128
+
129
+ ## Community Impact and Innovation
130
+
131
+ Hugging Face's contributions to the MCP ecosystem have catalyzed community innovation in several areas:
132
+
133
+ ### Specialized MCP Servers
134
+
135
+ The community has developed specialized MCP servers for various domains:
136
+
137
+ - **Healthcare**: Servers for accessing medical knowledge bases and EHR systems
138
+ - **Legal**: Servers for legal research and document analysis
139
+ - **Education**: Servers for educational content and assessment
140
+ - **Scientific Research**: Servers for accessing research papers and datasets
141
+
142
+ These domain-specific servers extend MCP's utility in specialized fields.
143
+
144
+ ### Multi-Modal MCP
145
+
146
+ Emerging work is expanding MCP beyond text to include:
147
+
148
+ - **Image Processing**: MCP servers for image analysis and generation
149
+ - **Audio Integration**: Servers for speech recognition and audio processing
150
+ - **Video Analysis**: Servers for video content understanding
151
+ - **Multi-Modal Reasoning**: Tools for reasoning across different modalities
152
+
153
+ Hugging Face's support for multi-modal models complements these efforts, creating a richer MCP ecosystem.
154
+
155
+ ## Getting Involved with Hugging Face's MCP Ecosystem
156
+
157
+ There are several ways to participate in and contribute to Hugging Face's MCP ecosystem:
158
+
159
+ 1. **Share Your MCP Servers**: Publish your MCP servers to the Hub for others to use and improve
160
+ 2. **Contribute to Examples**: Add examples and use cases to the documentation
161
+ 3. **Report Issues and Suggestions**: Help identify bugs or suggest improvements
162
+ 4. **Join Community Discussions**: Participate in forum discussions about MCP
163
+ 5. **Create Educational Content**: Share your knowledge through blog posts or tutorials
164
+
165
+ By getting involved, you can help shape the future of MCP and contribute to this growing ecosystem.
166
+
167
+ ## Conclusion
168
+
169
+ Hugging Face's contributions to the MCP ecosystem have significantly accelerated its adoption and development. By providing tools, platforms, and resources for working with MCP, Hugging Face has made it easier for developers to build sophisticated AI applications that leverage external context and tools.
170
+
171
+ As MCP continues to evolve, Hugging Face's ongoing investments in this ecosystem will help ensure it remains open, accessible, and powerful. Whether you're building simple tool integrations or complex agent systems, Hugging Face's MCP resources provide a solid foundation for your projects.
172
+
173
+ In the next section, we'll look more broadly at the future of MCP, including standardization efforts and the roadmap for protocol evolution.
units/en/unit4/introduction.mdx ADDED
@@ -0,0 +1,78 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Advanced Topics, Security, and the Future of MCP
2
+
3
+ Welcome to Unit 4 of the MCP Course! In this final unit, we'll explore advanced topics in Model Context Protocol, dig deep into security considerations, and look toward the future of this evolving standard, with particular attention to Hugging Face's role in shaping the MCP ecosystem.
4
+
5
+ ## What You Will Learn
6
+
7
+ In this unit, you will:
8
+
9
+ * Explore advanced MCP features like roots, streaming, progress reporting, and sampling
10
+ * Understand the security challenges of MCP and learn effective mitigation strategies
11
+ * Analyze the current limitations of MCP and potential solutions
12
+ * Compare MCP with alternative approaches to AI tool integration
13
+ * Examine the future roadmap and standardization efforts for MCP
14
+ * Discover Hugging Face's contributions to the MCP community and ecosystem
15
+ * Apply everything you've learned in a comprehensive final project
16
+
17
+ By the end of this unit, you'll have a sophisticated understanding of MCP's advanced capabilities, security implications, and future direction, positioning you to make informed decisions about implementing and evolving MCP in your own applications.
18
+
19
+ ## Hugging Face's Impact on the MCP Ecosystem
20
+
21
+ Hugging Face has emerged as a significant contributor to the MCP ecosystem, helping to shape its future in several key ways:
22
+
23
+ * **Democratizing Access**: Through the Hugging Face Hub, MCP servers and components are made accessible to a broader developer community
24
+ * **Usability Improvements**: Hugging Face's Gradio integration simplifies the creation of user interfaces for MCP applications
25
+ * **Efficiency Innovations**: Work on Tiny Agents with MCP support enables deployment on a wider range of hardware
26
+ * **Community Building**: Hugging Face Spaces and Forums foster collaboration and knowledge sharing around MCP
27
+ * **Educational Resources**: Comprehensive guides, blog posts, and courses like this one help developers understand and adopt MCP
28
+
29
+ These contributions are helping to accelerate adoption and innovation in the MCP ecosystem, making it more accessible, useful, and robust.
30
+
31
+ ## The Importance of Advanced Understanding
32
+
33
+ As MCP adoption grows, developers and organizations need to move beyond basic implementation to address several critical concerns:
34
+
35
+ * **Security**: Understanding potential vulnerabilities in AI-to-tool integrations is crucial for protecting systems and users from threats like prompt injection, tool poisoning, and data exfiltration.
36
+
37
+ * **Scalability**: Advanced features like streaming, efficient resource handling, and optimized communication protocols become essential as MCP implementations grow in complexity and scale.
38
+
39
+ * **Interoperability**: As the ecosystem of MCP-compatible tools and platforms expands, understanding how MCP compares and interacts with other standards becomes increasingly important.
40
+
41
+ * **Future-Proofing**: Knowledge of the MCP roadmap and standardization efforts helps organizations align their implementations with the likely evolution of the protocol.
42
+
43
+ ## Topics We'll Cover
44
+
45
+ This unit expands your MCP knowledge with these key topics:
46
+
47
+ 1. **Advanced Features**: We'll dive into sophisticated MCP capabilities including:
48
+ - Roots for client-defined operation scopes
49
+ - Streaming for bidirectional, chunked messages
50
+ - Progress reporting for long-running tasks
51
+ - Resource subscriptions for monitoring changes
52
+ - Agent graphs for complex workflows
53
+ - Sampling for server-initiated LLM interactions
54
+
55
+ 2. **Security Deep Dive**: We'll analyze the threat landscape and mitigation strategies, including:
56
+ - Prompt injection and tool poisoning risks
57
+ - Authentication and authorization best practices
58
+ - Input validation and output sanitization
59
+ - Monitoring, logging, and auditability
60
+ - Human-in-the-loop confirmation patterns
61
+
62
+ 3. **Limitations and Comparisons**: We'll examine current limitations of MCP and compare it with alternatives:
63
+ - Authentication maturity challenges
64
+ - Ecosystem reliability considerations
65
+ - Comparison with OpenAPI/Function Calling
66
+ - Contrast with RAG approaches
67
+ - Comparison with agent frameworks like LangChain
68
+
69
+ 4. **Future Roadmap**: We'll look at where MCP is headed:
70
+ - Recent updates and new features
71
+ - Standardization efforts and community contributions
72
+ - Integration with emerging AI capabilities
73
+ - Potential impact on the broader AI ecosystem
74
+ - Hugging Face's roadmap for MCP support
75
+
76
+ 5. **Final Project**: You'll apply everything you've learned in a comprehensive final project, potentially leveraging Hugging Face tools and platforms.
77
+
78
+ Let's dive into these advanced topics and prepare you for the cutting edge of Model Context Protocol implementation and design.