Skip to content
Source
Sign inSign up
pingdotgg/t3code

Keep MCP credentials alive across provider turns #4659

Mergedjuliusmarmingemerged 1 commit intomain fromrefs/pull/4659/headmerged by juliusmarminge View on GitHub

Showing 9 changed files with 9 additions and 3 deletions (loading 6).

x
0 of 9 viewed, 9 left
0 additions and 1 deletionapps/server/src/mcp/McpHttpServer.test.tsModified
View file
@@ -23,7 +23,6 @@
providerInstanceId: ProviderInstanceId.make("codex"),
capabilities: new Set(["preview"] as const),
issuedAt: 1,
- expiresAt: Number.MAX_SAFE_INTEGER,
};
const client = McpSchema.McpServerClient.of({
clientId: 1,
9 additions and 1 deletionapps/server/src/mcp/McpHttpServer.tsModified
View file
@@ -74,7 +74,15 @@
? authorization.slice("Bearer ".length).trim()
: "";
const invocation = yield* registry.resolve(token);
- if (!invocation) return unauthorized;
+ if (!invocation) {
+ // Without this the only symptom of a dead credential is the agent
+ // quietly losing the whole `t3-code` toolkit for the rest of its
+ // session, with nothing on the server to explain why.
+ yield* Effect.logWarning("rejected MCP request with an unusable credential", {
+ reason: token.length === 0 ? "missing_bearer_token" : "unknown_or_expired_token",
+ });
+ return unauthorized;
+ }
return yield* httpEffect.pipe(
Effect.provideService(McpInvocationContext.McpInvocationContext, invocation),
Effect.map(normalizeMcpHttpResponse),