JA

juleswhite/ai-agents-mcp-typescript

开发工具

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

14 stars 20 forks 质量 46 趋势 20

这个寄存器包含了Coursera课程"AI Agents with Model Context Protocol & TypeScript"的代码示例

概览

这个寄存器包含了Coursera课程"AI Agents with Model Context Protocol & TypeScript"的代码示例. - Node.js 18+ - npm - 一个 OpenAI API 密钥(设置在.env文件中) 每个模块都有自己的代码/目录. 要设置任何模块: 模块一是概念入门——没有代码练习. 在每个模块的代码/目录中创建.env文件 :

概述(AI 翻译)

这个寄存器包含了Coursera课程"AI Agents with Model Context Protocol & TypeScript"的代码示例.

□ 先决条件

  • 节点.js 18+
  • 没有
  • OpenAI API 密钥( 设置在 [[T0] 文件)

□ 设置

每个模块都有自己的code/目录. 要设置任何模块:

– – . . .

□ 课程结构和代码映射

QQ单元1:启动AI代理商的示范背景协议

    • 项目 * * * 类型 * * 代码文件 * * |------------. 为什么我们需要模式背景协议? QQ 模式上下文协议和AI问题解决工具QQ视频QQ-QQ MCP允许AI与电脑交流QQ视频-QQ. 爱尔, 我的人工智能工具读取。 校对:Soup
  • 单元1是概念性介绍——没有代码练习。

– – . . .

& 模式背景协议

      • 项目 * * * * 类型 * * 代码文件 * * * 运行命令 * * * 唵(引)|(二合引)贺. QQ 模式上下文协议:语法,语义,定时 QQ 视频 QQ .
  • 示范背景协议和AI代理 * * 视频 * * * * * * * * MCP服务器是什么? • 视频

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

README

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

AI Agents with Model Context Protocol & TypeScript - Code Examples

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

Prerequisites

  • Node.js 18+
  • npm
  • An OpenAI API key (set in .env file)

Setup

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

cd /code
npm install
cp .env.example .env  # Then add your OPENAI_API_KEY

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 01-intro-to-mcp-agents/code/server.ts npm run server
Building Your First MCP AI Agent Ungraded Plugin 01-intro-to-mcp-agents/code/agent.ts``01-intro-to-mcp-agents/code/llm.ts npm run agent
Agents Talking to Tools vs. Tools with AI Video — —

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

Key Files:

Path Description
01-intro-to-mcp-agents/code/server.ts Basic MCP tool server with list_files and read_file tools
01-intro-to-mcp-agents/code/agent.ts Agent loop implementation (PERCEIVE→DECIDE→ACT→OBSERVE)
01-intro-to-mcp-agents/code/llm.ts LLM integration utilities (OpenAI/Anthropic)
01-intro-to-mcp-agents/code/test-server.ts Tests server tools directly without an agent

Commands:

cd 01-intro-to-mcp-agents/code
npm install
npm run server       # Start the basic MCP server
npm run agent        # Run the basic agent
npm run test-server  # 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 01-intro-to-mcp-agents/code/workspace-server.ts npm run workspace-server
Teaching Agents to Seek Help Ungraded Plugin 01-intro-to-mcp-agents/code/workspace-server.ts npm run workspace-server
在 GitHub 查看完整 README

安装

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

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