شعار MCP Server & Client w/ Azure OpenAI & OpenAI

MCP Server & Client w/ Azure OpenAI & OpenAI

المجتمع
kimtth

A minimal Model Context Protocol 🖥️ server/client🧑‍💻with OpenAI and 🌐 web browser control via Playwright.

الناشرkimtth
المستودعmcp-aoai-web-browsing
اللغةPython
التفريعات
14
النجوم
35
الأدوات المتاحة
0
نوع نقل البياناتstdio
الفئات
الترخيصMIT
الروابط
  • اربط الأدوات بمسارات عمل الذكاء الاصطناعي

    يتيح MCP Server & Client w/ Azure OpenAI & OpenAI إمكانات MCP لتطبيقات الذكاء الاصطناعي العميلة المتوافقة معه، وكذلك لوكلاء الذكاء الاصطناعي المتوافقين معه.

  • الأدوات المتاحة: 0

    تصفّح الإجراءات القابلة للاستدعاء أدناه، بما في ذلك أسماؤها وأوصافها عندما يوفّرها الخادم.

  • إعدادات جاهزة للنسخ

    استخدم مقتطفات التثبيت لتهيئة هذا الخادم في تطبيق MCP العميل المفضّل لديك.

  • مؤشرات اهتمام المجتمع بالمستودع مفتوح المصدر

    إحصاءات المستودع المرتبط: النجوم: 35، والتفريعات: 14.

MCP in Practice: Web Browsing, Protocols, and Apps

A Playwright browsing application with Azure OpenAI/OpenAI, plus focused examples of MCP v1/v2, OAuth, and interactive MCP Apps.

  1. Original browsing application — Azure OpenAI/OpenAI integration, setup and client connections.
  2. MCP v1 and v2 samples — browser tools and local OAuth flows.
  3. MCP Apps samples — interactive tool-response UIs built with Prefab.

1. Web browsing MCP application

A local browsing application with a Tkinter chat UI and an MCP-to-LLM bridge.

  • The original server uses the standalone fastmcp package; Playwright controls a visible Chromium browser and keeps the current page between tool calls.
  • The local client_bridge implementation adapts MCP tool definitions to OpenAI Chat Completions function calling. It supports an in-process FastMCP server or an external stdio server.
  • The GUI uses Azure OpenAI. Python callers can configure the bridge for standard OpenAI, but the original browser server separately initializes its own Azure client for the selector-extraction tool.

Setup and run

Requirements: Python 3.13 or newer, Tkinter, a graphical desktop session, and uv. The commands below use uv to manage this project's environment; MCP itself does not require a particular Python package manager. Run them from the repository root.

  1. Copy .env.template to a local .env file, keeping the template intact. Configure an existing Azure OpenAI deployment that supports Chat Completions tool calling:

    dotenv
    AZURE_OPEN_AI_ENDPOINT=
    AZURE_OPEN_AI_API_KEY=
    AZURE_OPEN_AI_DEPLOYMENT_MODEL=
    AZURE_OPEN_AI_API_VERSION=

    The API version is needed for the legacy Azure endpoint, not the /openai/v1 path described below. Keep .env out of source control; it is gitignored.

  2. Install the Python dependencies and the Chromium browser binary:

    bash
    uv sync
    uv run playwright install chromium

    On Linux, Playwright may also require system dependencies; see its installation guide. Tkinter must be available in the selected Python installation.

  3. Launch the GUI in the project environment:

    bash
    uv run python chatgui.py

The root dependency declarations use minimum versions, not compatibility caps. The inspected environment uses FastMCP 3.2.0 and MCP SDK 1.27.0; this is not a guarantee that a fresh resolution of newer major versions will work. Keep the learning samples in their separate environments.

Azure v1 endpoint and model parameters

For an endpoint ending in /openai/v1, set AZURE_OPEN_AI_ENDPOINT to the full URL and AZURE_OPEN_AI_DEPLOYMENT_MODEL to an existing deployment name. This path uses the OpenAI-compatible client and does not require an API version. Use AZURE_OPEN_AI_API_KEY, or supply a short-lived Entra token through the process environment variable AZURE_OPENAI_AD_TOKEN when the key is unset. Tokens are not refreshed automatically; renew them before launching and never commit them to a file.

Using with External Clients

External clients start the original server over stdio. Complete the setup above first. The server loads the repository's .env and still requires Azure configuration at startup, even if the host uses a different model provider. Do not put credentials in shared MCP JSON configuration.

Claude Desktop / Claude Code

  • Claude Desktop: open Settings > Developer > Edit Config to edit claude_desktop_config.json, following the local-server guide.
  • Claude Code: add the entry to .mcp.json at the project root for project scope, not .claude/mcp.json. Local and user scopes are managed separately by Claude Code.

Merge this entry into the existing configuration. Replace the directory with the absolute repository path (Windows paths can use forward slashes). Using uv's --directory avoids relying on a client-specific cwd field.

json
{
  "mcpServers": {
    "browser-navigator": {
      "command": "uv",
      "args": ["--directory", "/path/to/mcp-aoai-web-browsing", "run", "fastmcp", "run", "server/browser_navigator_server.py:app", "--transport", "stdio"]
    }
  }
}

If the desktop client cannot find uv, set command to its absolute executable path. Restart Claude Desktop after saving; in Claude Code, review project-server approval and connection status with /mcp.

VS Code

Merge into .vscode/mcp.json in your workspace, following the VS Code MCP configuration reference:

json
{
  "servers": {
    "browser-navigator": {
      "type": "stdio",
      "command": "uv",
      "args": ["run", "fastmcp", "run", "server/browser_navigator_server.py:app", "--transport", "stdio"],
      "cwd": "${workspaceFolder}",
      "envFile": "${workspaceFolder}/.env"
    }
  }
}

Use MCP: List Servers to start the server and inspect its output. Review the server trust prompt before enabling tools.

Using the Bridge Programmatically

Connecting over stdio

Run this example from the repository root. The bridge handles the model loop; the child server independently loads its Azure settings from the local .env.

python
import asyncio

from client_bridge import BridgeConfig, MCPServerConfig, BridgeManager
from client_bridge.llm_config import get_default_llm_config

config = BridgeConfig(
    server_config=MCPServerConfig(
        command="uv",
        args=["run", "fastmcp", "run", "server/browser_navigator_server.py:app", "--transport", "stdio"],
    ),
    llm_config=get_default_llm_config(),
    system_prompt="You are a helpful assistant.",
)

async def main():
  async with BridgeManager(config) as bridge:
    response = await bridge.process_message("Navigate to https://example.com")
    print(response)


if __name__ == "__main__":
  asyncio.run(main())

Using Standard OpenAI (non-Azure)

To use OpenAI for the bridge's model loop, replace the config construction in the example above with the following. The helper reads process environment variables; call load_dotenv() explicitly if using a local .env.

python
from dotenv import load_dotenv

from client_bridge.llm_config import get_openai_llm_config

load_dotenv()
llm_config = get_openai_llm_config()
# Set these explicitly to values supported by the chosen model.
llm_config.token_limit_parameter = "max_completion_tokens"
llm_config.temperature = None

config = BridgeConfig(
  server_config=MCPServerConfig(
    command="uv",
    args=["run", "fastmcp", "run", "server/browser_navigator_server.py:app", "--transport", "stdio"],
  ),
  llm_config=llm_config,
)

Set OPENAI_API_KEY and OPENAI_MODEL to your credentials and a model supporting Chat Completions tool calling. The OpenAI helper defaults to max_tokens and temperature 0.7; unlike the Azure helper, it does not read the OPENAI_TOKEN_LIMIT_PARAMETER or OPENAI_TEMPERATURE environment variables. The example overrides those defaults explicitly; adjust them for your model.

This does not switch the GUI or the original server's selector-extraction client to OpenAI. Using the original server still requires the Azure settings from setup. The independent learning servers do not have that dependency.

Direct Tool Execution

Inside an async function with a configured config, the bridge exposes tool metadata and direct execution for clients that manage their own LLM loop:

python
async with BridgeManager(config) as bridge:
    tools = bridge.get_tools()  # OpenAI function calling format
    result = await bridge.execute_tool("playwright_navigate", {"url": "https://example.com"})

2. MCP v1 and v2 samples

Independent introductory examples, separate from the original application above. Each folder has its own dependencies; use its README's directory-scoped commands from the repository root rather than upgrading the root environment. No LLM API key is needed for these samples.

SampleWhat it demonstrates
MCP v1 — Browser toolsRead a page or capture a screenshot with Playwright; observe explicit MCP initialization and session handling over HTTP.
MCP v2 — Browser toolsThe same browser operations with explicitly selected newer protocol mode.
MCP v2 — Local OAuthObtain a token before calling a protected browser tool; explore issuer validation and PKCE with a local authorization fixture. Includes an SDK-independent lab; real SDK integration remains unverified.

Specification references

The folder labels v1 and v2 are repository shorthand for the two protocol revisions compared here, not official MCP major-version names. Python SDK versions and protocol dates are separate:

  • Core MCP 2025-11-25 defines client/server communication, including initialization and version negotiation. The browser sample calls initialize() rather than hard-coding a protocol date. In the v1 browser sample's pinned mcp==1.27.0 environment, the latest supported version is 2025-11-25, and negotiation to that version has been confirmed at runtime.
  • Core MCP 2026-07-28 is the core specification targeted by the newer browser and OAuth samples. Their clients explicitly set mode="2026-07-28" rather than calling the earlier initialize() API. This is the intended protocol path in the code, not a verified integration result.

3. MCP Apps samples

MCP Apps add interactive UI resources and host-mediated interaction on top of core MCP. They are an optional extension, not an SDK v2-only feature. These independent samples need no LLM API key; follow each guide's setup commands.

SampleWhat it demonstrates
Reactive reading cardReturn a Prefab reading card whose input and reset actions update client-side state without further tool calls.
Browser panelUse an interactive button to call a Playwright tool and display its page text and screenshot inside an Apps-capable host.

Specification and host requirements

The official Apps overview links to the 2026-01-26 Apps specification. These examples use FastMCP 3.2.0, Prefab 0.20.2 and MCP SDK 1.27.0.

The official client support matrix tracks host support. The Apps overview lists Claude Desktop and VS Code GitHub Copilot among supported clients; that does not establish that these particular Prefab samples have been verified in either host. The original Tkinter GUI is not an MCP Apps host.

Sample screenshots

Standalone Prefab previews, not MCP chat-host captures. The browser result was generated by a real local Playwright call and rendered separately.

Reactive MCP App previewLocal Playwright result preview

See the Apps sample guides for the full images and preview limitations. No screenshots are presented as evidence of the unverified SDK v2 integration.

Protocol and tool notes

stdio and JSON-RPC

stdio is the local process transport; JSON-RPC 2.0 defines the message format. MCP runs JSON-RPC messages over transports such as stdio or Streamable HTTP. For stdio servers, stdout must contain only protocol messages; diagnostics belong on stderr. A Python dictionary printed to stdout is not an MCP notification.

Tool description

FastMCP derives a tool's description from its Python docstring and its input schema from the function signature. In the original server, playwright_navigate uses the docstring "Navigate to a URL." The bridge maps that metadata into an OpenAI function-tool definition. Inspect tools/list for the actual schema; unannotated parameters should not be assumed to have inferred numeric types.

References

Model Context Protocol (MCP)

Model Context Protocol (MCP) is an open protocol connecting AI applications to tools, resources, and prompts. Authentication, consent, and access control still need to be implemented by the application and host.

Official documentation and repositories

Related Projects

  • FastMCP: standalone Python MCP framework; formerly hosted under jlowin.
  • Chat MCP: MCP client
  • MCP-LLM Bridge: archived upstream project referenced by this repository's local bridge implementation, not an installed dependency.

MCP Playwright

Community Resources

Development tips

uv commands

uv run: Run a command or script in the project environment.
uv venv: Create a new virtual environment. By default, '.venv'.
uv add: Add a project dependency; use --script for inline script metadata.
uv remove: Remove a project dependency; use --script for inline script metadata.
uv sync: Synchronize the project environment with the lockfile (updating it if needed).

Process cleanup and debugging

  • Close the GUI normally, stop a terminal-launched process with Ctrl+C, or stop a client-managed server through that client's MCP controls. If a process hangs, identify and terminate only its PID; do not kill every Python process.
  • In Visual Studio Code, select the project environment and use the Python Debugger extension with a launch configuration for the GUI. See the Python debugging guide.

التثبيت

TypingMind
المتطلبات المسبقة:

Node.js 18+

{
  "mcpServers": {
    "kimtth-mcp-aoai-web-browsing": {
      "command": "",
      "args": []
    }
  }
}

استخدم MCP الخاص بـ MCP Server & Client w/ Azure OpenAI & OpenAI مع نماذج ذكاء اصطناعي متعددة

يربط TypingMind أدوات MCP على مستوى مساحة العمل، لذا بمجرد توصيل MCP Server & Client w/ Azure OpenAI & OpenAI، يمكنك استخدامه مع نماذج ذكاء اصطناعي مختلفة في TypingMind بدلًا من إعداده لكل نموذج على حدة. يعمل تكامل MCP هذا محليًا عبر موصل MCP الخاص بـ TypingMind على جهازك.

دليل الإعداد لاستخدام الموصل المحلي

استخدم هذا الخيار عندما يحتاج خادم MCP إلى الوصول إلى ملفات محلية أو تطبيقات أو موارد خاصة على جهاز الكمبيوتر لديك.

1

فتح إعدادات MCP

في TypingMind، انتقل إلى «الإعدادات»، ثم «الإعدادات المتقدمة»، ثم «بروتوكول سياق النموذج»، واختر «إعداد الموصل».

  1. افتح TypingMind في متصفحك.
  2. انقر على أيقونة الإعدادات.
  3. انتقل إلى الإعدادات المتقدمة.
  4. افتح قسم بروتوكول سياق النموذج.
  5. انقر على «إعداد الموصل» واختر «هذا الجهاز».
شاشة إعداد موصل MCP في TypingMind مع تحديد «هذا الجهاز»
2

تنفيذ أمر الموصل

اختر «هذا الجهاز»، وانسخ الأمر من TypingMind وشغّله في Terminal. أبقِ العملية قيد التشغيل أثناء استخدام MCP.

  1. انسخ أمر الإعداد الذي يعرضه TypingMind.
  2. افتح Terminal على macOS أو Windows Terminal على Windows.
  3. الصق الأمر ونفّذه.
  4. وافق على تثبيت الحزمة إذا طلب منك Terminal تأكيد المتابعة.
  5. أبقِ نافذة Terminal مفتوحة واترك العملية قيد التشغيل أثناء استخدام أدوات MCP.
3

إضافة MCP Server & Client w/ Azure OpenAI & OpenAI كخادم

عندما تظهر حالة الموصل «جاهز»، انقر على «تعديل الخوادم» والصق إعدادات خادم MCP.

  1. انتظر حتى تظهر حالة الموصل «جاهز».
  2. انقر على «تعديل الخوادم».
  3. الصق إعدادات خادم MCP الخاص بـ MCP Server & Client w/ Azure OpenAI & OpenAI.
  4. احفظ قائمة الخوادم.
  5. حدّث الحالة إذا أردت التأكد من أن الموصل لا يزال جاهزًا.
إعدادات MCP في TypingMind تعرض خادمًا نشطًا وزر «تعديل الخوادم»
{
  "mcpServers": {
    "kimtth-mcp-aoai-web-browsing": {
      "command": "npx",
      "args": [
        "-y",
        "mcp-aoai-web-browsing"
      ]
    }
  }
}
4

استخدام الاتصال مع نماذج مختلفة

احفظ قائمة الخوادم، وافتح «الإضافات»، وفعّل أدوات MCP الخاصة بـ MCP Server & Client w/ Azure OpenAI & OpenAI، ثم اختر أي نموذج ذكاء اصطناعي مدعوم في TypingMind واستخدم الأدوات في المحادثة أو أسندها إلى وكيل ذكاء اصطناعي.

  1. افتح صفحة الإضافات في TypingMind.
  2. فعّل أدوات MCP الخاصة بـ MCP Server & Client w/ Azure OpenAI & OpenAI.
  3. ابدأ محادثة واختر نموذج الذكاء الاصطناعي الذي تريد استخدامه.
  4. استخدم أدوات MCP في المحادثة أو عيّنها لوكيل ذكاء اصطناعي.
  5. انتقل إلى نموذج ذكاء اصطناعي آخر عند الحاجة دون إعادة الاتصال بـ MCP.
محادثة في TypingMind تستخدم أدوات MCP المفعّلة مع نموذج ذكاء اصطناعي محدّد
هل يمكنك استخدام MCP Server & Client w/ Azure OpenAI & OpenAI لمساعدتي في هذه المهمة؟
MCP Server & Client w/ Azure OpenAI & OpenAI
بالتأكيد. قرأته.
إليك ما وجدته باستخدام MCP Server & Client w/ Azure OpenAI & OpenAI.

الأسئلة الشائعة

ما استخدامات خادم MCP MCP Server & Client w/ Azure OpenAI & OpenAI؟

MCP Server & Client w/ Azure OpenAI & OpenAI هو خادم MCP يتيح لتطبيقات الذكاء الاصطناعي المتوافقة الاتصال بأدوات ومصادر سياق خارجية. في TypingMind، يمكنك إضافة خادم MCP هذا مرة واحدة وإتاحة أدواته في مساحة عملك للذكاء الاصطناعي.

هل يمكنني استخدام خادم MCP MCP Server & Client w/ Azure OpenAI & OpenAI مع نماذج ذكاء اصطناعي متعددة في TypingMind؟

نعم. يربط TypingMind أدوات MCP على مستوى مساحة العمل، لذا يمكنك استخدام MCP Server & Client w/ Azure OpenAI & OpenAI مع نماذج ذكاء اصطناعي مختلفة مثل Claude أو ChatGPT أو Gemini أو غيرها من النماذج التي أعددتها في TypingMind، دون إعداد خادم MCP لكل نموذج على حدة.

لماذا تستخدم خادم MCP MCP Server & Client w/ Azure OpenAI & OpenAI مع TypingMind؟

يُعد TypingMind من أفضل واجهات المحادثة مع النماذج اللغوية الكبيرة، إذ يجمع نماذج ذكاء اصطناعي متعددة ومطالبات وإضافات ووكلاء ذكاء اصطناعي ومفاتيح API وأدوات MCP في مساحة عمل واحدة. بعد توصيل MCP Server & Client w/ Azure OpenAI & OpenAI، يمكنك استخدام أدوات MCP الخاصة به عبر نماذجك المفضلة مع الحفاظ على سير عمل محادثاتك منظمًا في TypingMind.

كيف أوصّل خادم MCP MCP Server & Client w/ Azure OpenAI & OpenAI بـ TypingMind؟

يعمل MCP Server & Client w/ Azure OpenAI & OpenAI عبر موصل MCP المحلي في TypingMind. هذا هو الخيار الأنسب عندما يحتاج خادم MCP إلى الوصول إلى ملفات محلية أو تطبيقات سطح المكتب أو أدوات سطر الأوامر أو موارد خاصة على حاسوبك.

ما الأدوات التي يوفّرها خادم MCP MCP Server & Client w/ Azure OpenAI & OpenAI في TypingMind؟

يتيح MCP Server & Client w/ Azure OpenAI & OpenAI إمكانات MCP يمكنك تفعيلها من صفحة الإضافات في TypingMind واستخدامها في المحادثات أو تعيينها لوكلاء ذكاء اصطناعي.

هل أحتاج إلى مشاركة مفاتيح API الخاصة بي مع TypingMind لاستخدام خادم MCP MCP Server & Client w/ Azure OpenAI & OpenAI؟

لا. يعطي TypingMind الأولوية للعمل المحلي ويتيح لك التحكم بنفسك في مزوّدي النماذج ومفاتيح API والمطالبات وإعدادات MCP. إذا كان MCP Server & Client w/ Azure OpenAI & OpenAI يتطلب مصادقة، فأضف الترويسات أو إعدادات OAuth أو الإعدادات المحلية المطلوبة لخادم MCP هذا عند إنشاء الاتصال.

خوادم MCP ذات صلة

عرض الكل

أنشئ مساحة عملك للذكاء الاصطناعي الآن

اشترك في نشرتنا الإخبارية لتصلك أخبار الميزات الجديدة والهدايا القادمة 👇