> ## Documentation Index
> Fetch the complete documentation index at: https://docs.nekt.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Sankhya as an MCP

> Let your AI agents use Sankhya in real time through the Nekt MCP Gateway.

Sankhya is an enterprise resource planning (ERP) system. With this MCP, your AI agents can read and write Sankhya ERP data in real time, including querying partners, retrieving notes, and creating new sales orders.

| | Available |
| :- | :- |
| **Nekt Express** | Yes |
| **GCP** | Yes |
| **AWS** | Yes |

## Adding Sankhya as an MCP

Before you start, make sure the [MCP Server](https://docs.nekt.com/mcp-server/setup.md) is set up. See [MCPs](https://docs.nekt.com/mcps/overview.md) for how MCPs work.

1. Go to **Activate → MCPs**, click **New MCP** and choose **Sankhya**.
2. **Name your MCP** and describe what it is used for. The agent reads the description to choose between MCPs of the same provider.
3. **Setup access**. To authenticate, you need credentials from your Sankhya Developer Area and your Sankhya Om system.
   1. Obtain your Client ID and Client Secret from the Sankhya Developer Area.
   2. Find your X-Token in the Gateway Settings within Sankhya Om.
   3. Provide the following fields:
   * **Client ID** (required): Your Sankhya Client ID from the Developer Area.
   * **Client Secret** (required): Your Sankhya Client Secret from the Developer Area.
   * **Gateway Token (X-Token)** (required): Your X-Token from Gateway Settings in Sankhya Om.
   * **Base URL**: Sankhya Gateway API URL. Leave empty to use [https://api.sankhya.com.br](https://api.sankhya.com.br) (use [https://api.sandbox.sankhya.com.br](https://api.sandbox.sankhya.com.br) for the sandbox). This is not the address of your Sankhya Om system.
4. **Select tools**. Pick the tools your agents can use. See [Available tools](#available-tools) below.
5. Click **Save**. On Growth and Custom plans, choose who can use it; see [Access levels](https://docs.nekt.com/mcps/overview.md#access-levels).

## Example prompts

* "Search for the partner Acme Corp and tell me their exact partner code."
* "What are the items and total value of sales order number 12345?"
* "List all the columns and custom fields available in the TGFPAR partner table."
* "Create a new sales order for partner 4454 with 5 units of product code 10, using operation type 100."

## Available tools

Choose which of these tools your agents can use in **Select tools**.

### Read tools

| Tool | Description | Parameters |
| :- | :- | :- |
| `describe_table` | Describe a Sankhya table: primary key, the entity name to use with write\_record, and its columns with SQL type and data dictionary label (TDDCAM), including the customer's custom AD\_\* fields. `search` filters columns by name or label (e.g. "pipedrive", "AD\_", "data"); big tables… | `table` (string, required), `search` (string) |
| `find_partner` | Find Sankhya partners (customers/suppliers, table TGFPAR) by name, trade name, CNPJ/CPF, or code, and return their CODPARC. Use this to turn a CRM lead/organization name into the CODPARC needed for a sales order. Exact CNPJ/CPF or code matches come first. | `search` (string, required), `limit` (integer) |
| `get_order` | Get a Sankhya sales order / note by NUNOTA: main header fields (TGFCAB) and its items (TGFITE). Returns \{"found": false} when it does not exist. | `nunota` (integer, required) |
| `list_tables` | List Sankhya database tables with their data dictionary description (TDDTAB). `search` filters by table name or description (e.g. "parceiro", "TGFCAB", "pedido"). Main tables: TGFPAR partners, TGFCAB note/order headers, TGFITE note/order items, TGFPRO products, TGFFIN financial… | `limit` (integer), `search` (string) |
| `read_table` | Read rows from a Sankhya table (e.g. TGFPAR, TGFCAB, TGFITE, TGFPRO). - columns: column names to return (default: all; prefer naming them, TGFCAB has \~470). - filters: equality filters \{column: value}, values escaped safely (null -> IS NULL). - where: optional extra SQL Server c… | `table` (string, required), `limit` (integer), `where` (string), `columns` (array), `filters` (object), `order_by` (array) |
| `run_query` | Run a read-only SQL Server query (SELECT or WITH) on the Sankhya database, for joins and aggregations read\_table cannot express. One statement only; data-changing statements are refused. Use TOP to bound large results; at most `limit` rows are returned (max 5000). | `sql` (string, required), `limit` (integer) |

### Write tools

| Tool | Description | Parameters |
| :- | :- | :- |
| `create_sales_order` | Create a Sankhya sales order (pedido de venda, TGFCAB + TGFITE) with CACSP.incluirNota. - codparc: partner code (find it with find\_partner). - codtipoper: TOP (operation type) configured as a sales order; codtipvenda: negotiation type; codemp: company; codvend: seller (0 = none)… | `items` (array, required), `codemp` (integer, required), `codparc` (integer, required), `codtipoper` (integer, required), `codtipvenda` (integer, required), `dtneg` (string), `tipmov` (string), `codvend` (integer), `dedupe_field` (string), `dedupe_value` (string), `header_fields` (object), `informar_preco` (boolean) |
| `write_record` | Insert or update one record of a Sankhya entity with DatasetSP.save. - entity: Sankhya entity (instance) name, e.g. "Parceiro" (TGFPAR), "Produto" (TGFPRO). describe\_table returns the entity name of a table. - values: \{FIELD: value} to write. - pk: primary key of the record to u… | `entity` (string, required), `values` (object, required), `pk` (object) |

## Troubleshooting

If your credentials expire or are revoked in the Sankhya Developer Area or Gateway Settings, the MCP will show that it needs to reconnect. You can update your API keys directly from the MCP's page to restore access.

If your agent encounters permission errors when trying to use tools like `read_table` or `run_query`, verify that the integration user has been granted access to the Sankhya Database Explorer (`DbExplorerSP`).

## Need help?

Contact our support team if you have trouble connecting Sankhya.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.