Agent As Mcp Server MAF
БесплатноНе проверенThis repository demonstrates how to build, expose, and interact with an agent as an MCP (Model Context Protocol) server using the Microsoft Agent Framework with
Описание
This repository demonstrates how to build, expose, and interact with an agent as an MCP (Model Context Protocol) server using the Microsoft Agent Framework with Azure OpenAI.
README
This repo demonstrates how to expose an agent as an MCP server using the Microsoft Agent Framework (MAF), and how to connect to it from:
- a test ping client (
mcp-ping.py), and - a ChatAgent orchestration client (
client-local-mcp.py) that uses the local MCP server as a tool.
It uses the STDIO transport for MCP, which means the client launches the server as a subprocess and the two sides exchange JSON‑RPC messages over stdin/stdout.
Files
agent-as-mcp-svr.py— MCP server that exposes the agent viaagent.as_mcp_server()andstdio_server().mcp-ping.py— Minimal client that launches the server withstdio_client(), lists tools, and calls the agent tool.client-local-mcp.py— ChatAgent orchestration example usingMCPStdioToolto connect to the local server.
Prerequisites
- Python 3.10+
- Recommended: a virtual environment
- Packages:
pip install --pre agent-framework mcp anyio azure-identity python-dotenv
Environment Configuration
If you use Azure OpenAI (recommended):
export AZURE_OPENAI_ENDPOINT="https://<your-endpoint>.cognitiveservices.azure.com/"
export AZURE_OPENAI_RESPONSES_DEPLOYMENT_NAME="gpt-4o" # responses / agent usage
export AZURE_OPENAI_CHAT_DEPLOYMENT_NAME="gpt-4o" # optional for chat client
export AZURE_OPENAI_API_VERSION="2025-03-01-preview" # or 'preview'
# One of:
export AZURE_OPENAI_API_KEY="<your-key>" # simplest
# OR AAD-based:
# (unset REQUESTS_CA_BUNDLE SSL_CERT_FILE; az login)
# export AZURE_USE_CLI=1
Corporate CA bundle users: ensure
REQUESTS_CA_BUNDLE(and optionallySSL_CERT_FILE) point to a valid PEM path. Foraz login, you may need to temporarily unset those vars.
How to Run
1) Quick local ping (STDIO client/server)
This starts the server as a subprocess and calls the agent tool:
python mcp-ping.py
Expected output (abridged):
TOOLS: ['RestaurantAgent']
== RestaurantAgent input schema ==
{ ... JSON schema ... }
== Health Check (JSON) ==
{ "status": "ok", "endpoint": "...", ... }
2) Orchestrated ChatAgent using the MCP server
This lets a ChatAgent use the local MCP server as a tool:
python client-local-mcp.py
It will run a sequence of prompts (health check, menu list, dietary filter, pricing, happy hour).
Troubleshooting
- Invalid JSON / EOF when running the server alone — you launched the server without a client. Use
mcp-ping.py(they start the server and speak MCP). - Token/credential errors — provide
AZURE_OPENAI_API_KEYorAZURE_USE_CLI=1withaz login. For AAD chains,DefaultAzureCredentialmust be able to find an identity. - Tool arg mismatch — the agent-as-tool typically expects a single
taskstring. Ensure clients send{"task":"your prompt"}.
How it Works (STDIO)
- Server:
stdio_server()exposes async stdin/stdout streams;server.run()handles JSON‑RPC (initialize/list_tools/call_tool). - Client:
stdio_client()launches the server process and returns streams;ClientSessiondrives the JSON‑RPC calls.
Установка Agent As Mcp Server MAF
У этого сервера нет опубликованного пакета — он собирается из исходников. Открой репозиторий и следуй инструкции в README.
▸ github.com/chanirban/agent-as-mcp-server-MAFFAQ
Agent As Mcp Server MAF MCP бесплатный?
Да, Agent As Mcp Server MAF MCP бесплатный — установка в пару кликов через Unyly без оплаты.
Нужен ли API-ключ для Agent As Mcp Server MAF?
Нет, Agent As Mcp Server MAF работает без API-ключей и переменных окружения.
Agent As Mcp Server MAF — hosted или self-hosted?
Self-hosted: сервер запускается локально на твоей машине командой из раздела установки.
Как установить Agent As Mcp Server MAF в Claude Desktop, Claude Code или Cursor?
Открой Agent As Mcp Server MAF на unyly.org, выбери вкладку своего клиента (Claude Desktop, Claude Code, Cursor) и нажми Install — конфиг сгенерируется автоматически, без правки JSON.
Похожие MCP
Fetch
Web content fetching and conversion for efficient LLM usage.
AWS KB Retrieval
Retrieval from AWS Knowledge Base using Bedrock Agent Runtime.
автор: modelcontextprotocolSpring AI MCP Server
Provides auto-configuration for setting up an MCP server in Spring Boot applications.
llm-analysis-assistant
A very streamlined mcp client that supports calling and monitoring stdio/sse/streamableHttp, and can also view request responses through the /logs page. It also
автор: xuzexin-hzCompare Agent As Mcp Server MAF with
Не уверен что выбрать?
Найди свой стек за 60 секунд
Автор?
Embed-бейдж для README
Похожее
Все в категории ai
