JP

juleswhite/python-agents-mcp-course

开发工具

本页由 AI 翻译,技术细节请以原文为准。 查看原文

42 stars 61 forks 质量 46 趋势 12

juleswhite/python-agents-mcp-course 是从 https://github.com/juleswhite/python-agents-mcp-course. 导入的 MCP 服务器候选

概览

juleswhite/python-agents-mcp-course 是从 https://github.com/juleswhite/python-agents-mcp-course. 导入的 MCP 服务器候选

概述(AI 翻译)

本仓库包含了Coursera课程《带模型上下文协议的AI代理》的Python代码示例。

先修条件

  • Python 3.10+
  • PIP
  • 来自 OpenAI、Anthropic 或 Google 的 API 密钥(设置在 .env 文件中)

布置

每个模块都有自己的 python-code/ 目录。要设置任意模块:


课程结构与代码映射

模块1:AI代理模型上下文协议(MCP)入门

物品 类型 代码文件
为什么我们需要模型上下文协议? 视频 —
模型上下文协议与人工智能问题解决工具 视频 —
MCP 允许 AI 与计算机通信 视频 —
AI @ Work - 我与AI的工作是什么样子 视频 —
我的人工智能工具 阅读 —
了解更多与保持联系 阅读 —

模块1为概念介绍——无代码练习。


模块2:AI代理循环与模型上下文协议

物品 类型 代码文件 运行命令
模型上下文协议:语法、语义、时序 视频 — —
模型上下文协议与人工智能代理 视频 — —
什么是MCP服务器? 视频 — —

本页由 AI 翻译,技术细节请以原文为准。

README

以下为原文 README 节选,完整内容请查看原文。

AI Agents with Model Context Protocol - Python Code Examples

This repository contains Python code examples for the Coursera course “AI Agents with Model Context Protocol.”

Prerequisites

  • Python 3.10+
  • pip
  • An API key from OpenAI, Anthropic, or Google (set in .env file)

Setup

Each module has its own python-code/ directory. To set up any module:

cd /python-code
pip install -r requirements.txt
cp .env.example .env  # Then add your API key(s)

Course Structure & Code Mapping

Module 1: Getting Started with Model Context Protocol (MCP) for AI Agents

Item Type Code Files
Why Do We Need Model Context Protocol? Video —
Model Context Protocol & AI Problem Solving with Tools Video —
MCP Allows AI to Communicate with the Computer Video —
AI @ Work - What My Work with AI Looks Like Video —
My AI Tools Reading —
Learning More & Staying Connected Reading —

Module 1 is conceptual introduction — no code exercises.


Module 2: AI Agent Loops & Model Context Protocol

Item Type Code Files Run Command
Model Context Protocol: Syntax, Semantics, Timing Video — —
Model Context Protocol & AI Agents Video — —
What is an MCP Server? Video — —
Tool Specifications Video — —
Building Your First MCP Server Ungraded Plugin server.py python server.py
Building Your First MCP AI Agent Ungraded Plugin agent.py, llm.py python agent.py "question"
Agents Talking to Tools vs. Tools with AI Video — —

Code Location: 01-intro-to-mcp-agents/python-code/

Key Files:

File Description
server.py Basic MCP tool server with list_files and read_file tools
agent.py Agent loop implementation (PERCEIVE→DECIDE→ACT→OBSERVE)
llm.py LLM integration utilities (OpenAI/Anthropic/Gemini)
test_server.py Tests server tools directly without an agent
server_with_resources.py Server with MCP resources for teaching agents
agent_with_learning.py Agent that reads resources before acting

Commands:

cd 01-intro-to-mcp-agents/python-code
pip install -r requirements.txt
python server.py              # Start the basic MCP server
python agent.py "question"    # Run the basic agent
python test_server.py         # Test server tools directly

Module 3: Building AI Agents with Model Context Protocol

Item Type Code Files Run Command
Resources Video — —
Teaching Agents to Use Tools Ungraded Plugin workspace_server.py python workspace_server.py
Teaching Agents to Seek Help Ungraded Plugin workspace_server.py python workspace_server.py
在 GitHub 查看完整 README

安装

This server does not publish a one-line install command.

Open the repository installation guide 新手?先看 mcpskill.org 教程 →