tiny-http-mcp-server 0.1.37 → 0.1.38

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.
@@ -18,7 +18,7 @@
18
18
  },
19
19
  {
20
20
  "name": "tiny-http-mcp-server",
21
- "version": "0.1.37",
21
+ "version": "0.1.38",
22
22
  "license": "MIT"
23
23
  },
24
24
  {
@@ -65,12 +65,22 @@ export function createResourceBoundOAuthStores(options, namespace, identity) {
65
65
  return record;
66
66
  }
67
67
  result.sessionStore = {
68
- async withLock(_resource, operation, options) {
68
+ async withLock(resource, operation, options) {
69
69
  if (store.withLock === undefined)
70
70
  throw new Error("OAuth resource identity backend must support transaction locks");
71
- return store.withLock(operation, options);
71
+ return store.withLock(async () => {
72
+ options.signal?.throwIfAborted();
73
+ await reconcile(resource);
74
+ options.signal?.throwIfAborted();
75
+ return operation();
76
+ }, options);
77
+ },
78
+ async load(resource) {
79
+ // Unauthorized provenance may peek before acquiring the transaction lock.
80
+ // Only the lock owner may adopt a URL or retire the previous credentials.
81
+ const record = await read();
82
+ return record?.resource === canonicalizeResourceIndicator(resource) ? record.session : null;
72
83
  },
73
- async load(resource) { return (await reconcile(resource)).session; },
74
84
  async save(resource, session) {
75
85
  const record = await reconcile(resource);
76
86
  if (canonicalizeResourceIndicator(session.resource) !== record.resource)
@@ -4771,13 +4771,19 @@ function createResourceBoundOAuthStores(options, namespace, identity) {
4771
4771
  return record2;
4772
4772
  }
4773
4773
  result.sessionStore = {
4774
- async withLock(_resource, operation, options2) {
4774
+ async withLock(resource, operation, options2) {
4775
4775
  if (store.withLock === void 0)
4776
4776
  throw new Error("OAuth resource identity backend must support transaction locks");
4777
- return store.withLock(operation, options2);
4777
+ return store.withLock(async () => {
4778
+ options2.signal?.throwIfAborted();
4779
+ await reconcile(resource);
4780
+ options2.signal?.throwIfAborted();
4781
+ return operation();
4782
+ }, options2);
4778
4783
  },
4779
4784
  async load(resource) {
4780
- return (await reconcile(resource)).session;
4785
+ const record2 = await read();
4786
+ return record2?.resource === canonicalizeResourceIndicator(resource) ? record2.session : null;
4781
4787
  },
4782
4788
  async save(resource, session) {
4783
4789
  const record2 = await reconcile(resource);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tiny-http-mcp-server",
3
- "version": "0.1.37",
3
+ "version": "0.1.38",
4
4
  "description": "Minimal MCP server over HTTP built on tiny-stdio-mcp-server",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",