Download packages/agent-core-v2/src/app/mcpConfig/configSection.ts from SaylorTwift/kimi-code: direct link, hf CLI and curl.
- Browser
- Download file 1.28 kB
-
https://huggingface.co/SaylorTwift/kimi-code/resolve/main/packages/agent-core-v2/src/app/mcpConfig/configSection.ts
- Command line
-
hf download hf://SaylorTwift/kimi-code/packages/agent-core-v2/src/app/mcpConfig/configSection.ts
-
curl -L -o configSection.ts https://huggingface.co/SaylorTwift/kimi-code/resolve/main/packages/agent-core-v2/src/app/mcpConfig/configSection.ts
1.28 kB
| import { z } from 'zod'; | |
| import { type EnvBindings, envBindings, stripEnvBoundFields } from '#/app/config/config'; | |
| import { registerConfigSection } from '#/app/config/configSectionContributions'; | |
| import { MAX_MCP_TIMEOUT_MS, McpTimeoutMsSchema } from '#/mcpCore/config-schema'; | |
| export const MCP_SECTION = 'mcp'; | |
| export const McpSectionSchema = z.object({ | |
| startupTimeoutMs: McpTimeoutMsSchema.optional(), | |
| toolTimeoutMs: McpTimeoutMsSchema.optional(), | |
| }); | |
| export type McpSection = z.infer<typeof McpSectionSchema>; | |
| export const MCP_STARTUP_TIMEOUT_ENV = 'KIMI_MCP_STARTUP_TIMEOUT_MS'; | |
| export const MCP_TOOL_TIMEOUT_ENV = 'KIMI_MCP_TOOL_TIMEOUT_MS'; | |
| function parseTimeoutMsEnv(raw: string): number | undefined { | |
| const parsed = Number(raw); | |
| return Number.isInteger(parsed) && parsed >= 1 && parsed <= MAX_MCP_TIMEOUT_MS | |
| ? parsed | |
| : undefined; | |
| } | |
| export const mcpEnvBindings: EnvBindings<McpSection> = envBindings(McpSectionSchema, { | |
| startupTimeoutMs: { env: MCP_STARTUP_TIMEOUT_ENV, parse: parseTimeoutMsEnv }, | |
| toolTimeoutMs: { env: MCP_TOOL_TIMEOUT_ENV, parse: parseTimeoutMsEnv }, | |
| }); | |
| export const stripMcpEnv = stripEnvBoundFields(mcpEnvBindings); | |
| registerConfigSection(MCP_SECTION, McpSectionSchema, { | |
| env: mcpEnvBindings, | |
| stripEnv: stripMcpEnv, | |
| }); | |