Building a Model Context Protocol (MCP) Server for ERP Integration

15 Jul, 2025 | 5 minutes read

In today’s fast-paced tech landscape, integrating artificial intelligence (AI) into enterprise systems is no longer a luxury—it’s a necessity. Enterprise Resource Planning (ERP) systems are essential tools for modern businesses, streamlining and unifying processes such as finance, human resources, and operations into a single platform. At our company, the ERP system serves as the backbone for managing working hours, employee details, and onboarding, ensuring that these essential functions run smoothly. However, interacting with traditional ERP systems often involves navigating complex interfaces or crafting precise queries, which can slow down workflows and create barriers for non-technical users.

To address this, we leveraged AI to enhance the intuitiveness and efficiency of our ERP system. The Model Context Protocol (MCP) provides a standardized and efficient method for bridging AI models with applications, enabling seamless communication and data exchange. The driving force behind building an MCP server was the need to allow employees to interact with the ERP system using natural language. Imagine asking, “How many hours did I work on Project Y this month?” or “Enter XY hours on project Y for last week” and getting instant, accurate answers. This approach saves time, boosts productivity, and makes the system accessible to everyone, regardless of their technical skills.

In this post, I’ll walk you through the process of creating an MCP server that connects to our ERP system, enabling these natural language interactions. I’ll showcase three key tools: viewing inserted hours on a project, retrieving user details, and logging hours for a specific project. I built and tested this setup using VS Code with GitHub Copilot, and I’ve included placeholders for screenshots and code snippets to bring the experience to life. As a developer passionate about leveraging cutting-edge tools, this project has been an exciting journey, and I’m thrilled to share it with the community—along with some practical insights, pros, cons, and a nod to the critical feedback I anticipate from my network! Let’s dive in!

Why MCP Matters

The Model Context Protocol (MCP) is a game-changer for AI integration. It provides a structured framework for AI models to interact with external systems—like our ERP—without the headache of custom-built connectors. Think of it as a universal translator for AI applications, ensuring interoperability and scalability. For enterprises, this means faster deployment of AI-driven features and less time wrestling with integration quirks.

My MCP Server: A Quick Overview

My MCP server is a lightweight console application built in C# .NET 9, designed to integrate with our internal ERP system. It exposes three tools:

  1. View Inserted Hours: Retrieves hours logged on a specific project.
  2. View User Details: Displays user profile information.
  3. Insert Hours: Logs hours for a given project.

These tools empower AI assistants—such as GitHub Copilot—to interact directly with ERP data, streamlining workflows and enhancing productivity. Imagine asking Copilot, “How many hours did I log on Project X?” and getting an instant response—cool, right?

Step-by-Step: Crafting the MCP Server

Here’s how I built the server, step by step:

1. Project Setup

Start with a new console app in .NET 9:

dotnet new console -n TMA.MCP.Server

2. Add NuGet Packages

Install the essential packages:

dotnet add package ModelContextProtocol --prerelease
dotnet add package Microsoft.Extensions.Hosting

2. Add NuGet Packages

Install the essential packages:

dotnet add package ModelContextProtocol --prerelease
dotnet add package Microsoft.Extensions.Hosting

These provide the MCP SDK and hosting capabilities.

3. Configure the Server

In Program.cs, set up the MCP server with standard I/O transport and tool scanning:

View Code

This configuration initializes the server and prepares it to detect tools defined in the assembly.

4. Define the Tools

Using MCP attributes, I defined the three tools:

View Code

Connecting to the ERP System

Believe it or not integration with our ERP system was the trickiest part. I built a service layer to handle authentication and API calls, registered it with .NET’s dependency injection, and linked it to the MCP tools. This ensures secure, efficient communication between the server and the ERP.

View Code

For example, the Enter Report tool sends a request to the ERP API, logging hours while respecting access controls—a critical detail I’ll revisit when discussing security.

Testing with VS Code and GitHub Copilot

Testing was a breeze with VS Code and GitHub Copilot. I configured the server in mcp.json:

"erpMcp": {
	"type": "stdio",
	"command": "dotnet",
	"args": [
		"run",
		"--project",
		"C:\\Users\\<USER>\\TMA.MCP.Server.csproj",
		"--",
		"6ca28bee-cc8f-42ba-aaf8-3ce00d0febe7"

Once running, I toggled Copilot’s Agent mode and interacted with the tools. Asking “Show me my hours on Project XYZ”, Show me my details returned real-time data from the ERP—proof of concept achieved!

The Pros of MCP: Why It Shines

Here’s why I’m sold on MCP:

  • Standardization: No more reinventing the wheel. MCP provides a consistent protocol for AI-system integration, saving time and effort.
  • Scalability: It handles multiple connections effortlessly, perfect for enterprise-scale deployments.
  • Productivity Boost: Tools like these make AI assistants smarter, automating repetitive tasks and delivering insights on demand.
  • Flexibility: The MCP SDK integrates seamlessly with .NET 9, offering a robust foundation for customization.

The Cons: A Balanced Look

No solution is perfect, and MCP has its trade-offs:

  • Learning Curve: It requires familiarity with the protocol and .NET ecosystem—manageable, but not trivial.
  • Security Considerations: While MCP includes authentication and authorization features, a misstep in implementation could expose sensitive ERP data. Security isn’t a flaw of MCP—it’s a responsibility of the developer.

Security Considerations

When building a server to connect AI models with applications—such as through the Model Context Protocol (MCP) – security is a critical concern. MCP streamlines how these systems interact, and with that comes the need to protect sensitive data and ensure safe, authorized access. The protocol’s design offers a foundation that simplifies security, making it easier for developers to build robust, secure servers without reinventing the wheel.

Few key things that need to be taken in consideration when building your MCP server:

  • Authentication and Authorization – MCP provides standardized way to manage who and how can interact with your server. However, it is developer responsibility to set up mechanisms to verify identities, define permissions and limit what end users can do
  • Validate Input and Output – like any server that handles dynamic data, MCP server must quard against malicious and malformed inputs.
  • Stay secure over time – Keep the MCP server related packages updated, monitor unusual activities, review setup for potential weaknesses.

MCP’s modular nature makes updates and monitoring manageable, so your server can evolve alongside new threats.

For more, check out MCP’s official documentation or general server security guides to deepen your approach.

Wrapping Up

Building this MCP server in C# .NET 9 has been a rewarding dive into AI integration. It’s empowered me to connect our ERP system with AI tools in a standardized, scalable way, and the results speak for themselves. Yes, there are challenges—security chief among them—but the benefits far outweigh the hurdles. I’m excited to see where MCP takes us next as we refine our AI capabilities.