@procurementexpress.com/mcp 1.0.0 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude/skills/bump-version/SKILL.md +77 -0
- package/.claude/skills/commit/SKILL.md +73 -0
- package/.claude/skills/npm-publish/SKILL.md +65 -0
- package/.claude/skills/pex-approval-flows/SKILL.md +122 -0
- package/.claude/skills/pex-approval-flows/references/conditions.md +90 -0
- package/.claude/skills/pex-auth/SKILL.md +80 -0
- package/.claude/skills/pex-budgets/SKILL.md +73 -0
- package/.claude/skills/pex-companies/SKILL.md +113 -0
- package/.claude/skills/pex-departments/SKILL.md +61 -0
- package/.claude/skills/pex-invoices/SKILL.md +125 -0
- package/.claude/skills/pex-invoices/references/line-items.md +55 -0
- package/.claude/skills/pex-payments/SKILL.md +79 -0
- package/.claude/skills/pex-purchase-orders/SKILL.md +167 -0
- package/.claude/skills/pex-purchase-orders/references/line-items.md +53 -0
- package/.claude/skills/pex-purchase-orders/references/workflows.md +74 -0
- package/.claude/skills/pex-settings/SKILL.md +128 -0
- package/.claude/skills/pex-suppliers/SKILL.md +113 -0
- package/README.md +118 -25
- package/dist/api-client.d.ts +1 -0
- package/dist/api-client.js +3 -0
- package/dist/tools/approval-flows.js +130 -25
- package/dist/tools/budgets.js +30 -20
- package/dist/tools/comments.js +4 -4
- package/dist/tools/companies.js +57 -7
- package/dist/tools/departments.js +6 -6
- package/dist/tools/invoices.js +100 -31
- package/dist/tools/payments.js +45 -13
- package/dist/tools/products.js +10 -5
- package/dist/tools/purchase-orders.js +178 -35
- package/dist/tools/supplementary.js +57 -14
- package/dist/tools/suppliers.js +38 -19
- package/dist/tools/tax-rates.js +15 -9
- package/dist/tools/users.js +8 -5
- package/dist/tools/webhooks.js +59 -9
- package/package.json +5 -4
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: bump-version
|
|
3
|
+
description: Bump the npm package version, commit, and create a PR for merging before publishing. Use when the user asks to "bump version", "bump the version", "prepare a release", "version bump", "/bump-version", or when `/npm-publish` is invoked but the version hasn't been bumped yet. This skill ensures the version is incremented, committed, and merged to main via PR before publishing.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Bump Version
|
|
7
|
+
|
|
8
|
+
Bump the package version in package.json, commit the change, create a pull request, and guide the user to merge before publishing.
|
|
9
|
+
|
|
10
|
+
## Workflow
|
|
11
|
+
|
|
12
|
+
### 1. Pre-flight checks
|
|
13
|
+
|
|
14
|
+
Run in parallel:
|
|
15
|
+
- `git status` — working tree must be clean
|
|
16
|
+
- `git branch --show-current` — note the current branch
|
|
17
|
+
|
|
18
|
+
If the working tree is dirty, stop and tell the user to commit or stash changes first.
|
|
19
|
+
|
|
20
|
+
### 2. Determine version bump
|
|
21
|
+
|
|
22
|
+
Read the current version from package.json and ask the user which bump type:
|
|
23
|
+
|
|
24
|
+
| Type | When to use |
|
|
25
|
+
|------|-------------|
|
|
26
|
+
| `patch` (1.0.0 → 1.0.1) | Bug fixes, documentation changes |
|
|
27
|
+
| `minor` (1.0.0 → 1.1.0) | New tools, features, backwards-compatible changes |
|
|
28
|
+
| `major` (1.0.0 → 2.0.0) | Breaking changes to existing tools |
|
|
29
|
+
|
|
30
|
+
Show the current version and what the new version will be.
|
|
31
|
+
|
|
32
|
+
### 3. Create a release branch and bump
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
# Create and switch to release branch
|
|
36
|
+
git checkout -b release/v<new-version>
|
|
37
|
+
|
|
38
|
+
# Bump version in package.json (no git tag yet — tag after merge)
|
|
39
|
+
npm version <patch|minor|major> --no-git-tag-version
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
### 4. Commit the change
|
|
43
|
+
|
|
44
|
+
Stage the version bump and use the `/commit` skill:
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
git add package.json package-lock.json
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
Then invoke `/commit` — the commit message should follow the pattern: `Bump version to <new-version>`
|
|
51
|
+
|
|
52
|
+
### 5. Push and create PR
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
# Push the release branch
|
|
56
|
+
git push -u origin release/v<new-version>
|
|
57
|
+
|
|
58
|
+
# Create PR targeting main
|
|
59
|
+
gh pr create --base main --title "Release v<new-version>" --body "Bump package version to <new-version> for npm publish."
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
If `gh` CLI is not available, provide the GitHub URL for manual PR creation.
|
|
63
|
+
|
|
64
|
+
### 6. Guide user to merge and publish
|
|
65
|
+
|
|
66
|
+
Tell the user:
|
|
67
|
+
|
|
68
|
+
> PR created. Please review and merge the PR to `main`, then run `/npm-publish` to publish the new version to npm.
|
|
69
|
+
|
|
70
|
+
Do NOT proceed with publishing — the user must merge the PR first.
|
|
71
|
+
|
|
72
|
+
## Rules
|
|
73
|
+
|
|
74
|
+
- Never create a git tag during bump — `/npm-publish` handles tagging after merge.
|
|
75
|
+
- Always use `--no-git-tag-version` with `npm version` to avoid premature tags.
|
|
76
|
+
- Always create a PR targeting `main` — never push directly to main.
|
|
77
|
+
- If already on a feature branch, create the release branch from it and target main.
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: commit
|
|
3
|
+
description: Create git commits from staged changes. Use when the user asks to commit, make a commit, git commit, save changes, or any variation of committing code. Triggers on requests like "commit this", "commit my changes", "/commit", or "make a commit".
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Commit
|
|
7
|
+
|
|
8
|
+
Create a git commit from staged changes with a generated message, confirmed by the user before execution.
|
|
9
|
+
|
|
10
|
+
## Workflow
|
|
11
|
+
|
|
12
|
+
1. **Check staged changes**
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
git diff --cached
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
If nothing is staged, inform the user and stop. Do NOT look at or consider untracked files.
|
|
19
|
+
|
|
20
|
+
2. **Update memory (if notable changes exist)**
|
|
21
|
+
|
|
22
|
+
Before generating the commit message, analyze the staged diff for notable changes worth remembering across sessions. Update the project's `MEMORY.md` file if any of the following are present:
|
|
23
|
+
|
|
24
|
+
- **New files/modules** — new components, services, utilities, or architectural additions
|
|
25
|
+
- **New dependencies** — packages added to package.json, Gemfile, requirements.txt, etc.
|
|
26
|
+
- **API changes** — new or modified endpoints, routes, or external integrations
|
|
27
|
+
- **Configuration changes** — new env vars, config files, build settings
|
|
28
|
+
- **Architectural patterns** — new design patterns, conventions, or structural decisions
|
|
29
|
+
- **Key learnings** — gotchas, workarounds, or constraints discovered during implementation
|
|
30
|
+
|
|
31
|
+
**How to update:**
|
|
32
|
+
|
|
33
|
+
- Read the existing `MEMORY.md` from the project's auto memory directory (path shown in system prompt as "persistent auto memory directory")
|
|
34
|
+
- Append or update entries concisely — use bullet points, keep each entry to 1-2 lines
|
|
35
|
+
- Organize by topic (e.g., "## Architecture", "## Dependencies", "## APIs")
|
|
36
|
+
- Remove outdated entries if the staged changes supersede them
|
|
37
|
+
- Keep total file under 200 lines (lines after 200 are truncated in system prompt)
|
|
38
|
+
- Do NOT add entries for trivial changes (typo fixes, formatting, minor refactors)
|
|
39
|
+
|
|
40
|
+
If no notable changes are detected, skip this step silently.
|
|
41
|
+
|
|
42
|
+
3. **Generate commit message**
|
|
43
|
+
|
|
44
|
+
Analyze only the staged diff to produce a concise commit message (1-2 sentences) that describes the "why" not the "what". Use imperative mood (e.g., "Add", "Fix", "Update").
|
|
45
|
+
|
|
46
|
+
4. **Confirm with user**
|
|
47
|
+
|
|
48
|
+
Present the generated message and ask the user to confirm before committing. If memory was updated, briefly mention what was recorded. Example:
|
|
49
|
+
|
|
50
|
+
> Memory updated: added new `git-worktree` skill to Architecture section.
|
|
51
|
+
>
|
|
52
|
+
> Proposed commit message:
|
|
53
|
+
>
|
|
54
|
+
> `Add git-worktree skill for parallel development`
|
|
55
|
+
>
|
|
56
|
+
> Proceed with this commit?
|
|
57
|
+
|
|
58
|
+
Wait for explicit user approval. If the user provides an alternative message, use that instead.
|
|
59
|
+
|
|
60
|
+
5. **Commit**
|
|
61
|
+
|
|
62
|
+
```bash
|
|
63
|
+
git commit -m "<confirmed message>"
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
## Rules
|
|
67
|
+
|
|
68
|
+
- Never include `Co-Authored-By` lines.
|
|
69
|
+
- Never include `Generated by` or `Generated with` lines.
|
|
70
|
+
- Never consider untracked files — only use `git diff --cached` for context.
|
|
71
|
+
- Never stage files automatically — only commit what is already staged.
|
|
72
|
+
- Always confirm the message with the user before running `git commit`.
|
|
73
|
+
- Use a HEREDOC when the message contains special characters or newlines.
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: npm-publish
|
|
3
|
+
description: Bump package version, create a git tag, and publish to npm. Use when the user asks to "publish", "release", "bump version", "npm publish", "create a release", "tag and publish", "/npm-publish", "new version", or any variation of releasing/publishing the package to npm.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# npm Publish
|
|
7
|
+
|
|
8
|
+
Bump the version in package.json, create a git tag, and publish `@procurementexpress.com/mcp` to npm.
|
|
9
|
+
|
|
10
|
+
## Workflow
|
|
11
|
+
|
|
12
|
+
### 1. Pre-flight checks
|
|
13
|
+
|
|
14
|
+
Run these in parallel:
|
|
15
|
+
- `git status` — working tree must be clean (no uncommitted changes)
|
|
16
|
+
- `git branch --show-current` — must be on `main` branch
|
|
17
|
+
- `npm whoami` — must be logged in to npm
|
|
18
|
+
- `npm test` — all tests must pass
|
|
19
|
+
|
|
20
|
+
If any check fails, stop and tell the user what to fix.
|
|
21
|
+
|
|
22
|
+
**Version check:** Compare the current version in package.json against the latest published version:
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
npm view @procurementexpress.com/mcp version
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
If the versions match (not yet bumped), stop and tell the user to run `/bump-version` first to bump the version, commit, and merge a PR to `main` before publishing.
|
|
29
|
+
|
|
30
|
+
### 2. Determine version bump
|
|
31
|
+
|
|
32
|
+
Ask the user which bump type they want:
|
|
33
|
+
|
|
34
|
+
| Type | When to use |
|
|
35
|
+
|------|-------------|
|
|
36
|
+
| `patch` (1.0.0 → 1.0.1) | Bug fixes, documentation changes |
|
|
37
|
+
| `minor` (1.0.0 → 1.1.0) | New tools, features, backwards-compatible changes |
|
|
38
|
+
| `major` (1.0.0 → 2.0.0) | Breaking changes to existing tools |
|
|
39
|
+
|
|
40
|
+
Show the current version from package.json and what the new version will be.
|
|
41
|
+
|
|
42
|
+
### 3. Bump, tag, and publish
|
|
43
|
+
|
|
44
|
+
Run these commands sequentially:
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
# Bump version in package.json and create git tag
|
|
48
|
+
npm version <patch|minor|major> -m "v%s"
|
|
49
|
+
|
|
50
|
+
# Push the commit and tag to remote
|
|
51
|
+
git push && git push --tags
|
|
52
|
+
|
|
53
|
+
# Publish to npm (prepublishOnly will auto-build)
|
|
54
|
+
npm publish
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
### 4. Verify
|
|
58
|
+
|
|
59
|
+
After publishing, confirm success:
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
npm view @procurementexpress.com/mcp version
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
Report the published version and the npm package URL: https://www.npmjs.com/package/@procurementexpress.com/mcp
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: pex:approval-flows
|
|
3
|
+
description: >
|
|
4
|
+
ProcurementExpress approval flow configuration. Use when creating, updating, publishing,
|
|
5
|
+
or managing approval flows and their steps, conditions, and runs. Approval flows automate
|
|
6
|
+
the routing of POs and invoices to the right approvers based on configurable conditions.
|
|
7
|
+
Routes to MCP tools: list_approval_flows, get_approval_flow, create_approval_flow,
|
|
8
|
+
update_approval_flow, delete_approval_flow, archive_approval_flow, publish_approval_flow,
|
|
9
|
+
unpublish_approval_flow, list_approval_flow_runs, get_approval_flow_entity,
|
|
10
|
+
list_approval_flow_versions, get_approval_flow_version_details, rerun_approval_flows.
|
|
11
|
+
Triggers on: approval flow, approval workflow, approval steps, approval conditions,
|
|
12
|
+
approval routing, publish flow, flow runs, flow version, flow history, rerun approval.
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
# ProcurementExpress Approval Flows
|
|
16
|
+
|
|
17
|
+
## Prerequisites
|
|
18
|
+
|
|
19
|
+
Authenticate (pex-auth) and set active company (pex-companies) first.
|
|
20
|
+
The company must have `approval_flow_enabled` in company settings.
|
|
21
|
+
|
|
22
|
+
## Tools Reference
|
|
23
|
+
|
|
24
|
+
### list_approval_flows
|
|
25
|
+
List active approval flows with search and pagination.
|
|
26
|
+
- **Params:**
|
|
27
|
+
- `search` (optional) — search by flow name
|
|
28
|
+
- `page` (optional, integer), `per_page` (optional, integer — 10, 20, 50, 100)
|
|
29
|
+
- `sort` (optional, e.g. "name", "created_at"), `direction` (optional, "asc"/"desc")
|
|
30
|
+
- **Returns:** `{ approval_flows: ApprovalFlow[], meta: PaginationMeta }`
|
|
31
|
+
|
|
32
|
+
### get_approval_flow
|
|
33
|
+
Get flow details including steps, approvers, and conditions.
|
|
34
|
+
- **Params:** `id` (required, integer)
|
|
35
|
+
- **Returns:** `ApprovalFlow`
|
|
36
|
+
|
|
37
|
+
### create_approval_flow
|
|
38
|
+
Create a flow with steps, approvers, and conditions. See [references/conditions.md](references/conditions.md).
|
|
39
|
+
- **Params:**
|
|
40
|
+
- `name` (required, string)
|
|
41
|
+
- `document_type` (required, integer) — `0` = purchase order, `1` = invoice
|
|
42
|
+
- `self_approval_allowed` (optional, boolean) — allow PO creator to self-approve
|
|
43
|
+
- `steps` (required, array) — approval steps executed in step_no order:
|
|
44
|
+
- `step_no` (required, integer) — execution order
|
|
45
|
+
- `all_should_approve` (required, boolean) — true=all approvers, false=any one
|
|
46
|
+
- `approver_user_ids` (required, integer array) — approver user IDs
|
|
47
|
+
- `conditions` (optional, array) — step-level conditions (see [references/conditions.md](references/conditions.md))
|
|
48
|
+
- `conditions` (optional, array) — flow-level conditions that determine which documents match
|
|
49
|
+
- **Returns:** `ApprovalFlow`
|
|
50
|
+
|
|
51
|
+
### update_approval_flow
|
|
52
|
+
Update a flow. Include `id` on steps/conditions to update existing, omit for new, `_destroy: true` to remove.
|
|
53
|
+
- **Params:** `id` (required) + any create params
|
|
54
|
+
- **Returns:** `ApprovalFlow`
|
|
55
|
+
|
|
56
|
+
### delete_approval_flow
|
|
57
|
+
Permanently delete a flow.
|
|
58
|
+
- **Params:** `id` (required, integer)
|
|
59
|
+
|
|
60
|
+
### archive_approval_flow
|
|
61
|
+
Soft-delete (can be restored).
|
|
62
|
+
- **Params:** `id` (required, integer)
|
|
63
|
+
|
|
64
|
+
### publish_approval_flow
|
|
65
|
+
Make a flow active. New POs/invoices will use this flow.
|
|
66
|
+
- **Params:** `id` (required, integer)
|
|
67
|
+
|
|
68
|
+
### unpublish_approval_flow
|
|
69
|
+
Deactivate a flow. Existing runs continue but new documents won't use it.
|
|
70
|
+
- **Params:** `id` (required, integer)
|
|
71
|
+
|
|
72
|
+
### list_approval_flow_runs
|
|
73
|
+
List documents that went through this flow with status and date filters.
|
|
74
|
+
- **Params:**
|
|
75
|
+
- `id` (required, integer) — flow ID
|
|
76
|
+
- `status` (optional) — `"in_progress"`, `"completed"`, `"rejected"`
|
|
77
|
+
- `keyword` (optional) — search keyword
|
|
78
|
+
- `date_range` (optional) — `"24h"`, `"7d"`, `"30d"`, `"60d"`, `"custom"`
|
|
79
|
+
- `date_from`, `date_to` (optional) — for custom range
|
|
80
|
+
- `page`, `per_page` (optional)
|
|
81
|
+
- **Returns:** Paginated flow run results
|
|
82
|
+
|
|
83
|
+
## ApprovalFlow Response Fields
|
|
84
|
+
|
|
85
|
+
- `id`, `name`, `document_type` (0=PO, 1=invoice), `self_approval_allowed`
|
|
86
|
+
- `company_id`, `version_no`, `archived`, `status`
|
|
87
|
+
- Counts: `in_progress_count`, `completed_count`, `rejected_count`, `total_runs_count`
|
|
88
|
+
- `approval_steps[]` — each has: id, step_no, all_should_approve, approval_step_approvers[]
|
|
89
|
+
- Each approver: id, user_id, user_name, user_email
|
|
90
|
+
- `approval_conditions[]` — flow-level conditions
|
|
91
|
+
- `created_at`, `updated_at`
|
|
92
|
+
|
|
93
|
+
## Version & Entity Tools
|
|
94
|
+
|
|
95
|
+
### get_approval_flow_entity
|
|
96
|
+
Get details about a specific PO or invoice that went through a flow.
|
|
97
|
+
- **Params:** `id` (required, integer — flow ID), `entity_id` (required, integer — PO or invoice ID)
|
|
98
|
+
- **Returns:** Entity details with approval status
|
|
99
|
+
|
|
100
|
+
### list_approval_flow_versions
|
|
101
|
+
List all version history of an approval flow.
|
|
102
|
+
- **Params:** `id` (required, integer — flow ID)
|
|
103
|
+
- **Returns:** Version history array
|
|
104
|
+
|
|
105
|
+
### get_approval_flow_version_details
|
|
106
|
+
Get full details of a specific flow version.
|
|
107
|
+
- **Params:** `id` (required, integer — flow ID), `version_id` (required, integer)
|
|
108
|
+
- **Returns:** Version details with steps and conditions
|
|
109
|
+
|
|
110
|
+
### rerun_approval_flows
|
|
111
|
+
Batch rerun approval flows for multiple POs and/or invoices. Use when flow rules have changed.
|
|
112
|
+
- **Params:**
|
|
113
|
+
- `order_ids` (optional, integer array) — PO IDs to rerun flows for
|
|
114
|
+
- `invoice_ids` (optional, integer array) — invoice IDs to rerun flows for
|
|
115
|
+
- At least one of `order_ids` or `invoice_ids` should be provided
|
|
116
|
+
|
|
117
|
+
## Flow-Level vs Step-Level Conditions
|
|
118
|
+
|
|
119
|
+
- **Flow-level conditions** determine WHICH documents match this flow (e.g., "only POs from Engineering department")
|
|
120
|
+
- **Step-level conditions** determine WHICH steps activate for a matching document (e.g., "step 2 only if amount > $10,000")
|
|
121
|
+
|
|
122
|
+
Both use the same condition schema. See [references/conditions.md](references/conditions.md).
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
# Approval Flow Conditions
|
|
2
|
+
|
|
3
|
+
## Condition Schema
|
|
4
|
+
|
|
5
|
+
Each condition in the `conditions` array accepts:
|
|
6
|
+
|
|
7
|
+
| Field | Type | Required | Description |
|
|
8
|
+
|-------|------|----------|-------------|
|
|
9
|
+
| `id` | integer | For updates | Existing condition ID |
|
|
10
|
+
| `property` | string | Yes | What to evaluate (see Properties below) |
|
|
11
|
+
| `operator` | string | Yes | How to compare (see Operators below) |
|
|
12
|
+
| `value` | string | Yes | Value to compare against |
|
|
13
|
+
| `custom_field_id` | integer | Only for custom fields | Custom field ID |
|
|
14
|
+
| `_destroy` | boolean | No | Set true to remove (updates only) |
|
|
15
|
+
|
|
16
|
+
## Properties
|
|
17
|
+
|
|
18
|
+
| Property | Description | Value Format |
|
|
19
|
+
|----------|-------------|-------------|
|
|
20
|
+
| `budget` | Budget ID | Single budget ID |
|
|
21
|
+
| `department` | Department ID | Single department ID |
|
|
22
|
+
| `supplier` | Supplier ID | Single supplier ID |
|
|
23
|
+
| `requester` | Requester user ID | Single user ID |
|
|
24
|
+
| `gross_amount` | Gross total amount | Numeric string |
|
|
25
|
+
| `net_amount` | Net total amount | Numeric string |
|
|
26
|
+
| `custom_field_<id>` | Custom field value | Depends on field type |
|
|
27
|
+
|
|
28
|
+
## Operators
|
|
29
|
+
|
|
30
|
+
| Operator | Use With |
|
|
31
|
+
|----------|----------|
|
|
32
|
+
| `equals` | All properties |
|
|
33
|
+
| `not_equals` | All properties |
|
|
34
|
+
| `greater_than` | Amount properties |
|
|
35
|
+
| `less_than` | Amount properties |
|
|
36
|
+
| `is_any_of` | ID properties (comma-separated IDs) |
|
|
37
|
+
| `is_none_of` | ID properties (comma-separated IDs) |
|
|
38
|
+
| `exists` | Custom field properties (check if value exists) |
|
|
39
|
+
| `not_exists` | Custom field properties (check if value is empty) |
|
|
40
|
+
| `contains` | Text/ID properties (comma-separated IDs or substring) |
|
|
41
|
+
| `not_contains` | Text/ID properties (comma-separated IDs or substring) |
|
|
42
|
+
|
|
43
|
+
Operators are passed as string values (e.g. `"equals"`, `"greater_than"`).
|
|
44
|
+
|
|
45
|
+
## Examples
|
|
46
|
+
|
|
47
|
+
**Flow matches POs from Engineering department (ID: 5):**
|
|
48
|
+
```json
|
|
49
|
+
{ "property": "department", "operator": "0", "value": "5" }
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
**Step activates when gross amount > $10,000:**
|
|
53
|
+
```json
|
|
54
|
+
{ "property": "gross_amount", "operator": "2", "value": "10000" }
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
**Flow matches POs from suppliers 1, 2, or 3:**
|
|
58
|
+
```json
|
|
59
|
+
{ "property": "supplier", "operator": "4", "value": "1,2,3" }
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
**Condition on custom field (ID: 42) equals "urgent":**
|
|
63
|
+
```json
|
|
64
|
+
{ "property": "custom_field_42", "operator": "0", "value": "urgent", "custom_field_id": 42 }
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
## Approval Step Schema
|
|
68
|
+
|
|
69
|
+
Each step in the `steps` array:
|
|
70
|
+
|
|
71
|
+
| Field | Type | Required | Description |
|
|
72
|
+
|-------|------|----------|-------------|
|
|
73
|
+
| `id` | integer | For updates | Existing step ID |
|
|
74
|
+
| `step_no` | integer | Yes | Execution order (1, 2, 3...) |
|
|
75
|
+
| `all_should_approve` | boolean | Yes | true = all approvers must approve, false = any one suffices |
|
|
76
|
+
| `approver_user_ids` | integer[] | Yes | User IDs of approvers for this step |
|
|
77
|
+
| `conditions` | array | No | Step-level conditions (same schema as above) |
|
|
78
|
+
| `_destroy` | boolean | No | Remove step (updates only) |
|
|
79
|
+
|
|
80
|
+
## Workflow: Create a Multi-Step Approval Flow
|
|
81
|
+
|
|
82
|
+
```
|
|
83
|
+
1. list_employees (pex-companies) → get approver user IDs
|
|
84
|
+
2. list_departments (pex-departments) → get department IDs for conditions
|
|
85
|
+
3. create_approval_flow with:
|
|
86
|
+
- name, document_type (0=PO or 1=invoice)
|
|
87
|
+
- steps with step_no ordering and approver assignments
|
|
88
|
+
- conditions for flow-level matching
|
|
89
|
+
4. publish_approval_flow → make it active
|
|
90
|
+
```
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: pex:auth
|
|
3
|
+
description: >
|
|
4
|
+
ProcurementExpress authentication and user profile management. Use when authenticating
|
|
5
|
+
to the ProcurementExpress API (V1 static token or V3 OAuth2 login), validating or revoking
|
|
6
|
+
tokens, or managing the current user's profile. Routes to MCP tools: authenticate,
|
|
7
|
+
validate_token, revoke_token, get_current_user, update_current_user. Triggers on: login,
|
|
8
|
+
sign in, authenticate, token, session, user profile, my account, change password.
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
# ProcurementExpress Authentication
|
|
12
|
+
|
|
13
|
+
## Prerequisites
|
|
14
|
+
|
|
15
|
+
Authentication is ALWAYS required before any other ProcurementExpress MCP tool call.
|
|
16
|
+
After authenticating, call `set_active_company` (pex-companies skill) to set the working company.
|
|
17
|
+
|
|
18
|
+
## Authentication Modes
|
|
19
|
+
|
|
20
|
+
The API version is set via `PROCUREMENTEXPRESS_API_VERSION` env var (`v1` or `v3`, default: `v1`).
|
|
21
|
+
|
|
22
|
+
### V1 Authentication (Static Token)
|
|
23
|
+
|
|
24
|
+
Call `authenticate` with:
|
|
25
|
+
- `authentication_token` (optional if `PROCUREMENTEXPRESS_AUTH_TOKEN` env var is set)
|
|
26
|
+
- `company_id` (optional if `PROCUREMENTEXPRESS_COMPANY_ID` env var is set)
|
|
27
|
+
|
|
28
|
+
V1 tokens never expire. If both env vars are set, calling `authenticate` with no args works.
|
|
29
|
+
|
|
30
|
+
### V3 Authentication (OAuth2)
|
|
31
|
+
|
|
32
|
+
Call `authenticate` with:
|
|
33
|
+
- `email` (required) — user's email address
|
|
34
|
+
- `password` (required) — user's password
|
|
35
|
+
|
|
36
|
+
Returns an access token with expiry time. V3 requires `PROCUREMENTEXPRESS_CLIENT_ID` and
|
|
37
|
+
`PROCUREMENTEXPRESS_CLIENT_SECRET` env vars for the OAuth2 client credentials.
|
|
38
|
+
|
|
39
|
+
**Note:** OTP/2FA is not currently supported by the MCP server. If the user's account has
|
|
40
|
+
2FA enabled, V1 authentication with a static token should be used instead.
|
|
41
|
+
|
|
42
|
+
## Tools Reference
|
|
43
|
+
|
|
44
|
+
### authenticate
|
|
45
|
+
Authenticate to the ProcurementExpress API.
|
|
46
|
+
- **V1 params:** `authentication_token` (optional), `company_id` (optional)
|
|
47
|
+
- **V3 params:** `email` (required), `password` (required)
|
|
48
|
+
- **Returns:** Confirmation message (V1) or token with expiry info (V3)
|
|
49
|
+
|
|
50
|
+
### validate_token
|
|
51
|
+
Check if the current authentication token is valid.
|
|
52
|
+
- **Params:** None
|
|
53
|
+
- **Returns:** V1 returns `User` object, V3 returns `TokenInfo` (resource_owner_id, scopes, expires_in_seconds)
|
|
54
|
+
|
|
55
|
+
### revoke_token
|
|
56
|
+
End the current session.
|
|
57
|
+
- **Params:** None
|
|
58
|
+
- **V1:** Clears token locally (no server call)
|
|
59
|
+
- **V3:** Revokes token on server via OAuth2 revocation endpoint, then clears locally
|
|
60
|
+
|
|
61
|
+
### get_current_user
|
|
62
|
+
Get the authenticated user's profile including company memberships and roles.
|
|
63
|
+
- **Params:** None
|
|
64
|
+
- **Returns:** `User` object with fields: id, email, name, phone_number, setup_incomplete, employer_id, approval_limit, companies[]
|
|
65
|
+
- Each company in `companies[]` has: id, name, roles[], is_locked, in_trial, trial_expired, remaining_trial_days
|
|
66
|
+
|
|
67
|
+
### update_current_user
|
|
68
|
+
Update the authenticated user's profile.
|
|
69
|
+
- **Params (all optional):** `email`, `name`, `first_name`, `last_name`, `phone_number`, `password`, `password_confirmation`
|
|
70
|
+
- When changing password, both `password` and `password_confirmation` are required
|
|
71
|
+
- **Returns:** Updated `User` object
|
|
72
|
+
|
|
73
|
+
## Typical Workflow
|
|
74
|
+
|
|
75
|
+
```
|
|
76
|
+
1. authenticate → get session
|
|
77
|
+
2. get_current_user → see available companies
|
|
78
|
+
3. set_active_company (pex-companies) → pick a company
|
|
79
|
+
4. Start using other ProcurementExpress tools
|
|
80
|
+
```
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: pex:budgets
|
|
3
|
+
description: >
|
|
4
|
+
ProcurementExpress budget management. Use when listing, viewing, creating, or updating
|
|
5
|
+
budgets (cost centers). Routes to MCP tools: list_budgets, get_budget, create_budget,
|
|
6
|
+
update_budget. Triggers on: budget, cost center, spending limit, budget allocation,
|
|
7
|
+
remaining budget, budget approvers.
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# ProcurementExpress Budgets
|
|
11
|
+
|
|
12
|
+
## Prerequisites
|
|
13
|
+
|
|
14
|
+
Authenticate (pex-auth) and set active company (pex-companies) first.
|
|
15
|
+
|
|
16
|
+
## Tools Reference
|
|
17
|
+
|
|
18
|
+
### list_budgets
|
|
19
|
+
List budgets for the current company.
|
|
20
|
+
- **Params:**
|
|
21
|
+
- `department_id` (optional, integer) — filter by department
|
|
22
|
+
- `archived` (optional, boolean, default: false)
|
|
23
|
+
- `show_mappings` (optional, boolean) — include third-party ID mappings
|
|
24
|
+
- **Returns:** `Budget[]`
|
|
25
|
+
|
|
26
|
+
### get_budget
|
|
27
|
+
Get a specific budget with remaining amount and associations.
|
|
28
|
+
- **Params:** `id` (required, integer)
|
|
29
|
+
- **Returns:** `Budget`
|
|
30
|
+
|
|
31
|
+
### create_budget
|
|
32
|
+
Create a new budget.
|
|
33
|
+
- **Params:**
|
|
34
|
+
- `name` (required, string)
|
|
35
|
+
- `amount` (required, number)
|
|
36
|
+
- `currency_id` (optional, integer) — defaults to company currency
|
|
37
|
+
- `creator_id` (optional, integer)
|
|
38
|
+
- `cost_code` (optional, string)
|
|
39
|
+
- `cost_type` (optional, string)
|
|
40
|
+
- `start_date` (optional, string) — must match company `date_format` setting
|
|
41
|
+
- `end_date` (optional, string) — must match company `date_format` setting
|
|
42
|
+
- `allow_anyone_to_approve_a_po` (optional, boolean)
|
|
43
|
+
- `chart_of_account_id` (optional, integer) — GL code
|
|
44
|
+
- `qbo_class` (optional, string) — QuickBooks class
|
|
45
|
+
- `approver_ids` (optional, integer array)
|
|
46
|
+
- `department_ids` (optional, integer array)
|
|
47
|
+
- `custom_field_values_attributes` (optional, array) — budget-level custom field values:
|
|
48
|
+
- `id` (optional, integer — for updates), `value` (required, string), `custom_field_id` (required, integer)
|
|
49
|
+
- Get available custom fields from `get_company_details` (pex-companies) → `custom_fields[]`
|
|
50
|
+
- **Returns:** `Budget`
|
|
51
|
+
|
|
52
|
+
### update_budget
|
|
53
|
+
Update an existing budget. Same params as create except `id` is required, all others optional.
|
|
54
|
+
- **Params:** `id` (required) + any create_budget params
|
|
55
|
+
- **Returns:** `Budget`
|
|
56
|
+
|
|
57
|
+
## Budget Response Fields
|
|
58
|
+
|
|
59
|
+
- `id`, `name`, `amount`, `currency_id`, `cost_code`, `cost_type`, `archived`
|
|
60
|
+
- `base_amount`, `base_rate` — converted to company base currency
|
|
61
|
+
- `remaining_amount` — budget minus approved/paid POs
|
|
62
|
+
- `summary` — spending summary
|
|
63
|
+
- `approved_this_month` — amount approved in current month
|
|
64
|
+
- `allow_anyone_to_approve_a_po` — bypass approver restrictions
|
|
65
|
+
- `start_date`, `end_date` — budget period
|
|
66
|
+
- `creator_id`, `approver_ids[]`, `department_ids[]`
|
|
67
|
+
- `chart_of_account_id`, `chart_of_account_name`
|
|
68
|
+
- `third_party_id_mappings` — external system IDs
|
|
69
|
+
- `created_at`, `updated_at`
|
|
70
|
+
|
|
71
|
+
## Date Format
|
|
72
|
+
|
|
73
|
+
All date fields must match the company's `date_format` setting. Get it via `get_company_details` (pex-companies skill) from `company_setting.date_format`.
|