
一个演示项目,展示了使用 FastMCP 实现模型上下文协议(MCP),示例了 stdio 和 HTTP 传输,与 LangChain 和 Agent Framework 的集成,以及......
概览
这是一个演示项目,展示了使用 FastMCP 实现模型上下文协议(MCP),示例包括 stdio 和 HTTP 传输、与 LangChain 和 Agent Framework 的集成,以及部署到 Azure 容器应用。 你有几个设置这个项目的选项。最快的入门方式是GitHub Codespaces,因为它会帮你设置所有工具,但你也可以本地搭建。 您可以通过GitHub Codespaces虚拟运行该项目。点击下方按钮之一,在浏览器中打开基于网页的VS Code实例: Ollama Codespace 预装 Ollama 并拉取 gemma4:e2b 模型,并将 .env.sample.ollama 复制为你的 .env 文件。注意 64GB 内存需求会更快消耗你的 Codespace 配额。 代码空间打开后,打开终端窗口并继续执行部署步骤。 一个相关的选项是VS Code Dev Containers,它会通过Dev Containers扩展在本地VS Code中打开项目: 1.
概述(AI 翻译)
这是一个演示项目,展示了使用 FastMCP 实现模型上下文协议(MCP),示例包括 stdio 和 HTTP 传输、与 LangChain 和 Agent Framework 的集成,以及部署到 Azure 容器应用。
目录
- 开始
- GitHub代码空间
- VS Code 开发容器
- 局部环境
- 运行本地MCP服务器
- 与GitHub Copilot一起使用
- 使用VS代码调试
- 使用 MCP 检查器进行检查
- 使用 Aspire 仪表盘查看跟踪
- 运行本地代理MCP
- 部署到 Azure
- 部署到带有私有网络的 Azure
- 部署到 Azure 并使用 Keycloak 认证
- 使用 Entra OAuth 代理部署到 Azure
- 资源
开始
你有几个设置这个项目的选项。最快的入门方式是GitHub Codespaces,因为它会帮你设置所有工具,但你也可以本地搭建。
GitHub 代码空间
您可以通过GitHub Codespaces虚拟运行该项目。点击下方按钮之一,在浏览器中打开基于网页的VS Code实例:
Default (Azure OpenAI):
Ollama(本地型号,需要64GB+内存):
本页由 AI 翻译,技术细节请以原文为准。
README
以下为原文 README 节选,完整内容请查看原文。
Python MCP Demo
A demonstration project showcasing Model Context Protocol (MCP) implementations using FastMCP, with examples of stdio and HTTP transports, integration with LangChain and Agent Framework, and deployment to Azure Container Apps.
Table of Contents
- Getting started
- Run local MCP servers
- Run local Agents MCP
- Deploy to Azure
- Deploy to Azure with private networking
- Deploy to Azure with Keycloak authentication
- Deploy to Azure with Entra OAuth Proxy
- Resources
Getting started
You have a few options for setting up this project. The quickest way to get started is GitHub Codespaces, since it will setup all the tools for you, but you can also set it up locally.
GitHub Codespaces
You can run this project virtually by using GitHub Codespaces. Click one of the buttons below to open a web-based VS Code instance in your browser:
Default (Azure OpenAI):
Ollama (local models, requires 64GB+ memory):
The Ollama Codespace pre-installs Ollama and pulls the gemma4:e2b model, and copies .env.sample.ollama as your .env file. Note that the 64GB memory requirement will consume your Codespace quota faster.
Once the Codespace is open, open a terminal window and continue with the deployment steps.
VS Code Dev Containers
A related option is VS Code Dev Containers, which will open the project in your local VS Code using the Dev Containers extension:
安装
npx @modelcontextprotocol/inspector uv run servers/basic_mcp_stdio.py