MCP Data Integration Server
Enables reading, normalizing, validating, merging, and exporting data from Excel, CSV, JSON, and SQLite sources into a unified schema, with tools exposed via FastMCP.
README
MCP Data Integration Demo
1. Refined understanding of the requirement
This project demonstrates a small MCP-based data integration system. The MCP client starts and connects to a FastMCP server, discovers tools, and orchestrates a workflow that reads employee data from Excel, CSV, JSON, and SQLite sources. The server owns all data operations: source reading, normalization, validation, merging, and export.
Every source can use different column names, but all records are converted to this fixed schema:
employee_id, employee_name, department, salary, joining_date, source_system
2. Proposed MCP architecture
User
-> MCP Client
-> FastMCP Server
-> Source-specific tools
-> Data parsers
-> Schema normalizer
-> Validator
-> Data merger
-> Final unified dataset
MCP is useful here because it separates orchestration from implementation. The client only decides which tools to call and in what order. The server exposes stable data-operation tools that can be used by this client, another MCP client, or an AI application.
3. Project folder structure
.
|-- server.py
|-- client.py
|-- schema.py
|-- normalizer.py
|-- validators.py
|-- merger.py
|-- exporter.py
|-- generate_sample_data.py
|-- requirements.txt
|-- data_sources/
| |-- excel_reader.py
| |-- csv_reader.py
| |-- sql_reader.py
| |-- json_reader.py
| |-- powerbi_reader.py
| `-- common.py
|-- sample_data/
`-- output/
4. Complete code for each file
The complete runnable code is in the project files above. The key roles are:
server.py: FastMCP tool provider.client.py: MCP workflow orchestrator.data_sources/*: source-specific parsers.normalizer.py: maps source columns into the fixed schema.schema.pyandvalidators.py: Pydantic schema and validation.merger.py: combines valid records and removes duplicateemployee_idvalues.exporter.py: writes CSV or Excel output.
5. Sample data generation code
generate_sample_data.py creates:
sample_data/employees.xlsxsample_data/employees.csvsample_data/employees.jsonsample_data/employees.db
The JSON sample intentionally includes one invalid salary so validation output is visible.
6. Installation steps
python -m venv .venv
.\.venv\Scripts\activate
python -m pip install -r requirements.txt
7. Execution steps
Generate demo input files:
python generate_sample_data.py
Run the MCP client workflow:
python client.py
Run only selected sources:
python client.py --no-json
python client.py --excel sample_data/employees.xlsx --csv sample_data/employees.csv --no-sql --no-json
Export to Excel instead of CSV:
python client.py --output output/final_employees.xlsx
8. Step-by-step explanation of how the code works
client.pystartsserver.pyas a FastMCP stdio server.- The client calls
list_tools()and prints the available MCP tools. - For each configured source, the client calls the matching read tool.
- The client sends returned records to
normalize_data. - The client sends normalized records to
validate_data. - Valid records from each source are passed to
merge_data_sources. - The merged records are passed to
export_final_dataset. - The client prints a structured final status object.
9. Example output
{
"status": "success",
"sources_processed": ["excel", "csv", "json", "sql"],
"total_records_read": 11,
"total_records_valid": 10,
"total_records_invalid": 1,
"duplicates_removed": 1,
"final_records_exported": 9,
"output_file": "C:\\MCP_prac\\output\\final_employees.csv"
}
10. How to extend the project for Power BI, APIs, and more databases
For Power BI, the demo already includes read_powerbi_data, which reads CSV or Excel exports. A direct Power BI API version would add an authenticated reader that calls the Power BI REST API, converts the JSON response to records, then reuses the existing normalizer and validator.
For REST APIs, add a new reader such as data_sources/api_reader.py, register a read_api_data tool in server.py, and add source aliases in normalizer.py.
For more databases, replace or extend sql_reader.py with SQLAlchemy connection support. The rest of the pipeline can remain unchanged as long as the reader returns list[dict] records.
11. Best practices and improvements for production
- Move source mappings to configuration files or a metadata database.
- Add authentication and secret management for external systems.
- Add richer duplicate rules, such as source priority and record timestamps.
- Store invalid records in a rejection file for review.
- Add tests for every reader, mapping, validation rule, and merge rule.
- Add structured logging and run IDs for auditability.
- Add batch processing for large files.
推荐服务器
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 模型以安全和受控的方式获取实时的网络信息。