MAF Agent

v1.0.0Coding Agentsstable

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.

agent-as-mcp-server-mafmcpai-integration
Share:
12
Stars
0
Downloads
0
Weekly
0/5

What is MAF Agent?

MAF Agent is a Model Context Protocol (MCP) server that allows AI assistants like Claude, Cursor, and VS Code to 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.

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.

This server falls under the Coding Agents category on MCPgee, the world's largest MCP server directory with 33,000+ servers.

Features

  • This repository demonstrates how to build, expose, and inter

Use Cases

Expose AI agents as MCP servers using Microsoft Agent Framework.
Build enterprise AI agent architectures with Azure OpenAI.
chanirban

Maintainer

LicenseMIT
Languagepython
Versionv1.0.0
UpdatedMar 10, 2026
Statushealthy
Maintenanceactive

Works with

ClaudeOpenAIwindowsmacoslinux

Installation

Manual Installation

npx agent-as-mcp-server-maf

Configuration

Configuration Details

Config File

claude_desktop_config.json

Performance

Response Metrics

Response Time< 200ms
ThroughputMedium

Resource Usage

Memory UsageLow
CPU UsageLow

How to Set Up and Use MAF Agent

This project demonstrates how to expose a Microsoft Agent Framework (MAF) agent as an MCP server using STDIO transport, enabling any MCP-compatible client to invoke the agent as a tool via JSON-RPC over stdin/stdout. It uses Azure OpenAI as the LLM backend and includes a restaurant-themed reference agent, a minimal ping client, and a ChatAgent orchestration client that calls the MCP server as a tool. The pattern is useful for wrapping existing enterprise agents and making them accessible to AI orchestration frameworks through a standardized interface.

Prerequisites

  • Python 3.10 or higher
  • An Azure OpenAI resource with a deployed model (e.g., gpt-4o) and API key or Azure CLI login
  • The agent-framework, mcp, anyio, azure-identity, and python-dotenv Python packages
  • An MCP-compatible client or the included test scripts
1

Clone the repository

Clone the agent-as-mcp-server-MAF repository and navigate into the project directory.

git clone https://github.com/chanirban/agent-as-mcp-server-MAF.git
cd agent-as-mcp-server-MAF
2

Create a virtual environment and install dependencies

Set up a Python virtual environment and install the required packages including the pre-release agent-framework.

python -m venv .venv
source .venv/bin/activate
pip install --pre agent-framework mcp anyio azure-identity python-dotenv
3

Configure Azure OpenAI environment variables

Set the required environment variables for your Azure OpenAI endpoint, deployment name, API version, and authentication. Use either an API key or Azure CLI credentials.

export AZURE_OPENAI_ENDPOINT="https://<your-endpoint>.cognitiveservices.azure.com/"
export AZURE_OPENAI_RESPONSES_DEPLOYMENT_NAME="gpt-4o"
export AZURE_OPENAI_CHAT_DEPLOYMENT_NAME="gpt-4o"
export AZURE_OPENAI_API_VERSION="2025-03-01-preview"
export AZURE_OPENAI_API_KEY="<your-key>"
4

Run the ping client to verify the MCP server works

Execute the mcp-ping.py script which launches agent-as-mcp-svr.py as a subprocess, lists available tools, and performs a health-check call.

python mcp-ping.py
5

Run the ChatAgent orchestration client

Use client-local-mcp.py to run a ChatAgent that treats the local MCP server as a tool, executing a sequence of restaurant-related prompts.

python client-local-mcp.py

MAF Agent Examples

Client configuration

Claude Desktop config to launch the MAF agent MCP server as a subprocess using STDIO transport.

{
  "mcpServers": {
    "maf-agent": {
      "command": "python",
      "args": ["/path/to/agent-as-mcp-server-MAF/agent-as-mcp-svr.py"],
      "env": {
        "AZURE_OPENAI_ENDPOINT": "https://<your-endpoint>.cognitiveservices.azure.com/",
        "AZURE_OPENAI_RESPONSES_DEPLOYMENT_NAME": "gpt-4o",
        "AZURE_OPENAI_API_VERSION": "2025-03-01-preview",
        "AZURE_OPENAI_API_KEY": "<your-key>"
      }
    }
  }
}

Prompts to try

Example interactions when the MAF agent is connected through MCP.

- "What's on the menu?"
- "Do you have any vegetarian options?"
- "What are today's specials and their prices?"
- "Is the restaurant open for happy hour right now?"

Troubleshooting MAF Agent

Invalid JSON or EOF error when running the server directly

Do not run agent-as-mcp-svr.py directly — it speaks MCP over STDIO and requires a client. Use mcp-ping.py or client-local-mcp.py which launch the server as a subprocess.

Token or credential errors from Azure OpenAI

Ensure AZURE_OPENAI_API_KEY is set, or run `az login` and set AZURE_USE_CLI=1. For corporate environments, verify that REQUESTS_CA_BUNDLE points to a valid PEM file.

Tool argument mismatch errors

The agent tool expects a single `task` string argument. Ensure any client sending calls passes the argument as `{"task": "your prompt"}` rather than named parameters.

Frequently Asked Questions about MAF Agent

What is MAF Agent?

MAF Agent is a Model Context Protocol (MCP) server that 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. It connects AI assistants to external tools and data sources through a standardized interface.

How do I install MAF Agent?

Follow the installation instructions on the MAF Agent GitHub repository. Clone the repo, install dependencies, and add the server config to your AI client.

Which AI clients work with MAF Agent?

MAF Agent works with all major MCP-compatible AI clients including Claude Desktop, Claude Code, Cursor, VS Code (GitHub Copilot), Windsurf, and Cline.

Is MAF Agent free to use?

Yes, MAF Agent is open source and available under the MIT license. You can use it freely in both personal and commercial projects.

Browse More Coding Agents MCP Servers

Explore all coding agents servers available in the MCPgee directory. Each server includes setup guides for Claude, Cursor, and VS Code.

Quick Config Preview

{ "mcpServers": { "agent-as-mcp-server-maf": { "command": "npx", "args": ["-y", "agent-as-mcp-server-maf"] } } }

Add this to your claude_desktop_config.json or .cursor/mcp.json

Read the full setup guide →

Ready to use MAF Agent?

Browse our complete directory of 33,000+ MCP servers, read setup guides for your editor, and start building with the Model Context Protocol.

33,000+ ServersFree & Open SourceStep-by-Step Guides