A MCP test with gemini agent and postgres database in a docker container.
概览
A small but practical project that shows how a Model Context Protocol (MCP) server can expose real business tools to an AI agent, so a user can ask questions in natural language and have the AI fetch live data from a database. This project demonstrates a clean pattern: - an MCP server exposes tools for employee and project data - a Gemini agent decides when to use those tools - the agent turns tool results into a readable answer The goal is simple: instead of writing custom code for every question, the AI can use structured tools to answer real business questions. A normal application would need specific integration for each question a user asks. - the database logic is wrapped in small tools - the AI sees those tools as capabilities - the AI can decide which tool to use based on the user request - the result is a conversational interface on top of real business systems This is a great example of AI + tools + structured data working together.
README
以下为原文 README 节选,完整内容请查看原文。
MCP Employee & Project Assistant
A small but practical project that shows how a Model Context Protocol (MCP) server can expose real business tools to an AI agent, so a user can ask questions in natural language and have the AI fetch live data from a database.
This project demonstrates a clean pattern:
- an MCP server exposes tools for employee and project data
- a Gemini agent decides when to use those tools
- the agent turns tool results into a readable answer
The goal is simple: instead of writing custom code for every question, the AI can use structured tools to answer real business questions.
Why this project matters
A normal application would need specific integration for each question a user asks.
With MCP:
- the database logic is wrapped in small tools
- the AI sees those tools as capabilities
- the AI can decide which tool to use based on the user request
- the result is a conversational interface on top of real business systems
This is a great example of AI + tools + structured data working together.
What is MCP?
MCP stands for Model Context Protocol.
In plain English, MCP is a standard way for an AI application to talk to tools and services.
Think of it like this:
- The AI is the decision-maker
- The tools are the hands and eyes
- MCP is the common language they use to work together
Without MCP, an AI model usually only knows what it was trained on. With MCP, it can access real systems such as:
- databases
- APIs
- internal tools
- business functions
In this project, the MCP server exposes functions like:
- get_employee_details
- get_project_details
- get_projects_of_employee
- get_employees_for_project
These are not just random functions. They are business tools that the AI can call when needed.
Project architecture
The app is split into a few simple pieces:
- MCP server: exposes the tools
- Services: talk to the database
- Client: connects to the MCP server
- Gemini Agent: decides which tool to call and interprets the response
- PostgreSQL: stores employee and project data
High-level flow:
- A user asks a question in natural language
- The Gemini agent checks the available MCP tools
- The agent chooses the best tool to answer the question
- The MCP server runs the tool against the database
- The result is returned to the agent
- The agent turns the result into a friendly answer
Folder structure
- server.py – MCP server that exposes business tools
- client.py – lightweight MCP client connection layer
- agent.py – Gemini-powered agent that calls MCP tools
- services/
- employee.py – employee database logic
- project.py – project and assignment logic
- architecture.md – architecture notes and learning path
- requirements.txt – Python dependencies
How the app works in simple terms
1. The server exposes tools
The MCP server says: “Here are the actions I can perform.”
Examples:
- get_employee_details(employee_id)
安装
This server does not publish a one-line install command.
Open the repository installation guide 新手?先看 mcpskill.org 教程 →