Azure OpenAI

local-only server

The server can only run on the client’s local machine because it depends on local resources.

Integrations

  • Uses .env configuration for storing Azure OpenAI credentials and settings.

  • References to GitHub repositories for MCP-related projects and resources, including the official MCP Python SDK, server implementations, and community resources.

  • Integrates with Azure OpenAI to provide AI model capabilities. The server implements a bridge that converts MCP responses to the OpenAI function calling format.

使用 Azure OpenAI 的 MCP 服务器和客户端实现

  • 利用模型上下文协议 (MCP) 和 Azure OpenAI 的最小服务器/客户端应用程序实现。
    1. MCP 服务器是用FastMCP构建的。
    2. Playwright是 Microsoft 推出的一个开源、端到端测试框架,用于测试现代 Web 应用程序。
    3. MCP 对工具的响应将转换为 OpenAI 函数调用格式。
    4. 将 MCP 服务器响应转换为 OpenAI 函数调用格式的桥梁定制了MCP-LLM Bridge实现。
    5. 为了确保稳定的连接,服务器对象被直接传递到桥中。

模型上下文协议(MCP)

模型上下文协议 (MCP) MCP(模型上下文协议)是一种开放协议,可实现 AI 应用程序与本地或远程资源之间的安全、受控交互。

官方存储库

社区资源

相关项目

  • FastMCP :构建 MCP 服务器的快速、Python 方式。
  • 聊天 MCP : MCP 客户端
  • MCP-LLM Bridge :MCP 实现,支持 MCP 服务器与 OpenAI 兼容的 LLM 之间的通信

MCP剧作家

配置

在 2024 年 12 月的开发阶段,Python 项目应以“uv”启动。其他依赖管理库,例如“pip”和“poetry”,尚未得到 MCP CLI 的完全支持。

  1. .env.template重命名为.env ,然后在.env中填写 Azure OpenAI 的值:
    AZURE_OPEN_AI_ENDPOINT= AZURE_OPEN_AI_API_KEY= AZURE_OPEN_AI_DEPLOYMENT_MODEL= AZURE_OPEN_AI_API_VERSION=
  2. 安装uv进行 Python 库管理
    pip install uv uv sync
  3. 执行python chatgui.py
    • 示例屏幕显示客户端启动浏览器导航到 URL。

相对于‘stdio’

stdio传输层(原始数据流),而JSON-RPC应用协议(结构化通信)。它们之间有区别,但经常互换使用,例如,在协议中,“JSON-RPC over stdio”。

工具描述

@self.mcp.tool() async def playwright_navigate(url: str, timeout=30000, wait_until="load"): """Navigate to a URL.""" -> This comment provides a description, which may be used in a mechanism similar to function calling in LLMs. # Output Tool(name='playwright_navigate', description='Navigate to a URL.', inputSchema={'properties': {'url': {'title': 'Url', 'type': 'string'}, 'timeout': {'default': 30000, 'title': 'timeout', 'type': 'string'}

提示:紫外线

uv run: Run a script. uv venv: Create a new virtual environment. By default, '.venv'. uv add: Add a dependency to a script uv remove: Remove a dependency from a script uv sync: Sync (Install) the project's dependencies with the environment.

提示

  • python.exe 的 taskkill 命令
taskkill /IM python.exe /F
  • 可视化代码:Python 调试器:使用 launch.json 进行调试将使用 .vscode/launch.json 中的配置启动调试器。
-
security - not tested
A
license - permissive license
-
quality - not tested

利用模型上下文协议 (MCP) 和 Azure OpenAI 的最小服务器/客户端应用程序实现。

  1. Model Context Protocol (MCP)
    1. Official Repositories
    2. Community Resources
    3. Related Projects
    4. MCP Playwright
    5. Configuration
    6. w.r.t. 'stdio'
    7. Tool description
    8. Tip: uv
    9. Tip
ID: ta21762xc9