BenedatLLC/agent-with-mcp-example
If you are the rightful owner of agent-with-mcp-example 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 project provides a simple example of an Agent and a local MCP server for obtaining system CPU and memory statistics.
The Agent with MCP Example project demonstrates the integration of a local Model Context Protocol (MCP) server with a simple Gradio chat application. The MCP server is built using the psutil library and provides tools to gather system CPU and memory statistics. These tools are exposed as FastAPI endpoints and made accessible via MCP using the fastapi-mcp library. The agent, part of the Gradio chat application, utilizes the Pydantic.ai agent framework to interact with the MCP server. It is designed to answer queries related to system resource usage. The Gradio chat component maintains a conversation history, allowing users to ask follow-up questions. The project requires certain prerequisites, including uv, direnv, and optionally mcptools for testing and debugging the MCP server. OpenAI models are used for the agent, necessitating an active account and API key. The setup involves configuring environment variables, syncing the virtual environment, and starting the MCP server. The project also provides options for testing the MCP server using mcptools and running the full application with the chat server.
Features
- Integration of MCP server with Gradio chat application
- Utilization of psutil library for system statistics
- FastAPI endpoints exposed via MCP
- Pydantic.ai agent framework for interaction
- Conversation history in Gradio chat component
Tools
cpu_times
Return system CPU time as a total across all CPUs.