# PHC GO MCP

> PHC GO MCP Server connects your AI agent directly to your PHC GO Enterprise Resource Planning system. It lets you manage core operations—from creating customer records and generating invoices to checking real-time stock levels and mapping taxes—all through natural conversation. You handle complex business logic without ever logging into the ERP dashboard.

## Overview
- **Category:** erp-operations
- **Price:** Free
- **Tags:** invoicing, business-management, retail-logic, tax-mapping, logistics

## Description

You're connecting your AI agent directly to PHC GO. This MCP Server lets you manage every core operation—from customer billing to inventory tracking—without ever logging into the ERP dashboard or touching a web form. You simply talk to your agent, and it handles the complex business logic using tools that speak directly to the PHC GO system.

### Querying and Managing Client Data

Need to know about a client? Your agent can search for them instantly by name, tax ID (NIF), or internal code using `search_customers`. If you've got their ID, it pulls up their full profile details with `get_customer_details`. If they don’t exist yet, you can build the record from scratch using `create_customer`. For a complete overview of your client base, you just run `list_customers` to pull a master list of every active entity in the system.

### Handling Billing and Official Documents

When it comes to money, this server gives you total control. You can generate formal business paperwork—whether it's an invoice, an estimate, or a credit note—by invoking `create_document`. When you need to see what was sent before, the agent retrieves all details for any commercial document using `get_document_details`, including every line item attached to that record. If you want to list out all your past documents and filter them by type (Invoice, Estimate, etc.), use `list_documents`. To check a client's current balance, it runs `list_current_accounts` showing outstanding debits and credits. You can verify the tax rules for billing by calling `list_taxes`, or see every configured IVA rate and tax setting available in PHC GO. The agent also lets you pull all payment methods set up in your system via `list_payment_methods` and lists out every numbered series (like 'Invoice 2026/') using `list_series` so you keep things standardized.

### Inventory, Products, and Logistics

When you need to know what's on the shelves, the server gives you real-time visibility. You can check current inventory movements by calling `list_stocks`, which lets you filter those moves based on specific products or even narrow it down by warehouse location using `list_warehouses`. If you need a deep dive into an item's specs, `get_product_details` pulls all the necessary data for an article or service by its ID. You can run `list_products` to get a complete catalog of everything you sell. And if your product line is growing, you don’t gotta call someone—you just add it using `create_product`. 

### System Reference Tools

Beyond the main actions, your agent keeps you current on system data points. You can list every configured warehouse location with `list_warehouses`, and you'll never lose track of what tax rates are active since `list_taxes` is available. The toolset gives you complete oversight over PHC GO operations so you don't gotta switch context or remember complicated API calls; your agent handles it all through natural conversation.

## Tools

### create_customer
Creates a brand-new customer entity record within the PHC GO system.

### create_document
Generates and records new commercial documents like invoices, estimates, or purchase orders.

### create_product
Adds a brand-new article or service item to the product catalog.

### get_customer_details
Retrieves the full, detailed profile for a specific customer using their ID.

### get_document_details
Fetches all details about a commercial document (invoice, credit note, etc.), including line items.

### get_product_details
Retrieves the full specifications and data for an article or service by its ID.

### list_current_accounts
Queries a customer's current account balance, showing outstanding debits and credits.

### list_customers
Generates a comprehensive list of all active client entities in the system.

### list_documents
Lists commercial documents, filtering by type (Invoice, Credit Note, Estimate, etc.).

### list_payment_methods
Shows all payment methods configured in the PHC GO system (e.g., Bank Transfer, Card).

### list_products
Retrieves a master list of every product and service available in the catalog.

### list_series
Lists all configured numbering series for documents (e.g., Invoice 2026/, Credit Note 2026/). 

### list_stocks
Consults current inventory movements, allowing optional filtering by specific products.

### list_taxes
Lists all configured IVA rates and tax settings used in billing.

### list_warehouses
Displays all warehouse locations set up for inventory management.

### search_customers
Searches for a customer using criteria like name, tax ID (NIF), or internal code.

## Prompt Examples

**Prompt:** 
```
Check the available stock for 'Macbook Pro M3' across all warehouses.
```

**Response:** 
```
I checked the ERP. We currently hold 42 units of 'Macbook Pro M3': 30 units at Warehouse North and 12 units at Central Logistics.
```

**Prompt:** 
```
Create a new customer profile for 'Acme Corp' and fetch their assigned customer ID.
```

**Response:** 
```
Understood. The entity 'Acme Corp' was successfully pushed to PHC GO configuration. Their internal Customer ID assigns to `CUST-989201`.
```

**Prompt:** 
```
Examine our outstanding current accounts from January to spot pending vendor debts.
```

**Response:** 
```
According to the ERP 'list_current_accounts' query, there are 4 open vendor invoices flagged as overdue from January. Here's a table summarizing the debtors and owed amounts.
```

## Capabilities

### Query and Manage Customer Data
Search for, retrieve details of, and create new client profiles in the PHC GO system.

### Generate Official Business Documents
Creates structured commercial documents like invoices or estimates using defined billing rules.

### Check Real-Time Stock and Inventory Levels
Pulls current stock movements, product details, and warehouse configurations instantly.

### Audit Financial Accounts and Taxes
Retrieves outstanding balances from clients or lists configured tax rates for accurate billing.

### Handle Product Catalog Operations
Lists all existing products, retrieves specific item details, or adds new articles to the catalog.

## Use Cases

### Processing an emergency sales order.
A salesperson needs to confirm if the customer's account (`list_current_accounts`) has any outstanding issues before committing to a large purchase. They ask the agent, which uses `get_customer_details` first, then checks for open balances. If clear, they proceed to use `list_stocks` to verify inventory and finally call `create_document` to draft the sales order.

### Onboarding a new client.
An account manager needs to add a brand-new corporate client. They ask the agent, which executes `search_customers` (to confirm no duplicates) and then uses `create_customer`. The system returns the assigned ID immediately, allowing the manager to proceed with generating initial paperwork using `create_document`.

### Auditing a product launch.
A supply chain planner needs to know if they have enough of a new item. They use `list_products` to check the catalog, then specify an ID and run `get_product_details`. Next, they run `list_stocks` combined with `list_warehouses` to get a total material count before placing an order.

### Fixing billing errors.
The finance team spots a discrepancy. They use `list_documents` to pull all recent invoices, then select one and run `get_document_details`. This reveals the exact line items used, allowing them to identify if the wrong tax rate was applied via cross-checking with `list_taxes`.

## Benefits

- Stop switching between tabs to check inventory. Use `list_stocks` and `list_warehouses` in one chat prompt, giving you an immediate, aggregated view of stock availability across all locations.
- Never manually draft a document again. Simply instruct the agent to 'create invoice for Customer X' and let it execute `create_document`, handling the necessary IDs and tax mapping automatically.
- Need client data fast? Instead of sifting through lists, use `search_customers` or `get_customer_details` to pull specific customer records instantly, regardless of whether you know their exact ID.
- Keep your books clean by querying financial status. Call `list_current_accounts` to get outstanding balances immediately, saving time compared to manually pulling statements from the core ERP.
- Build out your product catalog programmatically. Use `create_product` or `get_product_details` to ensure your agent can reference every service and item before a sale is confirmed.

## How It Works

The bottom line is you use natural language to trigger specific, governed tools that act directly on your core ERP data.

1. Subscribe to this server and input your PHC GO Backend URL.
2. Provide your generated API Access Token for secure connection.
3. Directly query your AI client (Claude, Cursor, etc.) with a command like: 'What is the stock level for X at Warehouse Y?'

## Frequently Asked Questions

**How do I check available stock for a specific item?**
Run the `list_stocks` tool. You can filter the results by article ID or product name to see exactly how many units are held and where they're located across your warehouses.

**Can I find a customer if I don't know their full NIF?**
Yes, use `search_customers`. This tool lets you search by name or partial ID. It handles the lookup and returns the necessary IDs for subsequent actions like checking their account balance.

**What is the best way to create a new customer?**
Use the `create_customer` tool. This function handles all required data fields, ensuring the client record is properly established in the PHC GO system immediately.

**How do I see which document types are available to list?**
You use `list_documents`. It returns a catalog of commercial document types, such as 'Fatura' (Invoice), 'Nota Crédito' (Credit Note), and 'Orçamento' (Estimate).

**When I run `list_products` or any other tool, what credentials do I need to connect?**
You must supply the PHC GO Backend URL along with your generated API Access Token. Your AI client handles this authentication setup; you just pass these required credentials when connecting the server.

**When I run `list_current_accounts`, how do I know which amounts are pending payment?**
The query returns specific status fields for each record. Look for 'Status' or 'Movement Flag'; this tells you if a debt is flagged as settled, overdue, or awaiting reconciliation.

**What details must I provide to successfully call the `create_product` tool?**
You need core product data like the name, SKU, and initial price. The API requires you to populate specific mandatory fields before it accepts a new article into your inventory list.

**What does running `list_taxes` show me about tax compliance?**
It lists every active VAT rate and impost configured in the PHC GO system. This lets your AI agent ensure it applies the correct, current rate when drafting any commercial document.

**Can my AI actively search for a specific customer before creating an invoice?**
Yes. It can sequentially execute `search_customers` to find the precise Unique ID of the customer using fuzzy name matching, and subsequently inject that accurate payload into `create_document` without human error.

**Is 'list_stocks' showing data in real-time?**
Yes. Since this operates as a direct pass-through via the MCP to the PHC GO platform API, all stock matrices, warehouse item counts, and current accounts represent the exact live state of your corporate database in the split second the AI requests it.

**Can I query products that exist across multiple warehouses?**
Absolutely. By commanding the agent to align returns from both `list_products` and `list_warehouses` against `list_stocks`, your LLM can map out a matrix comparing which warehouse holds the higher volume of the targeted SKUs.