Token导航 LogoToken导航TokenDH.com
Msgraph MCP Client logo
文档知识stdio官方级别未说明来源级核验

Msgraph MCP Client

MCP Server

基于FastAgent的对话AI助手,通过MCP服务器连接外部工具和服务,用于智能问答、文件访问和文档查询等场景。

工具数

0

提示词数

0

GitHub Stars

0

资源数

0
Python文档查询文档处理

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

作者 / 组织

AlexandreFenneteau

提供方

AlexandreFenneteau

最后核验

2026/5/17 20:21

运行时

Python

快速接入

先看主来源和安装命令,再打开仓库或文档;下面只保留这个条目的关键接入事实。

命令预览

uv run agent.py

详细介绍

FastAgent MCP客户端

基于FastAgent的会话代理客户端,连接到MCP(模型上下文协议)服务器以访问外部工具和服务。

🎯 这个项目是什么?

该项目创建了一个会话式AI助手,可以:

  • 聪明地回答问题
  • 通过MCP服务器使用外部工具
  • 连接到Microsoft学习、文件系统和其他服务
  • 维护对话历史记录

🏗️ 建筑

mcp_client/
├── agent.py                    # Main agent entry point
├── fastagent.config.yaml       # Public configuration (models, MCP servers)
├── fastagent.secrets.yaml      # API keys and secrets (not versioned)
├── fastagent.jsonl            # Debug logs in JSON format
├── pyproject.toml             # Python dependencies
└── uv.lock                    # Version lock file

🚀 安装和配置

先决条件

  • Python 3.12+
  • UV(Python包管理器)
  • Azure OpenAI API密钥

1.安装依赖项

uv sync

2.Azure OpenAI配置

复制 example.fastagent.secrets.yamlfastagent.secrets.yaml 并对其进行修改:

cp example.fastagent.secrets.yaml fastagent.secrets.yaml

然后编辑 fastagent.secrets.yaml 使用您的信息(Azure示例):

azure:
  api_key: "YOUR_AZURE_API_KEY"
  base_url: "https://your-resource.openai.azure.com/"
  azure_deployment: "gpt-5-chat"
  api_version: "2025-04-01-preview"

3.MCP服务器配置

fastagent.config.yaml 文件定义了可用的MCP服务器:

当前配置的服务器:

1. 文件系统服务器 (文件访问)

filesystem:
  command: "npx"
  args: ["-y", "@modelcontextprotocol/server-filesystem", "."]

允许代理读取/写入本地文件。

2. 获取服务器 (网络请求)

fetch:
  command: "uvx"
  args: ["mcp-server-fetch"]

允许代理发出HTTP请求。

3. 微软学习 (文件)

mslearn:
  transport: "http"
  url: "https://learn.microsoft.com/api/mcp"

访问Microsoft文档。

4. 自定义MSGraph MCP服务器

MSGraph服务器安装:

  1. 克隆MSGraph MCP服务器存储库:
git clone https://github.com/AlexandreFenneteau/MSGraph-MCP-server.git
cd MSGraph-MCP-server
uv sync
  1. 按照MSGraph MCP项目README中的安装和配置说明进行操作。
  1. 在中配置服务器 fastagent.config.yaml 通过替换路径:
test:
  command: "uv"
  args: [
    "--directory",
    "C:\\path\\to\\MSGraph-MCP-server",  # Replace with your path
    "run",
    "src\\msgraph_mcp\\main.py"
  ]

此自定义MCP服务器允许与Microsoft Graph交互(读取电子邮件+日历事件)。

4.启动代理

uv run agent.py

💡 使用示例

示例1:基本对话

You: Hello, can you help me with Azure?
Agent: Hello! I can help you with Azure. I can consult Microsoft Learn documentation, answer your questions about Azure services, or help with specific configurations. What would you like to know?

示例2:工具使用

You: Can you find me information about Azure Functions?
Agent: [The agent uses the Microsoft Learn server to search for information]
Here's the information about Azure Functions I found...

示例3:模型更改

# Use a different model
uv run agent.py --model=haiku

🔍 调试和监控

调试日志

日志会自动写入 fastagent.jsonl:

{"level":"ERROR","timestamp":"2025-08-20T14:41:49.636487","namespace":"mcp_agent.mcp.mcp_connection_manager","message":"test: Lifecycle task encountered an error"}

日志配置

在……里面 fastagent.config.yaml:

logger:
  progress_display: true    # Show progress
  show_chat: true          # Show chat messages
  show_tools: true         # Show tool calls
  truncate_tools: true     # Truncate long responses

⚙️ 定制

修改代理指令

在……里面 agent.py:

instructions = """
You are a helpful assistant.
Your goal is to answer user questions accurately with the help of your tools when needed.
"""

添加新的MCP服务器

在……里面 fastagent.config.yaml:

mcp:
  servers:
    my_server:
      command: "python"
      args: ["path/to/my_server.py"]
      env:
        API_KEY: "my_api_key"

然后在 agent.py:

@fast.agent(
    servers=["test", "mslearn", "my_server"],  # Add the new server
    # ... other parameters
)

🚨 常见问题

1.MCP连接错误

症状:中的错误 fastagent.jsonl 解决方案:验证外部服务器是否可用以及路径是否正确

2.Azure身份验证错误

症状:401启动时出错 解决方案:检查中的API密钥 fastagent.secrets.yaml

3.找不到外部服务器

症状:“测试”服务器上出错 解决方案:验证 msgraph_mcp 项目存在于指定的路径中

🔐 安全

  • ⚠️ 永不承诺 fastagent.secrets.yaml (已在 .gitignore)
  • 在生产环境中为敏感密钥使用环境变量
  • 在添加MCP服务器权限之前,请先检查它们

📚 资源

🤝 贡献

  1. 分叉项目
  2. 为您的功能创建分支
  3. 测试您的更改
  4. 创建拉取请求

______________________________________________________________________

目录标签

目录标签

Python文档查询文档处理对话AI本地部署外部工具集成智能问答文件访问

接入字段

传输方式(transport,传输协议)

stdio

鉴权方式(authType,认证方式)

none

运行时(runtime,运行环境)

Python

工具数量(toolCount,工具数)

0

资源数量(resourceCount,资源数)

0

提示词数量(promptCount,提示词数)

0

权限和风险

stdionone部署方式未说明

接入前请确认传输方式、认证方式和部署位置,并根据实际工具能力限制访问范围。

安装前确认

不要直接授予不必要的文件、网络或账号权限;先核对安装命令和配置内容。

来源信息

继续浏览同类 MCP