Python implementation for building Users Management Agent with MCP tools and MCP server
Create and run MCP server with simple tools. Implement simple Users Management Agent with MCP Client that will use MCP tools from created server.
By exploring and working with this project, you will learn:
- How to configure simple MCP server
- How to configure client and connect to MCP server
- How to create simple Agent with tools from MCP server
- Key features of MCP
task/
├── agent/
│ ├── models/
│ │ └──message.py ✅ Complete
│ ├── app.py 🚧 TODO: implement logic
│ ├── openai_client.py 🚧 TODO: implement logic
│ └── mcp_cleint.py 🚧 TODO: implement logic
└── mcp_server/
├── server.py 🚧 TODO: implement logic
├── user_client.py ✅ Complete
└── Dockerfile ✅ Complete
- Python: 3.11 or higher
- Dependencies: Listed in
requirements.txt - Docker and Docker Compose
- Postman
If the task in the main branch is hard for you, then switch to the with-detailed-description branch
You need to implement the Users Management Agent, that will be able to perform CRUD operations within User Management Service.
- Run root docker-compose (Optional step in case if you have it from previous tasks)
- Open mcp_server
- Implement all TODO
- Run mcp_server
- Import mcp.postman_collection to Postman
- Make
initcall and getmcp-session-idin response headers - Make
init-notification. Pay attention that you need to usemcp-session-idretrieved frominitrequest. it should return 202 status - Get tools (don't forget about
mcp-session-id). It should return stream with tools. - Call calculator (don't forget about
mcp-session-id). It should return stream tool execution result.
- Open mcp_client and implement all TODO
- Open openai_client and implement all TODO
- Open prompts and write System prompt
- Open app and implement all TODO
- Run application mcp_client and test that it is connecting to MCP Server and works properly
- Try with your solution with
fetch MCPhttps://remote.mcpservers.org/fetch/mcpand check the differences on theinitstep (what they have and don't)
- Remember that we have 1-to-1 connection between MCP client and MCP server!
- You need to think of the way how to change current flow to support tools from different MCP servers and implement it
- In the end you should have the Agent that is able to fetch the info from the WEB about some people and save it to Users Service
- Hint: the problem place is openai_client
