@myleapp/myle-mcp 0.0.0-stage → 0.1.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/LICENSE +55 -0
- package/README.md +202 -2
- package/dist/index.d.ts +13 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +56 -0
- package/dist/index.js.map +1 -0
- package/dist/server.d.ts +20 -0
- package/dist/server.d.ts.map +1 -0
- package/dist/server.js +69 -0
- package/dist/server.js.map +1 -0
- package/dist/tools.d.ts +30 -0
- package/dist/tools.d.ts.map +1 -0
- package/dist/tools.js +8518 -0
- package/dist/tools.js.map +1 -0
- package/dist/version.d.ts +3 -0
- package/dist/version.d.ts.map +1 -0
- package/dist/version.js +5 -0
- package/dist/version.js.map +1 -0
- package/package.json +51 -4
package/LICENSE
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
|
|
5
|
+
http://www.apache.org/licenses/
|
|
6
|
+
|
|
7
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
8
|
+
|
|
9
|
+
1. Definitions.
|
|
10
|
+
|
|
11
|
+
"License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.
|
|
16
|
+
|
|
17
|
+
"You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License.
|
|
18
|
+
|
|
19
|
+
"Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files.
|
|
20
|
+
|
|
21
|
+
"Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types.
|
|
22
|
+
|
|
23
|
+
"Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below).
|
|
24
|
+
|
|
25
|
+
"Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof.
|
|
26
|
+
|
|
27
|
+
"Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution."
|
|
28
|
+
|
|
29
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work.
|
|
30
|
+
|
|
31
|
+
2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form.
|
|
32
|
+
|
|
33
|
+
3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed.
|
|
34
|
+
|
|
35
|
+
4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions:
|
|
36
|
+
|
|
37
|
+
You must give any other recipients of the Work or Derivative Works a copy of this License; and
|
|
38
|
+
|
|
39
|
+
You must cause any modified files to carry prominent notices stating that You changed the files; and
|
|
40
|
+
|
|
41
|
+
You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and
|
|
42
|
+
|
|
43
|
+
If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License.
|
|
44
|
+
|
|
45
|
+
5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions.
|
|
46
|
+
|
|
47
|
+
6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file.
|
|
48
|
+
|
|
49
|
+
7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License.
|
|
50
|
+
|
|
51
|
+
8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages.
|
|
52
|
+
|
|
53
|
+
9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability.
|
|
54
|
+
|
|
55
|
+
END OF TERMS AND CONDITIONS
|
package/README.md
CHANGED
|
@@ -1,3 +1,203 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @myleapp/myle-mcp
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
The MCP server of the [Myle API](https://developers.myleapp.fr): one tool per operation of the API, for
|
|
4
|
+
Claude and any other MCP client. It runs on the official TypeScript SDK (`@myleapp/myle`), authenticates
|
|
5
|
+
with a Myle API key, and is **read-only by default**: the tools that create or change something are
|
|
6
|
+
offered only with `--allow-writes`, and deletions are marked destructive (`destructiveHint`), so a client
|
|
7
|
+
asks before running them.
|
|
8
|
+
|
|
9
|
+
Built against `Myle-API-Version: 2026-11-21`.
|
|
10
|
+
|
|
11
|
+
## Claude Code
|
|
12
|
+
|
|
13
|
+
```sh
|
|
14
|
+
claude mcp add myle --env MYLE_API_KEY=<your key> -- npx -y @myleapp/myle-mcp
|
|
15
|
+
# with writes:
|
|
16
|
+
claude mcp add myle --env MYLE_API_KEY=<your key> -- npx -y @myleapp/myle-mcp --allow-writes
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
Or in a project's `.mcp.json`, the key taken from your environment:
|
|
20
|
+
|
|
21
|
+
```json
|
|
22
|
+
{
|
|
23
|
+
"mcpServers": {
|
|
24
|
+
"myle": {
|
|
25
|
+
"command": "npx",
|
|
26
|
+
"args": ["-y", "@myleapp/myle-mcp"],
|
|
27
|
+
"env": { "MYLE_API_KEY": "${MYLE_API_KEY}" }
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## Claude Desktop
|
|
34
|
+
|
|
35
|
+
In `claude_desktop_config.json` (Settings → Developer → Edit Config):
|
|
36
|
+
|
|
37
|
+
```json
|
|
38
|
+
{
|
|
39
|
+
"mcpServers": {
|
|
40
|
+
"myle": {
|
|
41
|
+
"command": "npx",
|
|
42
|
+
"args": ["-y", "@myleapp/myle-mcp"],
|
|
43
|
+
"env": { "MYLE_API_KEY": "<your key>" }
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
Add `"--allow-writes"` to `args` to let Claude create and change data. Restart Claude Desktop after editing.
|
|
50
|
+
|
|
51
|
+
## The key
|
|
52
|
+
|
|
53
|
+
Use an **organization key** (it acts as its own robot account, with the rights configured on it) and give
|
|
54
|
+
it only the rights the assistant needs: a key with list rights only cannot write, whatever the server allows.
|
|
55
|
+
A user key works too (it acts as you). Keys are created in Myle, « Clés d'API ». The operations that manage
|
|
56
|
+
keys accept a signed-in session only, so they have no tool here.
|
|
57
|
+
|
|
58
|
+
Environment: `MYLE_API_KEY` (required), `MYLE_BASE_URL` (another API address), `MYLE_API_VERSION` (another
|
|
59
|
+
contract date), `MYLE_ACCEPT_LANGUAGE` (`fr` or `en`: the language of error sentences).
|
|
60
|
+
|
|
61
|
+
## Tools
|
|
62
|
+
|
|
63
|
+
Each tool answers JSON: `{etag, data}` for one resource, `{data, nextCursor}` for a page of a list (pass
|
|
64
|
+
`nextCursor` as `cursor` for the next), `{done: true}` for a deletion. An error answers
|
|
65
|
+
`{code, error, context, status, requestId}`.
|
|
66
|
+
|
|
67
|
+
| Tool | Writes | Operation |
|
|
68
|
+
|---|---|---|
|
|
69
|
+
| `get_me` | | `GET /me`: Get the signed-in user |
|
|
70
|
+
| `get_organization` | | `GET /organizations/{id}`: Get an organization |
|
|
71
|
+
| `list_rights` | | `GET /rights`: List the rights |
|
|
72
|
+
| `list_products` | | `GET /organizations/{id}/products`: List the products |
|
|
73
|
+
| `create_product` | yes | `POST /organizations/{id}/products`: Create a product |
|
|
74
|
+
| `list_product_tags` | | `GET /organizations/{id}/products/tags`: List the products' tags |
|
|
75
|
+
| `get_product` | | `GET /organizations/{id}/products/{productId}`: Get a product |
|
|
76
|
+
| `delete_product` | deletes | `DELETE /organizations/{id}/products/{productId}`: Delete a product |
|
|
77
|
+
| `update_product` | yes | `PATCH /organizations/{id}/products/{productId}`: Change a product |
|
|
78
|
+
| `get_product_neighbors` | | `GET /organizations/{id}/products/{productId}/neighbors`: Get a product's neighbors in the list |
|
|
79
|
+
| `create_product_barcode` | yes | `POST /organizations/{id}/products/{productId}/barcodes`: Add a barcode to a product |
|
|
80
|
+
| `get_product_barcode` | | `GET /organizations/{id}/products/{productId}/barcodes/{barcodeId}`: Get a barcode of a product |
|
|
81
|
+
| `delete_product_barcode` | deletes | `DELETE /organizations/{id}/products/{productId}/barcodes/{barcodeId}`: Remove a barcode from a product |
|
|
82
|
+
| `update_product_barcode` | yes | `PATCH /organizations/{id}/products/{productId}/barcodes/{barcodeId}`: Change a barcode of a product |
|
|
83
|
+
| `search_products` | | `GET /products`: Search the products across organizations |
|
|
84
|
+
| `list_company_tags` | | `GET /organizations/{id}/companies/tags`: List the companies' tags |
|
|
85
|
+
| `get_company_neighbors` | | `GET /organizations/{id}/companies/{companyId}/neighbors`: Get a company's neighbors in a list |
|
|
86
|
+
| `create_company_email_address` | yes | `POST /organizations/{id}/companies/{companyId}/email-addresses`: Add an e-mail address to a company |
|
|
87
|
+
| `delete_company_email_address` | deletes | `DELETE /organizations/{id}/companies/{companyId}/email-addresses/{companyEmailAddressId}`: Remove an e-mail address from a company |
|
|
88
|
+
| `update_company_email_address` | yes | `PATCH /organizations/{id}/companies/{companyId}/email-addresses/{companyEmailAddressId}`: Change an e-mail address of a company |
|
|
89
|
+
| `resubscribe_company_email_address` | yes | `POST /organizations/{id}/companies/{companyId}/email-addresses/{companyEmailAddressId}/resubscribe`: Subscribe an e-mail address of a company again |
|
|
90
|
+
| `create_company_postal_address` | yes | `POST /organizations/{id}/companies/{companyId}/postal-addresses`: Add a postal address to a company |
|
|
91
|
+
| `get_company_postal_address` | | `GET /organizations/{id}/companies/{companyId}/postal-addresses/{postalAddressId}`: Get a postal address of a company |
|
|
92
|
+
| `delete_company_postal_address` | deletes | `DELETE /organizations/{id}/companies/{companyId}/postal-addresses/{postalAddressId}`: Remove a postal address from a company |
|
|
93
|
+
| `update_company_postal_address` | yes | `PATCH /organizations/{id}/companies/{companyId}/postal-addresses/{postalAddressId}`: Change a postal address of a company |
|
|
94
|
+
| `list_companies` | | `GET /organizations/{id}/companies`: List the companies |
|
|
95
|
+
| `create_company` | yes | `POST /organizations/{id}/companies`: Create a company |
|
|
96
|
+
| `get_company` | | `GET /organizations/{id}/companies/{companyId}`: Get a company |
|
|
97
|
+
| `delete_company` | deletes | `DELETE /organizations/{id}/companies/{companyId}`: Delete a company |
|
|
98
|
+
| `update_company` | yes | `PATCH /organizations/{id}/companies/{companyId}`: Change a company |
|
|
99
|
+
| `search_companies` | | `GET /companies`: Search the companies across organizations |
|
|
100
|
+
| `list_invoices` | | `GET /organizations/{id}/invoices`: List the invoices |
|
|
101
|
+
| `create_invoice` | yes | `POST /organizations/{id}/invoices`: Create a draft invoice |
|
|
102
|
+
| `list_invoice_tags` | | `GET /organizations/{id}/invoices/tags`: List the invoices' tags |
|
|
103
|
+
| `get_invoice_eligibility` | | `GET /organizations/{id}/invoices/eligibility`: Count what each batch would act on |
|
|
104
|
+
| `get_invoice` | | `GET /organizations/{id}/invoices/{invoiceId}`: Get an invoice |
|
|
105
|
+
| `delete_invoice` | deletes | `DELETE /organizations/{id}/invoices/{invoiceId}`: Delete a draft invoice |
|
|
106
|
+
| `update_invoice` | yes | `PATCH /organizations/{id}/invoices/{invoiceId}`: Change a draft invoice |
|
|
107
|
+
| `get_invoice_neighbors` | | `GET /organizations/{id}/invoices/{invoiceId}/neighbors`: Get an invoice's neighbors in the list |
|
|
108
|
+
| `validate_invoice` | yes | `POST /organizations/{id}/invoices/{invoiceId}/validate`: Validate an invoice |
|
|
109
|
+
| `batch_validate_invoices` | yes | `POST /organizations/{id}/invoices/batch-validate`: Validate several invoices |
|
|
110
|
+
| `batch_share_invoices` | yes | `POST /organizations/{id}/invoices/batch-share`: Mark several invoices as handed to their customers |
|
|
111
|
+
| `batch_create_invoice_payments` | yes | `POST /organizations/{id}/invoices/batch-payments`: Record payments on several invoices |
|
|
112
|
+
| `batch_create_invoice_credit_notes` | yes | `POST /organizations/{id}/invoices/batch-credit-notes`: Cancel several invoices with credit notes |
|
|
113
|
+
| `batch_duplicate_invoices` | yes | `POST /organizations/{id}/invoices/batch-duplicate`: Duplicate several invoices as drafts |
|
|
114
|
+
| `send_invoice` | yes | `POST /organizations/{id}/invoices/{invoiceId}/send`: Send an invoice by e-mail |
|
|
115
|
+
| `create_invoice_credit_note` | yes | `POST /organizations/{id}/invoices/{invoiceId}/credit-notes`: Cancel an invoice with a credit note |
|
|
116
|
+
| `edit_invoice` | yes | `POST /organizations/{id}/invoices/{invoiceId}/edit`: Change a draft's lines, customer or description |
|
|
117
|
+
| `get_invoice_editability` | | `GET /organizations/{id}/invoices/{invoiceId}/editability`: Tell whether a draft can still be changed |
|
|
118
|
+
| `share_invoice` | yes | `POST /organizations/{id}/invoices/{invoiceId}/share`: Mark an invoice as handed to its customer |
|
|
119
|
+
| `mark_invoice_lost` | yes | `POST /organizations/{id}/invoices/{invoiceId}/mark-lost`: Write an invoice off as lost |
|
|
120
|
+
| `unpay_invoice` | yes | `POST /organizations/{id}/invoices/{invoiceId}/unpay`: Take an invoice back to unpaid |
|
|
121
|
+
| `reinvoice_invoice` | yes | `POST /organizations/{id}/invoices/{invoiceId}/reinvoice`: Re-bill a credit note as a new draft |
|
|
122
|
+
| `list_invoice_correctable_invoices` | | `GET /organizations/{id}/invoices/{invoiceId}/correctable-invoices`: List the invoices a credit note can correct |
|
|
123
|
+
| `set_invoice_corrected_invoice` | yes | `POST /organizations/{id}/invoices/{invoiceId}/set-corrected-invoice`: Name the invoice a credit note corrects |
|
|
124
|
+
| `list_invoice_status_history` | | `GET /organizations/{id}/invoices/{invoiceId}/status-history`: List an invoice's status history |
|
|
125
|
+
| `list_invoice_payments` | | `GET /organizations/{id}/invoices/{invoiceId}/payments`: List an invoice's payments |
|
|
126
|
+
| `create_invoice_payment` | yes | `POST /organizations/{id}/invoices/{invoiceId}/payments`: Record a payment on an invoice |
|
|
127
|
+
| `get_invoice_payment` | | `GET /organizations/{id}/invoices/{invoiceId}/payments/{paymentId}`: Get a payment of an invoice |
|
|
128
|
+
| `delete_invoice_payment` | deletes | `DELETE /organizations/{id}/invoices/{invoiceId}/payments/{paymentId}`: Remove a payment of an invoice |
|
|
129
|
+
| `search_invoices` | | `GET /invoices`: Search the invoices across organizations |
|
|
130
|
+
| `list_quotations` | | `GET /organizations/{id}/quotations`: List the quotations |
|
|
131
|
+
| `create_quotation` | yes | `POST /organizations/{id}/quotations`: Create a quotation |
|
|
132
|
+
| `list_quotation_tags` | | `GET /organizations/{id}/quotations/tags`: List the quotations' tags |
|
|
133
|
+
| `get_quotation_eligibility` | | `GET /organizations/{id}/quotations/eligibility`: Count what each batch would act on |
|
|
134
|
+
| `get_quotation` | | `GET /organizations/{id}/quotations/{quotationId}`: Get a quotation |
|
|
135
|
+
| `delete_quotation` | deletes | `DELETE /organizations/{id}/quotations/{quotationId}`: Delete a quotation |
|
|
136
|
+
| `update_quotation` | yes | `PATCH /organizations/{id}/quotations/{quotationId}`: Change a quotation |
|
|
137
|
+
| `get_quotation_neighbors` | | `GET /organizations/{id}/quotations/{quotationId}/neighbors`: Get a quotation's neighbors in the list |
|
|
138
|
+
| `edit_quotation` | yes | `POST /organizations/{id}/quotations/{quotationId}/edit`: Change a quotation's lines, customer or description |
|
|
139
|
+
| `get_quotation_editability` | | `GET /organizations/{id}/quotations/{quotationId}/editability`: Tell whether a quotation can still be changed |
|
|
140
|
+
| `share_quotation` | yes | `POST /organizations/{id}/quotations/{quotationId}/share`: Mark a quotation as handed to its customer |
|
|
141
|
+
| `approve_quotation` | yes | `POST /organizations/{id}/quotations/{quotationId}/approve`: Record that the customer accepted a quotation |
|
|
142
|
+
| `batch_share_quotations` | yes | `POST /organizations/{id}/quotations/batch-share`: Mark several quotations as handed to their customers |
|
|
143
|
+
| `batch_approve_quotations` | yes | `POST /organizations/{id}/quotations/batch-approve`: Record that customers accepted several quotations |
|
|
144
|
+
| `batch_order_quotations` | yes | `POST /organizations/{id}/quotations/batch-order`: Turn several accepted quotations into orders |
|
|
145
|
+
| `cancel_quotation` | yes | `POST /organizations/{id}/quotations/{quotationId}/cancel`: Cancel a quotation (refused or withdrawn) |
|
|
146
|
+
| `extend_quotation` | yes | `POST /organizations/{id}/quotations/{quotationId}/extend`: Extend a quotation's validity |
|
|
147
|
+
| `order_quotation` | yes | `POST /organizations/{id}/quotations/{quotationId}/order`: Turn an accepted quotation into an order |
|
|
148
|
+
| `invoice_quotation` | yes | `POST /organizations/{id}/quotations/{quotationId}/invoice`: Bill an accepted quotation |
|
|
149
|
+
| `send_quotation` | yes | `POST /organizations/{id}/quotations/{quotationId}/send`: Send a quotation by e-mail |
|
|
150
|
+
| `list_quotation_status_history` | | `GET /organizations/{id}/quotations/{quotationId}/status-history`: List a quotation's status history |
|
|
151
|
+
| `search_quotations` | | `GET /quotations`: Search the quotations across organizations |
|
|
152
|
+
| `list_orders` | | `GET /organizations/{id}/orders`: List the orders |
|
|
153
|
+
| `create_order` | yes | `POST /organizations/{id}/orders`: Create an order |
|
|
154
|
+
| `list_order_tags` | | `GET /organizations/{id}/orders/tags`: List the orders' tags |
|
|
155
|
+
| `get_order_eligibility` | | `GET /organizations/{id}/orders/eligibility`: Count what each batch would act on |
|
|
156
|
+
| `get_order` | | `GET /organizations/{id}/orders/{orderId}`: Get an order |
|
|
157
|
+
| `delete_order` | deletes | `DELETE /organizations/{id}/orders/{orderId}`: Delete an order |
|
|
158
|
+
| `update_order` | yes | `PATCH /organizations/{id}/orders/{orderId}`: Change an order |
|
|
159
|
+
| `get_order_neighbors` | | `GET /organizations/{id}/orders/{orderId}/neighbors`: Get an order's neighbors in the list |
|
|
160
|
+
| `edit_order` | yes | `POST /organizations/{id}/orders/{orderId}/edit`: Change an order's lines, customer, delivery address or description |
|
|
161
|
+
| `get_order_editability` | | `GET /organizations/{id}/orders/{orderId}/editability`: Tell whether an order can still be changed |
|
|
162
|
+
| `share_order` | yes | `POST /organizations/{id}/orders/{orderId}/share`: Mark an order as handed to its customer |
|
|
163
|
+
| `approve_order` | yes | `POST /organizations/{id}/orders/{orderId}/approve`: Record that the customer confirmed an order |
|
|
164
|
+
| `mark_order_waiting_for_delivery` | yes | `POST /organizations/{id}/orders/{orderId}/mark-waiting-for-delivery`: Mark an order as prepared, waiting for its delivery |
|
|
165
|
+
| `cancel_order` | yes | `POST /organizations/{id}/orders/{orderId}/cancel`: Cancel an order |
|
|
166
|
+
| `batch_share_orders` | yes | `POST /organizations/{id}/orders/batch-share`: Mark several orders as handed to their customers |
|
|
167
|
+
| `batch_approve_orders` | yes | `POST /organizations/{id}/orders/batch-approve`: Record that customers confirmed several orders |
|
|
168
|
+
| `get_order_stock_availability` | | `GET /organizations/{id}/orders/{orderId}/stock-availability`: List the stocks an order's goods can leave from |
|
|
169
|
+
| `deliver_order` | yes | `POST /organizations/{id}/orders/{orderId}/deliver`: Deliver an order: make its delivery note |
|
|
170
|
+
| `invoice_order` | yes | `POST /organizations/{id}/orders/{orderId}/invoice`: Bill an order |
|
|
171
|
+
| `send_order` | yes | `POST /organizations/{id}/orders/{orderId}/send`: Send an order by e-mail |
|
|
172
|
+
| `list_order_status_history` | | `GET /organizations/{id}/orders/{orderId}/status-history`: List an order's status history |
|
|
173
|
+
| `search_orders` | | `GET /orders`: Search the orders across organizations |
|
|
174
|
+
| `get_delivery_note` | | `GET /organizations/{id}/delivery-notes/{deliveryNoteId}`: Get a delivery note |
|
|
175
|
+
| `get_einvoicing` | | `GET /organizations/{id}/einvoicing`: Get the organization's e-invoicing |
|
|
176
|
+
| `sync_einvoicing` | yes | `POST /organizations/{id}/einvoicing/sync`: Read the verification statuses from SuperPDP |
|
|
177
|
+
| `get_einvoicing_address` | | `GET /organizations/{id}/einvoicing/address`: Get the organization's electronic address |
|
|
178
|
+
| `replace_einvoicing_address` | yes | `PUT /organizations/{id}/einvoicing/address`: Choose the organization's electronic address |
|
|
179
|
+
| `get_company_einvoicing_routing` | | `GET /organizations/{id}/companies/{companyId}/einvoicing-routing`: Get a customer's e-invoicing routing |
|
|
180
|
+
| `replace_company_einvoicing_routing` | yes | `PUT /organizations/{id}/companies/{companyId}/einvoicing-routing`: Choose a customer's electronic address |
|
|
181
|
+
| `get_invoice_einvoice` | | `GET /organizations/{id}/invoices/{invoiceId}/einvoice`: Get an invoice's e-invoice |
|
|
182
|
+
| `submit_invoice_einvoice` | yes | `POST /organizations/{id}/invoices/{invoiceId}/submit-einvoice`: Submit an invoice through the e-invoicing network |
|
|
183
|
+
| `list_outgoing_einvoice_failures` | | `GET /organizations/{id}/einvoices/outgoing-failures`: List the failed submissions |
|
|
184
|
+
| `list_incoming_einvoices` | | `GET /organizations/{id}/incoming-einvoices`: List the incoming e-invoices |
|
|
185
|
+
| `get_incoming_einvoice` | | `GET /organizations/{id}/incoming-einvoices/{incomingEinvoiceId}`: Get an incoming e-invoice |
|
|
186
|
+
| `accept_incoming_einvoice` | yes | `POST /organizations/{id}/incoming-einvoices/{incomingEinvoiceId}/accept`: Accept an incoming e-invoice |
|
|
187
|
+
| `refuse_incoming_einvoice` | yes | `POST /organizations/{id}/incoming-einvoices/{incomingEinvoiceId}/refuse`: Refuse an incoming e-invoice |
|
|
188
|
+
| `dispute_incoming_einvoice` | yes | `POST /organizations/{id}/incoming-einvoices/{incomingEinvoiceId}/dispute`: Dispute an incoming e-invoice |
|
|
189
|
+
| `accept_incoming_einvoice_partially` | yes | `POST /organizations/{id}/incoming-einvoices/{incomingEinvoiceId}/accept-partially`: Accept an incoming e-invoice in part |
|
|
190
|
+
| `mark_incoming_einvoice_paid` | yes | `POST /organizations/{id}/incoming-einvoices/{incomingEinvoiceId}/mark-paid`: Mark an incoming e-invoice paid |
|
|
191
|
+
| `get_payments_account` | | `GET /organizations/{id}/payments-account`: Get the organization's Stripe account |
|
|
192
|
+
| `get_online_payment_setting` | | `GET /organizations/{id}/payments-account/online-payment`: Get the online payment of invoices |
|
|
193
|
+
| `replace_online_payment_setting` | yes | `PUT /organizations/{id}/payments-account/online-payment`: Turn the online payment of invoices on or off |
|
|
194
|
+
| `list_sepa_fees` | | `GET /organizations/{id}/payments-account/sepa-fees`: List the SEPA debits' fees |
|
|
195
|
+
| `get_sepa_quota` | | `GET /organizations/{id}/payments-account/sepa-quota`: Get the SEPA quota |
|
|
196
|
+
| `get_company_sepa_mandate` | | `GET /organizations/{id}/companies/{companyId}/sepa-mandate`: Get a customer's SEPA mandate |
|
|
197
|
+
| `create_sepa_mandate_invitation` | yes | `POST /organizations/{id}/companies/{companyId}/sepa-mandate/invitation`: Invite a customer to sign a SEPA mandate |
|
|
198
|
+
| `revoke_sepa_mandate` | yes | `POST /organizations/{id}/companies/{companyId}/sepa-mandate/revoke`: Revoke a customer's SEPA mandate |
|
|
199
|
+
| `debit_invoice` | yes | `POST /organizations/{id}/invoices/{invoiceId}/debit`: Debit an invoice by SEPA |
|
|
200
|
+
| `refund_invoice` | yes | `POST /organizations/{id}/invoices/{invoiceId}/refund`: Refund an invoice's Stripe payments |
|
|
201
|
+
| `get_invoice_payment_status` | | `GET /organizations/{id}/invoices/{invoiceId}/payment-status`: Get an invoice's payment status |
|
|
202
|
+
|
|
203
|
+
Apache-2.0. Generated by `sdk/generator` from the API's OpenAPI document.
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* `myle-mcp`: the MCP server of the Myle API over stdio.
|
|
4
|
+
*
|
|
5
|
+
* MYLE_API_KEY=… myle-mcp read-only: only the tools that read are offered
|
|
6
|
+
* MYLE_API_KEY=… myle-mcp --allow-writes the tools that create, change and delete too
|
|
7
|
+
*
|
|
8
|
+
* Environment: MYLE_API_KEY (required), MYLE_BASE_URL (another API address), MYLE_API_VERSION (another contract
|
|
9
|
+
* date than the SDK's), MYLE_ACCEPT_LANGUAGE (fr or en, the language of error sentences). Logs go to stderr: stdout
|
|
10
|
+
* carries the protocol.
|
|
11
|
+
*/
|
|
12
|
+
export {};
|
|
13
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA;;;;;;;;;GASG"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// Copied by sdk/generator from sdk/generator/templates/mcp/src/index.ts: edit the template.
|
|
3
|
+
/**
|
|
4
|
+
* `myle-mcp`: the MCP server of the Myle API over stdio.
|
|
5
|
+
*
|
|
6
|
+
* MYLE_API_KEY=… myle-mcp read-only: only the tools that read are offered
|
|
7
|
+
* MYLE_API_KEY=… myle-mcp --allow-writes the tools that create, change and delete too
|
|
8
|
+
*
|
|
9
|
+
* Environment: MYLE_API_KEY (required), MYLE_BASE_URL (another API address), MYLE_API_VERSION (another contract
|
|
10
|
+
* date than the SDK's), MYLE_ACCEPT_LANGUAGE (fr or en, the language of error sentences). Logs go to stderr: stdout
|
|
11
|
+
* carries the protocol.
|
|
12
|
+
*/
|
|
13
|
+
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
|
|
14
|
+
import { Myle } from '@myleapp/myle';
|
|
15
|
+
import { createServer } from './server.js';
|
|
16
|
+
import { VERSION } from './version.js';
|
|
17
|
+
const USAGE = `myle-mcp ${VERSION}: the MCP server of the Myle API (stdio)
|
|
18
|
+
|
|
19
|
+
myle-mcp [--allow-writes]
|
|
20
|
+
|
|
21
|
+
--allow-writes offer the tools that create, change and delete (read-only without it)
|
|
22
|
+
--help this help
|
|
23
|
+
|
|
24
|
+
Environment: MYLE_API_KEY (required), MYLE_BASE_URL, MYLE_API_VERSION, MYLE_ACCEPT_LANGUAGE (fr, en).`;
|
|
25
|
+
async function main(argv) {
|
|
26
|
+
const unknown = argv.filter((a) => a !== '--allow-writes' && a !== '--help' && a !== '-h');
|
|
27
|
+
if (argv.includes('--help') || argv.includes('-h')) {
|
|
28
|
+
process.stderr.write(`${USAGE}\n`);
|
|
29
|
+
return 0;
|
|
30
|
+
}
|
|
31
|
+
if (unknown.length > 0) {
|
|
32
|
+
process.stderr.write(`myle-mcp: unknown argument ${unknown[0]}\n\n${USAGE}\n`);
|
|
33
|
+
return 2;
|
|
34
|
+
}
|
|
35
|
+
if (!process.env['MYLE_API_KEY']) {
|
|
36
|
+
process.stderr.write('myle-mcp: set MYLE_API_KEY to a Myle API key (organization or user key)\n');
|
|
37
|
+
return 2;
|
|
38
|
+
}
|
|
39
|
+
const myle = new Myle({
|
|
40
|
+
apiVersion: process.env['MYLE_API_VERSION'] || undefined,
|
|
41
|
+
acceptLanguage: process.env['MYLE_ACCEPT_LANGUAGE'] || undefined,
|
|
42
|
+
myleClient: `mcp/${VERSION}`,
|
|
43
|
+
onDeprecation: (n) => process.stderr.write(`myle-mcp: ${n.operationId} is served with a deprecated behavior${n.sunset ? ` until ${n.sunset}` : ''}\n`),
|
|
44
|
+
});
|
|
45
|
+
const server = createServer(myle, { allowWrites: argv.includes('--allow-writes') });
|
|
46
|
+
await server.connect(new StdioServerTransport());
|
|
47
|
+
return -1; // keep running: the transport ends the process when the client goes away
|
|
48
|
+
}
|
|
49
|
+
main(process.argv.slice(2)).then((code) => {
|
|
50
|
+
if (code >= 0)
|
|
51
|
+
process.exit(code);
|
|
52
|
+
}, (e) => {
|
|
53
|
+
process.stderr.write(`myle-mcp: ${e instanceof Error ? e.message : String(e)}\n`);
|
|
54
|
+
process.exit(1);
|
|
55
|
+
});
|
|
56
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AACA,4FAA4F;AAC5F;;;;;;;;;GASG;AAEH,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAErC,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAEvC,MAAM,KAAK,GAAG,YAAY,OAAO;;;;;;;sGAOqE,CAAC;AAEvG,KAAK,UAAU,IAAI,CAAC,IAAc;IAChC,MAAM,OAAO,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,KAAK,gBAAgB,IAAI,CAAC,KAAK,QAAQ,IAAI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,CAAC,CAAC;IACjD,OAAO,CAAC,CAAC,CAAC,CAAC,yEAAyE;AACtF,CAAC;AAED,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAC9B,CAAC,IAAI,EAAE,EAAE;IACP,IAAI,IAAI,IAAI,CAAC;QAAE,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACpC,CAAC,EACD,CAAC,CAAU,EAAE,EAAE;IACb,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,aAAa,CAAC,YAAY,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;IAClF,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CACF,CAAC"}
|
package/dist/server.d.ts
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The MCP server of the Myle API: one tool per operation of the document (`./tools.ts`, generated), each calling the
|
|
3
|
+
* TypeScript SDK. Read-only unless `allowWrites`: the tools that write are not even listed. Errors come back as tool
|
|
4
|
+
* errors carrying the API's `code`, its sentence, its `context` and the `requestId`.
|
|
5
|
+
*/
|
|
6
|
+
import { Server } from '@modelcontextprotocol/sdk/server/index.js';
|
|
7
|
+
import { type CallToolResult } from '@modelcontextprotocol/sdk/types.js';
|
|
8
|
+
import { Myle } from '@myleapp/myle';
|
|
9
|
+
import { type ToolDefinition } from './tools.js';
|
|
10
|
+
export interface ServerOptions {
|
|
11
|
+
/** List and run the tools that create, change or delete (`--allow-writes`). False by default. */
|
|
12
|
+
allowWrites?: boolean;
|
|
13
|
+
}
|
|
14
|
+
/** The tools a server with these options offers. */
|
|
15
|
+
export declare function toolsFor(options?: ServerOptions): ToolDefinition[];
|
|
16
|
+
/** Runs one tool: its arguments checked against its required members, then the SDK call, then the answer as JSON. */
|
|
17
|
+
export declare function runTool(myle: Myle, tool: ToolDefinition, args: Record<string, unknown>, signal?: AbortSignal): Promise<CallToolResult>;
|
|
18
|
+
/** A server over a client of the SDK. Connect it to a transport (`StdioServerTransport` in `index.ts`). */
|
|
19
|
+
export declare function createServer(myle: Myle, options?: ServerOptions): Server;
|
|
20
|
+
//# sourceMappingURL=server.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AACnE,OAAO,EAAiD,KAAK,cAAc,EAAE,MAAM,oCAAoC,CAAC;AACxH,OAAO,EAAE,IAAI,EAA2B,MAAM,eAAe,CAAC;AAE9D,OAAO,EAAS,KAAK,cAAc,EAAE,MAAM,YAAY,CAAC;AAGxD,MAAM,WAAW,aAAa;IAC5B,iGAAiG;IACjG,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;AAED,oDAAoD;AACpD,wBAAgB,QAAQ,CAAC,OAAO,GAAE,aAAkB,GAAG,cAAc,EAAE,CAEtE;AAMD,qHAAqH;AACrH,wBAAsB,OAAO,CAC3B,IAAI,EAAE,IAAI,EACV,IAAI,EAAE,cAAc,EACpB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC7B,MAAM,CAAC,EAAE,WAAW,GACnB,OAAO,CAAC,cAAc,CAAC,CAYzB;AAED,2GAA2G;AAC3G,wBAAgB,YAAY,CAAC,IAAI,EAAE,IAAI,EAAE,OAAO,GAAE,aAAkB,GAAG,MAAM,CAsC5E"}
|
package/dist/server.js
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
// Copied by sdk/generator from sdk/generator/templates/mcp/src/server.ts: edit the template.
|
|
2
|
+
/**
|
|
3
|
+
* The MCP server of the Myle API: one tool per operation of the document (`./tools.ts`, generated), each calling the
|
|
4
|
+
* TypeScript SDK. Read-only unless `allowWrites`: the tools that write are not even listed. Errors come back as tool
|
|
5
|
+
* errors carrying the API's `code`, its sentence, its `context` and the `requestId`.
|
|
6
|
+
*/
|
|
7
|
+
import { Server } from '@modelcontextprotocol/sdk/server/index.js';
|
|
8
|
+
import { CallToolRequestSchema, ListToolsRequestSchema } from '@modelcontextprotocol/sdk/types.js';
|
|
9
|
+
import { Myle, MyleApiError, MyleError } from '@myleapp/myle';
|
|
10
|
+
import { TOOLS } from './tools.js';
|
|
11
|
+
import { VERSION } from './version.js';
|
|
12
|
+
/** The tools a server with these options offers. */
|
|
13
|
+
export function toolsFor(options = {}) {
|
|
14
|
+
return TOOLS.filter((tool) => options.allowWrites === true || !tool.write);
|
|
15
|
+
}
|
|
16
|
+
function text(value, isError = false) {
|
|
17
|
+
return { content: [{ type: 'text', text: JSON.stringify(value, null, 2) }], ...(isError ? { isError: true } : {}) };
|
|
18
|
+
}
|
|
19
|
+
/** Runs one tool: its arguments checked against its required members, then the SDK call, then the answer as JSON. */
|
|
20
|
+
export async function runTool(myle, tool, args, signal) {
|
|
21
|
+
const missing = (tool.inputSchema.required ?? []).filter((name) => args[name] === undefined || args[name] === null);
|
|
22
|
+
if (missing.length > 0)
|
|
23
|
+
return text({ error: `Missing arguments: ${missing.join(', ')}` }, true);
|
|
24
|
+
try {
|
|
25
|
+
return text(await tool.call(myle, args, signal));
|
|
26
|
+
}
|
|
27
|
+
catch (e) {
|
|
28
|
+
if (e instanceof MyleApiError) {
|
|
29
|
+
return text({ code: e.code, error: e.message, context: e.context, status: e.status, requestId: e.requestId }, true);
|
|
30
|
+
}
|
|
31
|
+
if (e instanceof MyleError)
|
|
32
|
+
return text({ error: e.message }, true);
|
|
33
|
+
throw e;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
/** A server over a client of the SDK. Connect it to a transport (`StdioServerTransport` in `index.ts`). */
|
|
37
|
+
export function createServer(myle, options = {}) {
|
|
38
|
+
const tools = toolsFor(options);
|
|
39
|
+
const byName = new Map(tools.map((t) => [t.name, t]));
|
|
40
|
+
const server = new Server({ name: 'myle', title: 'Myle API', version: VERSION }, {
|
|
41
|
+
capabilities: { tools: {} },
|
|
42
|
+
instructions: 'Tools over the Myle API (farm and business management: products, companies, API keys…). Ids are opaque ' +
|
|
43
|
+
'strings (product_<uuid>). Organization tools take organizationId (get_me does not tell it: ask the user, or ' +
|
|
44
|
+
'use the organization of the API key). Lists answer one page: pass its nextCursor as cursor for the next. ' +
|
|
45
|
+
'Errors answer {code, error, context}: act on code and context, show error to the user.' +
|
|
46
|
+
(options.allowWrites === true
|
|
47
|
+
? ' Writes are enabled: confirm with the user before creating, changing or deleting.'
|
|
48
|
+
: ' Read-only: the tools that write are not available.'),
|
|
49
|
+
});
|
|
50
|
+
server.setRequestHandler(ListToolsRequestSchema, () => ({
|
|
51
|
+
tools: tools.map((t) => ({
|
|
52
|
+
name: t.name,
|
|
53
|
+
title: t.title,
|
|
54
|
+
description: t.description,
|
|
55
|
+
inputSchema: t.inputSchema,
|
|
56
|
+
annotations: t.annotations,
|
|
57
|
+
})),
|
|
58
|
+
}));
|
|
59
|
+
server.setRequestHandler(CallToolRequestSchema, async (request, extra) => {
|
|
60
|
+
const tool = byName.get(request.params.name);
|
|
61
|
+
if (!tool) {
|
|
62
|
+
const hidden = TOOLS.some((t) => t.name === request.params.name);
|
|
63
|
+
return text({ error: hidden ? `${request.params.name} writes: start the server with --allow-writes` : `Unknown tool ${request.params.name}` }, true);
|
|
64
|
+
}
|
|
65
|
+
return runTool(myle, tool, (request.params.arguments ?? {}), extra.signal);
|
|
66
|
+
});
|
|
67
|
+
return server;
|
|
68
|
+
}
|
|
69
|
+
//# sourceMappingURL=server.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"server.js","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA,6FAA6F;AAE7F;;;;GAIG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AACnE,OAAO,EAAE,qBA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30 @@
|
|
|
1
|
+
import { type Myle } from '@myleapp/myle';
|
|
2
|
+
/** A tool of the server: what MCP clients see, and the SDK call it makes. */
|
|
3
|
+
export interface ToolDefinition {
|
|
4
|
+
name: string;
|
|
5
|
+
title: string;
|
|
6
|
+
description: string;
|
|
7
|
+
inputSchema: {
|
|
8
|
+
type: 'object';
|
|
9
|
+
properties: Record<string, object>;
|
|
10
|
+
required?: string[];
|
|
11
|
+
additionalProperties: boolean;
|
|
12
|
+
};
|
|
13
|
+
annotations: {
|
|
14
|
+
readOnlyHint: boolean;
|
|
15
|
+
destructiveHint: boolean;
|
|
16
|
+
idempotentHint: boolean;
|
|
17
|
+
openWorldHint: boolean;
|
|
18
|
+
};
|
|
19
|
+
/** The operation of the document it calls. */
|
|
20
|
+
operationId: string;
|
|
21
|
+
method: string;
|
|
22
|
+
path: string;
|
|
23
|
+
/** Creates, changes or deletes: offered only with --allow-writes. */
|
|
24
|
+
write: boolean;
|
|
25
|
+
/** `signal`: the MCP client's cancellation of the call, handed to the SDK. */
|
|
26
|
+
call(myle: Myle, a: Record<string, unknown>, signal?: AbortSignal): Promise<unknown>;
|
|
27
|
+
}
|
|
28
|
+
/** Every tool, in the document's order. */
|
|
29
|
+
export declare const TOOLS: ToolDefinition[];
|
|
30
|
+
//# sourceMappingURL=tools.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../src/tools.ts"],"names":[],"mappings":"AAGA,OAAO,EAAa,KAAK,IAAI,EAAqC,MAAM,eAAe,CAAC;AAExF,6EAA6E;AAC7E,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE;QAAE,IAAI,EAAE,QAAQ,CAAC;QAAC,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QAAC,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;QAAC,oBAAoB,EAAE,OAAO,CAAA;KAAE,CAAC;IACxH,WAAW,EAAE;QAAE,YAAY,EAAE,OAAO,CAAC;QAAC,eAAe,EAAE,OAAO,CAAC;QAAC,cAAc,EAAE,OAAO,CAAC;QAAC,aAAa,EAAE,OAAO,CAAA;KAAE,CAAC;IAClH,8CAA8C;IAC9C,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,qEAAqE;IACrE,KAAK,EAAE,OAAO,CAAC;IACf,8EAA8E;IAC9E,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;CACtF;AAmCD,2CAA2C;AAC3C,eAAO,MAAM,KAAK,EAAE,cAAc,EAkyQjC,CAAC"}
|