mcp-usage-control-mcp 1.0.0 → 1.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/README.md +19 -1
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
MCP TypeScript SDK v2 adapter for `mcp-usage-control`.
|
|
4
4
|
|
|
5
|
-
> **Current distribution status:**
|
|
5
|
+
> **Current distribution status:** `mcp-usage-control-mcp` v1.0.0 is published to npm. Repository checkouts/local tarballs remain supported for development; see [Use from source / local tarballs](https://github.com/git-ksk/mcp-usage-control/blob/main/docs/using-from-source.md) / [日本語](https://github.com/git-ksk/mcp-usage-control/blob/main/docs/using-from-source.ja.md).
|
|
6
6
|
|
|
7
7
|
## English
|
|
8
8
|
|
|
@@ -14,6 +14,14 @@ For a tool with no input schema, set `noInput: true`. For input-schema tools, om
|
|
|
14
14
|
|
|
15
15
|
It distinguishes normal success, `{ isError: true }`, and thrown errors. Invalid/throwing cost classifiers cause the full reservation to be settled before `UsageClassificationError` is surfaced. Ambiguous settlement failures are surfaced as `UsageSettlementError` and are not blindly retried.
|
|
16
16
|
|
|
17
|
+
### Single-round operation identity
|
|
18
|
+
|
|
19
|
+
For `protectTool()`, `operationId` means **logical operation identity**, not JSON-RPC request identity. Do not derive it from `ctx.mcpReq.id` or session + request ID and assume that makes retries stable.
|
|
20
|
+
|
|
21
|
+
If the application has no retry-stable logical key for an ordinary read, the canonical conservative fallback is `operationId: () => crypto.randomUUID()`: each received dispatch is metered separately, so a fresh transport retry may consume quota again. If the product needs one accounting operation across retries, supply a validated application-level action/idempotency ID and reuse it only for retries of that same action.
|
|
22
|
+
|
|
23
|
+
The adapter intentionally provides no weak request-ID dedup helper and no read-only dedup cache because it cannot distinguish a transport retry from an intentional repeated read. See [MCP logical operation identity](https://github.com/git-ksk/mcp-usage-control/blob/main/docs/mcp-operation-identity.md).
|
|
24
|
+
|
|
17
25
|
### Returning a bounded remaining value
|
|
18
26
|
|
|
19
27
|
Successful core admission exposes the authoritative store-produced `remainingByBudget`. The MCP wrappers intentionally do not inject balances into handler results. If a tool must return a bounded remaining value to its consumer, use the core lifecycle directly at that integration point and select only the application-approved budget value:
|
|
@@ -62,6 +70,7 @@ Resume tokens are one-time. A concurrent or repeated resume after one caller has
|
|
|
62
70
|
|
|
63
71
|
- [Current source/tarball usage](https://github.com/git-ksk/mcp-usage-control/blob/main/docs/using-from-source.md)
|
|
64
72
|
- [MCP integration](https://github.com/git-ksk/mcp-usage-control/blob/main/docs/mcp-integration.md)
|
|
73
|
+
- [MCP logical operation identity](https://github.com/git-ksk/mcp-usage-control/blob/main/docs/mcp-operation-identity.md)
|
|
65
74
|
- [API reference](https://github.com/git-ksk/mcp-usage-control/blob/main/docs/api-reference.md)
|
|
66
75
|
- [Architecture](https://github.com/git-ksk/mcp-usage-control/blob/main/docs/architecture.md)
|
|
67
76
|
|
|
@@ -77,6 +86,14 @@ input schemaがないtoolでは `noInput: true` を指定し、input schemaあ
|
|
|
77
86
|
|
|
78
87
|
normal success、`{ isError: true }`、thrown errorを区別します。classifierがthrow / invalid unitsを返した場合はfull reservationをsettleしてから `UsageClassificationError` を表面化します。ambiguous settlement failureは `UsageSettlementError` として表面化しblind retryしません。
|
|
79
88
|
|
|
89
|
+
### Single-round operation identity
|
|
90
|
+
|
|
91
|
+
`protectTool()` の `operationId` は **logical operation identity** であり、JSON-RPC request identityではありません。`ctx.mcpReq.id` や session + request ID から導出してretry-stableだと扱わないでください。
|
|
92
|
+
|
|
93
|
+
ordinary readでapplication側にretry-stableなlogical keyがない場合、canonical conservative fallbackは `operationId: () => crypto.randomUUID()` です。received dispatchごとに別meteringになるためfresh transport retryではquotaを再消費する可能性があります。retryを跨いで1 accounting operationにしたいproductは、validated application-level action / idempotency IDを用意し、同じactionのretry時だけreuseしてください。
|
|
94
|
+
|
|
95
|
+
adapterはtransport retryとintentional repeated readを区別できないため、weak request-ID dedup helperやread-only dedup cacheを意図的に提供しません。詳しくは [MCP logical operation identity](https://github.com/git-ksk/mcp-usage-control/blob/main/docs/mcp-operation-identity.ja.md) を参照してください。
|
|
96
|
+
|
|
80
97
|
### boundedなremaining値を返す
|
|
81
98
|
|
|
82
99
|
coreのadmission成功結果には、authoritative storeが算出した `remainingByBudget` が含まれます。MCP wrapperはbalanceをhandler resultへ自動注入しません。tool consumerへboundedなremaining値を返したい場合は、そのintegration pointだけcore lifecycleを直接使い、applicationが許可したbudgetの値だけを選択します。
|
|
@@ -125,6 +142,7 @@ resume tokenはone-timeです。同じtokenのconcurrent/repeated resumeは1 cal
|
|
|
125
142
|
|
|
126
143
|
- [現在のsource / tarball利用手順](https://github.com/git-ksk/mcp-usage-control/blob/main/docs/using-from-source.ja.md)
|
|
127
144
|
- [MCP integration](https://github.com/git-ksk/mcp-usage-control/blob/main/docs/mcp-integration.ja.md)
|
|
145
|
+
- [MCP logical operation identity](https://github.com/git-ksk/mcp-usage-control/blob/main/docs/mcp-operation-identity.ja.md)
|
|
128
146
|
- [API reference](https://github.com/git-ksk/mcp-usage-control/blob/main/docs/api-reference.ja.md)
|
|
129
147
|
- [Architecture](https://github.com/git-ksk/mcp-usage-control/blob/main/docs/architecture.ja.md)
|
|
130
148
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mcp-usage-control-mcp",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"description": "MCP TypeScript SDK v2 adapter for mcp-usage-control.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -55,10 +55,10 @@
|
|
|
55
55
|
},
|
|
56
56
|
"scripts": {
|
|
57
57
|
"build": "tsc -p tsconfig.json",
|
|
58
|
-
"test": "vitest run"
|
|
58
|
+
"test": "vitest run src"
|
|
59
59
|
},
|
|
60
60
|
"dependencies": {
|
|
61
|
-
"mcp-usage-control": "^1.
|
|
61
|
+
"mcp-usage-control": "^1.1.0"
|
|
62
62
|
},
|
|
63
63
|
"peerDependencies": {
|
|
64
64
|
"@modelcontextprotocol/server": "^2.0.0"
|