# How to build an MCP server for Microsoft Dynamics GP

> Source: https://netray.co/integrations/dynamics-gp-mcp-server
> Publisher: Netray (netray.co), AI and integration engineering for ERP and manufacturing systems.
> Section: Integrations

## Short answer

An MCP server for GP is a small service that exposes a few typed, read-only tools backed by SQL views over the company databases. Run it on your network, authenticate each client, log every call, and add write tools only behind approvals. Any MCP client, including Claude and ChatGPT, can then use it.

## System

Microsoft Dynamics GP

## Capability

mcp-server

## Intro

Model Context Protocol gives AI clients a standard way to discover and call tools. For GP, which has no cloud API of its own, an MCP server is a neat way to publish exactly the data you are willing to share and nothing else, with one implementation serving many assistants.

The design work is not the protocol, it is deciding the tool surface. GP has thousands of tables across modules, and a model handed a general SQL tool will produce plausible but wrong joins, particularly across multi-currency and posted versus unposted data. Curated tools return correct answers repeatedly.

Below is a practical blueprint: what to expose first, how to authenticate against SQL Server, how to deploy, and how to keep an audit trail that finance and IT will accept.

## Use Cases

### Item and availability lookup

**Description:** A get_item tool returns description, item class, unit of measure and quantities by site, so any assistant can answer stock questions consistently.

### Vendor and PO status

**Description:** Tools for vendor details and open PO lines with promise dates and receipts to date support buyer assistants and expediting agents.

### Customer account inquiry

**Description:** Balance, aging buckets, open invoices and last payment date for a customer ID, useful for collections and customer service assistants.

### Ledger drill-down

**Description:** GL activity by account segment and period with journal references, letting a finance assistant explain movements and cite entries.

### Document status

**Description:** Look up a sales order, invoice or purchase receipt and show whether it is in a work batch, posted or voided.

## System Surface

- SQL Server connectivity from the MCP server host using Windows integrated authentication or a SQL login. Prefer a dedicated least-privilege account.
- A dedicated schema of views, for example mcp.open_po_lines, which flatten GP tables (such as the POP, PM, IV and RM families) into stable column names insulated from version differences.
- The DYNAMICS system database for the list of companies and their database names, used by a list_companies tool.
- eConnect, Integration Manager or web services for optional write tools. Verify support in your GP version and keep these outside the default server.
- GP security tables and roles if you want tools to honour user-level restrictions, which usually means mapping the calling user to a role-based view filter you maintain.

## How It Works

### Inventory the questions

**Detail:** Collect real questions from buyers, planners and finance. Group them into read-only tools. Aim for under ten at first.

### Create the view schema

**Detail:** Write and test each view against several companies. Include company, currency and posted status columns explicitly so tools cannot silently mix them.

### Implement tools with strict schemas

**Detail:** Use an MCP SDK. Define input types, default row caps, and descriptions written for the model, including when not to use the tool.

### Choose transport and auth

**Detail:** Stdio for a local analyst workstation. Streamable HTTP for shared use, fronted by a reverse proxy with OAuth or Entra ID and per-client scopes.

### Add observability

**Detail:** Log timestamp, caller, tool, arguments, row count and duration to a table or log pipeline, and alert on unusual volumes.

### Test with several clients

**Detail:** Connect Claude, a ChatGPT-compatible MCP client and an open-source client to check descriptions behave across models.

### Stage write tools separately

**Detail:** If needed, publish a second server with create_pending_request tools that only write to a queue for human approval.

## Example Flows

### Planner checks cover for a part

**Trigger:** Planner asks an assistant if part A100 is covered through next month.

**Steps:**

- Assistant calls get_item for quantities by site.
- It calls open_po_lines filtered to the item.
- It adds open sales order demand from a demand tool.
- It reports projected shortage dates.

**Result:** A sourced answer in seconds, with each figure traceable to a tool call.

### Finance asks for account activity

**Trigger:** Accountant asks what drove travel expense in March.

**Steps:**

- Assistant calls list_companies to confirm the entity.
- It calls gl_activity with account and period.
- It groups by journal source and vendor.

**Result:** A breakdown with journal numbers to check in GP.

## On Prem

An MCP server is naturally on-prem friendly because it is just a process on a Windows or Linux host that can reach SQL Server. Keep it in the same network zone, make it reachable only from approved clients, and pair it with a locally served open-weight model if prompts must stay internal. In an air-gapped site, package the server and its dependencies into an offline installer and run clients on the same segment. The protocol does not require any internet access by itself.

## Security

- Least-privilege SQL login with select on the mcp schema only.
- OAuth or Entra ID for HTTP transport, with per-client tokens that can be revoked individually.
- Hard caps on rows and date ranges in every tool, enforced in code and not left to the model.
- Return only columns needed, excluding bank accounts, tax IDs and personal data unless a role requires them.
- Immutable audit log, and periodic review of which tools are used and by whom.

## Options

### Open-source or community SQL MCP server with custom views

**Fit:** Quick experiments, though generic SQL tools are risky for production GP questions.

**Effort:** Hours to start, plus view work.

### Custom MCP server in your own codebase

**Fit:** Best long-term fit if you have a .NET or Python developer who knows GP.

**Effort:** One to three weeks for a first set of tools.

### Netray-built server with approvals and audit

**Fit:** Teams wanting GP-aware views, evaluation sets and a private model.

**Effort:** Short pilot, scoped by tool count.

## Pitfalls

- Offering a free-form run_sql tool. It is convenient and the main source of wrong answers and data leaks.
- Forgetting posted history tables, so closed periods return incomplete data.
- Tool descriptions that are vague. Models rely on them to choose parameters correctly.
- Single shared login for all users with no caller identity in the logs.
- Version drift: a GP upgrade or add-on can rename columns your views depend on, so keep view tests in CI.

## Faq

### What is an MCP server in plain terms?

**Answer:** It is a small program that tells an AI application which tools it offers and runs them on request. For GP, the tools are things like item lookup or open PO lines, each backed by a controlled SQL query so the model never writes its own.

### Should the server write to GP?

**Answer:** Start read-only. If you add writes, have the tool create a pending request and let a person approve, then post with eConnect or Integration Manager using a limited GP role. Direct table inserts bypass business logic and are unsafe.

### Stdio or HTTP?

**Answer:** Stdio runs the server as a child process on one machine, simple for a single user. HTTP lets many users and clients share one hosted server with central authentication, logging and revocation, which is what most teams need in production.

### Does it work with ChatGPT as well as Claude?

**Answer:** MCP is an open protocol with growing client support, including Claude, several desktop and IDE assistants and OpenAI products in some configurations. Support differs by client and plan, so test the clients your staff actually use.

### How do we handle many GP companies?

**Answer:** Add a list_companies tool reading the DYNAMICS database and make every other tool require a company parameter that is validated against an allow-list, so the model cannot guess database names.

## Search terms

dynamics gp mcp server, mcp server for microsoft dynamics gp, model context protocol dynamics gp, build mcp server sql server erp, great plains mcp, dynamics gp ai tools api, mcp dynamics gp read only, dynamics gp claude chatgpt connector, dynamics gp sql views ai, on-prem mcp server erp

---
Talk to an engineer: https://netray.co/contact?intent=erp_ai | Machine catalog: https://netray.co/agent/catalog.json
