Ashrokss/Custom-Mcp-with-Agno
3.2
If you are the rightful owner of Custom-Mcp-with-Agno and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.
This repository demonstrates how to build a custom Model Context Protocol (MCP) server and client using the Agno agent framework.
CustomβMCP with Agno
This repository demonstrates how to build a custom Model Context Protocol (MCP) server and client using the Agno agent framework. It features:
- β A working MCP server (custom tool implementations)
- β A Python MCP client powered by Agno / agno.tools
- β Example agent workflows, handling tool calls and async management
- β Clean sample architecture with minimal dependencies
π Architecture
ββββββββββββββββ ββββββββββββββββ βββββββββββββββββ
β MCP Server β<ββ SSE / HTTP ββΊβ Agno Agent β<β Tool Calls ββΊβ Tools / LLM β
ββββββββββββββββ ββββββββββββββββ βββββββββββββββββ
- MCP server (
mcp_server.py
): serves tool endpoints, e.g. web search. - Client (
mcp_client.py
): agent-side runner usingagno.tools.MCPTools
- Agent logic: handles queries, invokes tools, and processes results.
Features
- Asynchronous context management via
anyio
andasync with MCPTools(...)
. - Agent retries and error handling (including handling βno space left on deviceβ issues).
- Template for adding new tools or extending MCP interface.
- Example agent running loop included in
mcp_client.py
.
π Code Structure
File | Description |
---|---|
mcp_server.py | Python MCP server with sample tool implementations |
mcp_client.py | Agent client to issue queries and handle agent response |
requirements.txt | Python dependencies: agno , anyio , etc. |
.venv/ | (Optional) Virtual environment directory |
config/config | Environment Variables such as SERPER_API_KEY & GROQ_API_KEY |
π Set Up Configuration
In config.py
, define:
class Config:
GROQ_API_KEY = "<your_groq_api_key>"
SERPER_API_KEY = "<your_serper_api_key>"