@avallon-labs/mcp 54.0.0 → 54.1.0-staging.1242

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/dist/index.js CHANGED
@@ -46,5 +46,5 @@ function setupFetch() {
46
46
 
47
47
  // src/index.ts
48
48
  setupFetch();
49
- await import("./server-3HOW2HW2.js");
49
+ await import("./server-ZZJ7G2LC.js");
50
50
  //# sourceMappingURL=index.js.map
@@ -735,6 +735,29 @@ var refreshToken = async (refreshTokenBody, options) => {
735
735
  const data = body ? JSON.parse(body) : {};
736
736
  return { data, status: res.status, headers: res.headers };
737
737
  };
738
+ var getRefreshSessionUrl = () => {
739
+ return `/v1/auth/session/refresh`;
740
+ };
741
+ var refreshSession = async (refreshSessionBody, options) => {
742
+ const getHeaders = (h) => {
743
+ if (!h) return {};
744
+ if (h instanceof Headers) return Object.fromEntries(h.entries());
745
+ if (Array.isArray(h)) return Object.fromEntries(h);
746
+ return h;
747
+ };
748
+ const res = await fetch(
749
+ getRefreshSessionUrl(),
750
+ {
751
+ ...options,
752
+ method: "POST",
753
+ headers: { "Content-Type": "application/json", ...getHeaders(options?.headers) },
754
+ body: JSON.stringify(refreshSessionBody)
755
+ }
756
+ );
757
+ const body = [204, 205, 304].includes(res.status) ? null : await res.text();
758
+ const data = body ? JSON.parse(body) : {};
759
+ return { data, status: res.status, headers: res.headers };
760
+ };
738
761
  var getGetOAuthUrlUrl = (params) => {
739
762
  const normalizedParams = new URLSearchParams();
740
763
  Object.entries(params || {}).forEach(([key, value]) => {
@@ -4450,6 +4473,29 @@ var refreshTokenHandler = async (args, options) => {
4450
4473
  structuredContent: res.data
4451
4474
  };
4452
4475
  };
4476
+ var refreshSessionHandler = async (args, options) => {
4477
+ const res = await refreshSession(args.bodyParams, options);
4478
+ if (res.status >= 400) {
4479
+ return {
4480
+ content: [
4481
+ {
4482
+ type: "text",
4483
+ text: JSON.stringify(res.data ?? null)
4484
+ }
4485
+ ],
4486
+ isError: true
4487
+ };
4488
+ }
4489
+ return {
4490
+ content: [
4491
+ {
4492
+ type: "text",
4493
+ text: JSON.stringify(res.data ?? null)
4494
+ }
4495
+ ],
4496
+ structuredContent: res.data
4497
+ };
4498
+ };
4453
4499
  var getOAuthUrlHandler = async (args, options) => {
4454
4500
  const res = await getOAuthUrl(args.queryParams, options);
4455
4501
  if (res.status >= 400) {
@@ -8621,6 +8667,19 @@ var RefreshTokenResponse = zod.object({
8621
8667
  }),
8622
8668
  "message": zod.string()
8623
8669
  });
8670
+ var RefreshSessionBody = zod.object({
8671
+ "refresh_token": zod.string(),
8672
+ "tenant_id": zod.string().uuid()
8673
+ });
8674
+ var RefreshSessionResponse = zod.object({
8675
+ "data": zod.object({
8676
+ "access_token": zod.string(),
8677
+ "refresh_token": zod.string(),
8678
+ "tenant_id": zod.string(),
8679
+ "expires_in": zod.number()
8680
+ }),
8681
+ "message": zod.string()
8682
+ });
8624
8683
  var GetOAuthUrlQueryParams = zod.object({
8625
8684
  "provider": zod.enum(["google", "sso"]),
8626
8685
  "redirect_uri": zod.string().url(),
@@ -13209,6 +13268,22 @@ var createMcpServer = (options) => {
13209
13268
  signal: options?.signal ? AbortSignal.any([options.signal, ctx.signal]) : ctx.signal
13210
13269
  })
13211
13270
  );
13271
+ tools.refreshSession = server2.registerTool(
13272
+ "refreshSession",
13273
+ {
13274
+ title: "Refresh session",
13275
+ description: "Rotate the refresh token and return a new access token for `tenant_id`. Call it with a different `tenant_id` to switch tenants.\n\nRequires a valid user session (not an API key). The refresh token must belong to the same user, and the user must be a member of `tenant_id` (404 otherwise).",
13276
+ inputSchema: {
13277
+ bodyParams: RefreshSessionBody.optional()
13278
+ },
13279
+ outputSchema: RefreshSessionResponse,
13280
+ annotations: { destructiveHint: true }
13281
+ },
13282
+ (args, ctx) => refreshSessionHandler(args, {
13283
+ ...options,
13284
+ signal: options?.signal ? AbortSignal.any([options.signal, ctx.signal]) : ctx.signal
13285
+ })
13286
+ );
13212
13287
  tools.getOAuthUrl = server2.registerTool(
13213
13288
  "getOAuthUrl",
13214
13289
  {
@@ -15555,4 +15630,4 @@ var transport = new StdioServerTransport();
15555
15630
  server.connect(transport).then(() => {
15556
15631
  console.error("MCP server running on stdio");
15557
15632
  }).catch(console.error);
15558
- //# sourceMappingURL=server-3HOW2HW2.js.map
15633
+ //# sourceMappingURL=server-ZZJ7G2LC.js.map