@inkeep/agents-manage-api 0.0.0-dev-20250930181023 → 0.0.0-dev-20250930184723

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.cjs CHANGED
@@ -3776,20 +3776,21 @@ var OAuthService = class {
3776
3776
  clientName: config.clientName || process.env.OAUTH_CLIENT_NAME || "Inkeep Agent Framework",
3777
3777
  clientUri: config.clientUri || process.env.OAUTH_CLIENT_URI || "https://inkeep.com",
3778
3778
  logoUri: config.logoUri || process.env.OAUTH_CLIENT_LOGO_URI || "https://inkeep.com/images/logos/inkeep-logo-blue.svg",
3779
- redirectBaseUrl: config.redirectBaseUrl || process.env.OAUTH_REDIRECT_BASE_URL || "http://localhost:3002"
3779
+ redirectBaseUrl: config.redirectBaseUrl || env.AGENTS_MANAGE_API_URL
3780
3780
  };
3781
3781
  }
3782
3782
  /**
3783
3783
  * Initiate OAuth flow for an MCP tool
3784
3784
  */
3785
3785
  async initiateOAuthFlow(params) {
3786
- const { tool, tenantId, projectId, toolId } = params;
3786
+ const { tool, tenantId, projectId, toolId, baseUrl } = params;
3787
3787
  const oAuthConfig = await agentsCore.discoverOAuthEndpoints(tool.config.mcp.server.url, logger4);
3788
3788
  if (!oAuthConfig) {
3789
3789
  throw new Error("OAuth not supported by this server");
3790
3790
  }
3791
3791
  const { codeVerifier, codeChallenge } = await this.generatePKCEInternal();
3792
- const redirectUri = `${this.defaultConfig.redirectBaseUrl}/oauth/callback`;
3792
+ const redirectBaseUrl = baseUrl || this.defaultConfig.redirectBaseUrl;
3793
+ const redirectUri = `${redirectBaseUrl}/oauth/callback`;
3793
3794
  let clientId = this.defaultConfig.defaultClientId;
3794
3795
  if (oAuthConfig.supportsDynamicRegistration && oAuthConfig.registrationUrl) {
3795
3796
  clientId = await this.performDynamicClientRegistration(
@@ -3817,12 +3818,13 @@ var OAuthService = class {
3817
3818
  * Exchange authorization code for access tokens
3818
3819
  */
3819
3820
  async exchangeCodeForTokens(params) {
3820
- const { code, codeVerifier, clientId, tool } = params;
3821
+ const { code, codeVerifier, clientId, tool, baseUrl } = params;
3821
3822
  const oAuthConfig = await agentsCore.discoverOAuthEndpoints(tool.config.mcp.server.url, logger4);
3822
3823
  if (!oAuthConfig?.tokenUrl) {
3823
3824
  throw new Error("Could not discover OAuth token endpoint");
3824
3825
  }
3825
- const redirectUri = `${this.defaultConfig.redirectBaseUrl}/oauth/callback`;
3826
+ const redirectBaseUrl = baseUrl || this.defaultConfig.redirectBaseUrl;
3827
+ const redirectUri = `${redirectBaseUrl}/oauth/callback`;
3826
3828
  let tokens;
3827
3829
  try {
3828
3830
  tokens = await this.exchangeWithOpenIdClient({
@@ -4014,6 +4016,10 @@ async function findOrCreateCredential(tenantId, projectId, credentialData) {
4014
4016
  }
4015
4017
  var app17 = new zodOpenapi.OpenAPIHono();
4016
4018
  var logger5 = agentsCore.getLogger("oauth-callback");
4019
+ function getBaseUrlFromRequest(c) {
4020
+ const url = new URL(c.req.url);
4021
+ return `${url.protocol}//${url.host}`;
4022
+ }
4017
4023
  var OAuthLoginQuerySchema = zodOpenapi.z.object({
4018
4024
  tenantId: zodOpenapi.z.string().min(1, "Tenant ID is required"),
4019
4025
  projectId: zodOpenapi.z.string().min(1, "Project ID is required"),
@@ -4076,11 +4082,13 @@ app17.openapi(
4076
4082
  }
4077
4083
  const credentialStores = c.get("credentialStores");
4078
4084
  const mcpTool = await agentsCore.dbResultToMcpTool(tool, dbClient_default, credentialStores);
4085
+ const baseUrl = getBaseUrlFromRequest(c);
4079
4086
  const { redirectUrl } = await oauthService.initiateOAuthFlow({
4080
4087
  tool: mcpTool,
4081
4088
  tenantId,
4082
4089
  projectId,
4083
- toolId
4090
+ toolId,
4091
+ baseUrl
4084
4092
  });
4085
4093
  return c.redirect(redirectUrl, 302);
4086
4094
  } catch (error) {
@@ -4152,11 +4160,13 @@ app17.openapi(
4152
4160
  logger5.info({ toolId }, "Exchanging authorization code for access token");
4153
4161
  const credentialStores = c.get("credentialStores");
4154
4162
  const mcpTool = await agentsCore.dbResultToMcpTool(tool, dbClient_default, credentialStores);
4163
+ const baseUrl = getBaseUrlFromRequest(c);
4155
4164
  const { tokens } = await oauthService.exchangeCodeForTokens({
4156
4165
  code,
4157
4166
  codeVerifier,
4158
4167
  clientId,
4159
- tool: mcpTool
4168
+ tool: mcpTool,
4169
+ baseUrl
4160
4170
  });
4161
4171
  logger5.info(
4162
4172
  { toolId, tokenType: tokens.token_type, hasRefresh: !!tokens.refresh_token },
package/dist/index.js CHANGED
@@ -3772,20 +3772,21 @@ var OAuthService = class {
3772
3772
  clientName: config.clientName || process.env.OAUTH_CLIENT_NAME || "Inkeep Agent Framework",
3773
3773
  clientUri: config.clientUri || process.env.OAUTH_CLIENT_URI || "https://inkeep.com",
3774
3774
  logoUri: config.logoUri || process.env.OAUTH_CLIENT_LOGO_URI || "https://inkeep.com/images/logos/inkeep-logo-blue.svg",
3775
- redirectBaseUrl: config.redirectBaseUrl || process.env.OAUTH_REDIRECT_BASE_URL || "http://localhost:3002"
3775
+ redirectBaseUrl: config.redirectBaseUrl || env.AGENTS_MANAGE_API_URL
3776
3776
  };
3777
3777
  }
3778
3778
  /**
3779
3779
  * Initiate OAuth flow for an MCP tool
3780
3780
  */
3781
3781
  async initiateOAuthFlow(params) {
3782
- const { tool, tenantId, projectId, toolId } = params;
3782
+ const { tool, tenantId, projectId, toolId, baseUrl } = params;
3783
3783
  const oAuthConfig = await discoverOAuthEndpoints(tool.config.mcp.server.url, logger4);
3784
3784
  if (!oAuthConfig) {
3785
3785
  throw new Error("OAuth not supported by this server");
3786
3786
  }
3787
3787
  const { codeVerifier, codeChallenge } = await this.generatePKCEInternal();
3788
- const redirectUri = `${this.defaultConfig.redirectBaseUrl}/oauth/callback`;
3788
+ const redirectBaseUrl = baseUrl || this.defaultConfig.redirectBaseUrl;
3789
+ const redirectUri = `${redirectBaseUrl}/oauth/callback`;
3789
3790
  let clientId = this.defaultConfig.defaultClientId;
3790
3791
  if (oAuthConfig.supportsDynamicRegistration && oAuthConfig.registrationUrl) {
3791
3792
  clientId = await this.performDynamicClientRegistration(
@@ -3813,12 +3814,13 @@ var OAuthService = class {
3813
3814
  * Exchange authorization code for access tokens
3814
3815
  */
3815
3816
  async exchangeCodeForTokens(params) {
3816
- const { code, codeVerifier, clientId, tool } = params;
3817
+ const { code, codeVerifier, clientId, tool, baseUrl } = params;
3817
3818
  const oAuthConfig = await discoverOAuthEndpoints(tool.config.mcp.server.url, logger4);
3818
3819
  if (!oAuthConfig?.tokenUrl) {
3819
3820
  throw new Error("Could not discover OAuth token endpoint");
3820
3821
  }
3821
- const redirectUri = `${this.defaultConfig.redirectBaseUrl}/oauth/callback`;
3822
+ const redirectBaseUrl = baseUrl || this.defaultConfig.redirectBaseUrl;
3823
+ const redirectUri = `${redirectBaseUrl}/oauth/callback`;
3822
3824
  let tokens;
3823
3825
  try {
3824
3826
  tokens = await this.exchangeWithOpenIdClient({
@@ -4010,6 +4012,10 @@ async function findOrCreateCredential(tenantId, projectId, credentialData) {
4010
4012
  }
4011
4013
  var app17 = new OpenAPIHono();
4012
4014
  var logger5 = getLogger("oauth-callback");
4015
+ function getBaseUrlFromRequest(c) {
4016
+ const url = new URL(c.req.url);
4017
+ return `${url.protocol}//${url.host}`;
4018
+ }
4013
4019
  var OAuthLoginQuerySchema = z$1.object({
4014
4020
  tenantId: z$1.string().min(1, "Tenant ID is required"),
4015
4021
  projectId: z$1.string().min(1, "Project ID is required"),
@@ -4072,11 +4078,13 @@ app17.openapi(
4072
4078
  }
4073
4079
  const credentialStores = c.get("credentialStores");
4074
4080
  const mcpTool = await dbResultToMcpTool(tool, dbClient_default, credentialStores);
4081
+ const baseUrl = getBaseUrlFromRequest(c);
4075
4082
  const { redirectUrl } = await oauthService.initiateOAuthFlow({
4076
4083
  tool: mcpTool,
4077
4084
  tenantId,
4078
4085
  projectId,
4079
- toolId
4086
+ toolId,
4087
+ baseUrl
4080
4088
  });
4081
4089
  return c.redirect(redirectUrl, 302);
4082
4090
  } catch (error) {
@@ -4148,11 +4156,13 @@ app17.openapi(
4148
4156
  logger5.info({ toolId }, "Exchanging authorization code for access token");
4149
4157
  const credentialStores = c.get("credentialStores");
4150
4158
  const mcpTool = await dbResultToMcpTool(tool, dbClient_default, credentialStores);
4159
+ const baseUrl = getBaseUrlFromRequest(c);
4151
4160
  const { tokens } = await oauthService.exchangeCodeForTokens({
4152
4161
  code,
4153
4162
  codeVerifier,
4154
4163
  clientId,
4155
- tool: mcpTool
4164
+ tool: mcpTool,
4165
+ baseUrl
4156
4166
  });
4157
4167
  logger5.info(
4158
4168
  { toolId, tokenType: tokens.token_type, hasRefresh: !!tokens.refresh_token },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inkeep/agents-manage-api",
3
- "version": "0.0.0-dev-20250930181023",
3
+ "version": "0.0.0-dev-20250930184723",
4
4
  "description": "Agents Manage API for Inkeep Agent Framework - handles CRUD operations and OAuth",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -23,7 +23,7 @@
23
23
  "openid-client": "^6.6.4",
24
24
  "pino": "^9.7.0",
25
25
  "zod": "^4.1.5",
26
- "@inkeep/agents-core": "^0.0.0-dev-20250930181023"
26
+ "@inkeep/agents-core": "^0.0.0-dev-20250930184723"
27
27
  },
28
28
  "optionalDependencies": {
29
29
  "keytar": "^7.9.0"