style: auto-fix lint and format

This commit is contained in:
ajnart authored and github-actions[bot] committed 2026-06-08 21:39:41 +00:00
1 parent 7500128354
commit acf8d572da
5 files changed
+59 -31

No files matched your search

@@ -292,8 +292,12 @@ export function McpInstructions({ baseUrl, hasApiKeys, toolGroups }: McpInstruct
<AccordionItem key={group.namespace} value={group.namespace}>
<AccordionControl>
<Group gap="xs">
<Text size="sm" fw={600}>{group.namespace}</Text>
<Badge size="xs" variant="light" circle>{group.tools.length}</Badge>
<Text size="sm" fw={600}>
{group.namespace}
</Text>
<Badge size="xs" variant="light" circle>
{group.tools.length}
</Badge>
</Group>
</AccordionControl>
<AccordionPanel>
@@ -304,8 +308,12 @@ export function McpInstructions({ baseUrl, hasApiKeys, toolGroups }: McpInstruct
{toolTypeDisplay[tool.type].method}
</Badge>
<div>
<Code fz="xs" fw={600}>{tool.name}</Code>
<Text size="xs" c="dimmed" lh={1.4}>{tool.description}</Text>
<Code fz="xs" fw={600}>
{tool.name}
</Code>
<Text size="xs" c="dimmed" lh={1.4}>
{tool.description}
</Text>
</div>
</div>
))}
@@ -29,10 +29,12 @@ declare global {
var mcpRateLimit: RateLimitStore | undefined;
}
const rateLimitStore = globalThis.mcpRateLimit ?? (globalThis.mcpRateLimit = {
authFailures: new Map(),
cleanupTimer: null,
});
const rateLimitStore =
globalThis.mcpRateLimit ??
(globalThis.mcpRateLimit = {
authFailures: new Map(),
cleanupTimer: null,
});
const authFailures = rateLimitStore.authFailures;
if (!rateLimitStore.cleanupTimer) {
@@ -203,7 +205,10 @@ const mcpHandler = createMcpHandler(
};
} catch (error) {
const message = sanitizeErrorMessage(error);
logger.warn("MCP tool execution failed", { tool: name, error: error instanceof Error ? error.message : String(error) });
logger.warn("MCP tool execution failed", {
tool: name,
error: error instanceof Error ? error.message : String(error),
});
return {
content: [{ type: "text" as const, text: JSON.stringify({ error: message }) }],
isError: true,
@@ -248,7 +253,11 @@ const handler = async (req: NextRequest) => {
const { ua } = userAgent(req);
if (!checkAuthRateLimit(ipAddress)) {
return jsonErrorResponse(429, { error: "rate_limited", hint: "Too many failed authentication attempts. Try again later." }, { "Retry-After": "60" });
return jsonErrorResponse(
429,
{ error: "rate_limited", hint: "Too many failed authentication attempts. Try again later." },
{ "Retry-After": "60" },
);
}
if (!apiKeyValue) {
@@ -256,7 +265,10 @@ const handler = async (req: NextRequest) => {
const baseUrl = extractBaseUrlFromHeaders(req.headers);
return jsonErrorResponse(
401,
{ error: "unauthorized", hint: "Authenticate with an ApiKey header or via OAuth at /.well-known/oauth-authorization-server" },
{
error: "unauthorized",
hint: "Authenticate with an ApiKey header or via OAuth at /.well-known/oauth-authorization-server",
},
{ "WWW-Authenticate": `Bearer resource_metadata="${baseUrl}/.well-known/oauth-protected-resource"` },
);
}
@@ -270,7 +282,10 @@ const handler = async (req: NextRequest) => {
if (!session) {
recordAuthFailure(ipAddress);
return jsonErrorResponse(401, { error: "invalid_token", hint: "The API key was not found or the token is incorrect." });
return jsonErrorResponse(401, {
error: "invalid_token",
hint: "The API key was not found or the token is incorrect.",
});
}
clearAuthFailures(ipAddress);
+8 -6
View File
@@ -38,12 +38,14 @@ declare global {
var mcpOAuthStore: OAuthStore | undefined;
}
const store = globalThis.mcpOAuthStore ?? (globalThis.mcpOAuthStore = {
clients: new Map(),
authCodes: new Map(),
pendingAuths: new Map(),
cleanupTimer: null,
});
const store =
globalThis.mcpOAuthStore ??
(globalThis.mcpOAuthStore = {
clients: new Map(),
authCodes: new Map(),
pendingAuths: new Map(),
cleanupTimer: null,
});
const clients = store.clients;
const authCodes = store.authCodes;
const pendingAuths = store.pendingAuths;
@@ -12,10 +12,12 @@ declare global {
var mcpRegisterRateLimit: RateLimitStore | undefined;
}
const store = globalThis.mcpRegisterRateLimit ?? (globalThis.mcpRegisterRateLimit = {
attempts: new Map(),
timer: null,
});
const store =
globalThis.mcpRegisterRateLimit ??
(globalThis.mcpRegisterRateLimit = {
attempts: new Map(),
timer: null,
});
const registerAttempts = store.attempts;
if (!store.timer) {
@@ -22,10 +22,12 @@ declare global {
var mcpTokenRateLimit: RateLimitStore | undefined;
}
const store = globalThis.mcpTokenRateLimit ?? (globalThis.mcpTokenRateLimit = {
failures: new Map(),
timer: null,
});
const store =
globalThis.mcpTokenRateLimit ??
(globalThis.mcpTokenRateLimit = {
failures: new Map(),
timer: null,
});
const tokenFailures = store.failures;
if (!store.timer) {
@@ -133,10 +135,9 @@ export async function POST(req: Request) {
scope: "mcp:tools",
});
} catch (error) {
logger.error("Failed to create API key during OAuth token exchange", { error: error instanceof Error ? error.message : String(error) });
return Response.json(
{ error: "server_error", error_description: "Failed to issue access token" },
{ status: 500 },
);
logger.error("Failed to create API key during OAuth token exchange", {
error: error instanceof Error ? error.message : String(error),
});
return Response.json({ error: "server_error", error_description: "Failed to issue access token" }, { status: 500 });
}
}