AI代理MCP客户端构建器

该示例演示如何构建一个作为MCP客户端的人工智能代理,通过内置OAuth流程连接远程MCP服务器,发现并使用其暴露的工具,适用于在Cloudflare Workers中集成外部AI服务。

  • by PcnaidInc
  • TypeScript
  • 本地部署
  • 更新于
在 GitHub 查看 PcnaidInc/mcp-client

使用说明

Build an AI Agent that acts as an MCP Client

An example of how to build an Agent that acts as an MCP Client, so that it can connect to external services via MCP.

This demo showcases how to:

  • Connect an AI agent to a remote MCP server
  • Handle authentication check using the built-in OAuth flow
  • Discover and use tools exposed by remote MCP servers

Learn more

Instructions

First, start an MCP server. A simple example can be found in examples/mcp, which already has valid binding setup.

npm install
npm start

Tap "O + enter" to open the front end. It should list out all the tools, prompts, and resources available.

CI

The .github/workflows/ci.yml workflow runs on pull requests and pushes to main. It installs dependencies with npm ci and runs npm run type-check and npm run build.