04-enterprise-mcp-server
MCP server with a RAG knowledge tool that enables AI agents to search enterprise documents using natural language queries.
README
enterprise-mcp-server — MCP Server with RAG, Employee, and Ticket Tools
Overview
This project demonstrates how to build a custom Model Context Protocol (MCP) server that exposes reusable tools to AI applications.
Instead of an AI agent directly calling Python functions, MCP provides a standardized protocol that allows AI clients to discover and invoke external tools.
In this project, we build an MCP server that exposes four tool categories: calculator utilities, a RAG-powered document search tool (calling the RAG agent from project 02 over HTTP), an employee PTO lookup, and a ticket status lookup.
What is MCP?
Model Context Protocol (MCP) is an open protocol that enables AI applications to securely connect with external tools, data sources, and services.
Traditional approach:
AI Agent
|
v
Direct Python Function Calls
enterprise-mcp-server:
MCP Client
|
|
Authentication
|
v
MCP Server
|
+--------------+--------------+
| | |
v v v
RAG Tool Database Tool API Tool
search_docs employee_db system_health
The MCP server acts as a bridge between AI systems and external capabilities.
Architecture
The MCP server exposes enterprise capabilities as AI tools.
AI Client
|
|
v
MCP Protocol
|
v
Enterprise MCP Server
|
v
RAG API Service
|
v
Vector Database
|
v
Enterprise Documents
Features
Available MCP Tools
calculator_add / calculator_multiply
Basic arithmetic tools.
search_company_documents
Searches enterprise documents using the RAG pipeline from project 02, called over HTTP. Requires an api_key parameter, validated against MCP_API_KEY.
Example:
Input:
{ "question": "How many days can employees work remotely?", "api_key": "your-mcp-api-key" }
Output:
"Employees can work remotely up to three days per week."
get_employee_leave
Looks up an employee's remaining PTO days from an in-memory store.
Input: {"employee_name": "John"}
Output: "John has 12 PTO days remaining."
get_ticket_information
Looks up ticket status, assigned team, and priority from an in-memory store.
Input: {"ticket_id": "INC-1001"}
Output: "INC-1001 status: In Progress. Assigned team: Platform Engineering. Priority: High."
Note: Authentication is currently only enforced on
search_company_documents. The employee and ticket tools don't yet callauthenticate()— see Future Enhancements.
Project Structure
04-mcp-server/
├── server.py
├── auth.py
├── client.py
│
├── tools/
│ ├── calculator.py
│ ├── rag_search.py
│ ├── employee.py
│ └── ticket.py
│
├── database/
│ └── employees.py
│
├── tickets/
│ └── tickets.py
│
├── README.md
│
└── requirements.txt
Technology Stack
- Python 3.11+
- Model Context Protocol (MCP)
- FastMCP
- Python functions exposed as AI tools
Installation
1. Clone repository
git clone <repository-url>
Navigate:
cd 04-mcp-server
2. Create virtual environment
python -m venv venv
Activate:
Mac/Linux:
source venv/bin/activate
3. Install dependencies
pip install -r requirements.txt
Running the MCP Server
Start the server:
python server.py
The MCP server will start and expose available tools.
Example Tool Definition
Example MCP tool:
@mcp.tool()
def calculator_add(a: float, b: float) -> float:
return a + b
The function becomes discoverable as an MCP tool.
Learning Outcomes
Through this project, I learned:
- How MCP works as a communication layer for AI applications
- How to create custom MCP tools
- How to expose Python functions as AI capabilities
- How AI agents can discover and use external tools
- The difference between traditional function calls and protocol-based tool access
Future Enhancements
Planned improvements:
- Extend authentication to
get_employee_leaveandget_ticket_information(currently onlysearch_company_documentsis protected) - Replace in-memory employee/ticket data with real data sources
- Add automated tests for tool call handling and auth failures
- Deploy MCP server as a hosted service
- Connect MCP server as a callable tool set for the multi-agent workflow project
Relationship to Previous Projects
This project builds on previous AI engineering concepts:
Project 01 — Basic Tool Use
Agent
|
+-- Tools
Project 02 — RAG Agent
Documents
|
v
Vector Database
|
v
Knowledge Retrieval
Project 03 — Multi-Agent Workflow
Orchestrator
|
+-- Research Agent
+-- Writer Agent
Project 04 — MCP Server
AI System
|
v
MCP Protocol
|
v
Reusable External Tools
Technologies Used
python, uvicorn, fastmcp, pydantic, typing, mcp
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。