Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,14 @@
<type>pom</type>
<scope>import</scope>
</dependency>
<!-- MCP Server BOM for version management -->
<dependency>
<groupId>io.quarkiverse.mcp</groupId>
<artifactId>quarkus-mcp-server-bom</artifactId>
<version>1.10.0</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<!-- Add local repository for private java driver queryBuilder build to avoid using systemPath in dependency-->
Expand Down Expand Up @@ -148,6 +156,16 @@
<groupId>io.quarkus</groupId>
<artifactId>quarkus-logging-json</artifactId>
</dependency>
<!-- MCP (Model Context Protocol) server support -->
<dependency>
<groupId>io.quarkiverse.mcp</groupId>
<artifactId>quarkus-mcp-server-http</artifactId>
</dependency>
<dependency>
<groupId>io.quarkiverse.mcp</groupId>
<artifactId>quarkus-mcp-server-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>jakarta.validation</groupId>
<artifactId>jakarta.validation-api</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@
*/
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.WRAPPER_OBJECT)
@JsonSubTypes({
@JsonSubTypes.Type(value = FindEmbeddingProvidersCommand.class),
@JsonSubTypes.Type(value = FindRerankingProvidersCommand.class),
@JsonSubTypes.Type(value = CreateNamespaceCommand.class),
@JsonSubTypes.Type(value = CreateKeyspaceCommand.class),
@JsonSubTypes.Type(value = DropNamespaceCommand.class),
@JsonSubTypes.Type(value = CreateNamespaceCommand.class), // deprecated
@JsonSubTypes.Type(value = DropKeyspaceCommand.class),
@JsonSubTypes.Type(value = FindNamespacesCommand.class),
@JsonSubTypes.Type(value = DropNamespaceCommand.class), // deprecated
@JsonSubTypes.Type(value = FindKeyspacesCommand.class),
@JsonSubTypes.Type(value = FindNamespacesCommand.class), // deprecated
@JsonSubTypes.Type(value = FindEmbeddingProvidersCommand.class),
@JsonSubTypes.Type(value = FindRerankingProvidersCommand.class),
})
public interface GeneralCommand extends Command {}
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import com.fasterxml.uuid.Generators;
import com.fasterxml.uuid.NoArgGenerator;
import com.google.common.annotations.VisibleForTesting;
import io.quarkus.security.identity.SecurityIdentity;
import io.stargate.sgv2.jsonapi.api.request.tenant.RequestTenantResolver;
import io.stargate.sgv2.jsonapi.api.request.tenant.Tenant;
import io.stargate.sgv2.jsonapi.api.request.token.RequestAuthTokenResolver;
Expand Down Expand Up @@ -55,6 +56,38 @@ public RequestContext(Tenant tenant, String authToken, UserAgent userAgent) {
this.httpHeaders = null;
}

/**
* Constructor for non-JAX-RS HTTP contexts (e.g., MCP Streamable HTTP) where JAX-RS {@link
* SecurityContext} is not available but Quarkus {@link SecurityIdentity} is. Uses the same
* resolution logic as the CDI constructor.
*/
public RequestContext(
RoutingContext routingContext,
SecurityIdentity securityIdentity,
Instance<RequestTenantResolver> tenantResolver,
Instance<EmbeddingCredentialsResolver> embeddingCredentialsResolver) {

this.httpHeaders = new HttpHeaderAccess(routingContext.request().headers());

// Token from SecurityIdentity principal (same as PrincipalTokenResolver logic)
this.authToken =
normalizeOptionalString(
securityIdentity.getPrincipal() != null
? securityIdentity.getPrincipal().getName()
: null);
this.requestId = generateRequestId();
this.userAgent = new UserAgent(httpHeaders.getHeader(HttpHeaders.USER_AGENT));
this.tenant = tenantResolver.get().resolve(routingContext, null);

this.embeddingCredentials =
embeddingCredentialsResolver.get().resolveEmbeddingCredentials(tenant, routingContext);

this.rerankingCredentials =
HeaderBasedRerankingKeyResolver.resolveRerankingKey(routingContext)
.map(s -> new RerankingCredentials(tenant, normalizeOptionalString(s)))
.orElseGet(() -> new RerankingCredentials(tenant, authToken));
}

@Inject
public RequestContext(
RoutingContext routingContext,
Expand Down
Loading
Loading