MCPcopy Create free account
hub / github.com/Microck/opencode-studio / sanitizeMCPConfig

Function sanitizeMCPConfig

client-next/src/lib/context.tsx:30–49  ·  view source on GitHub ↗
(config: MCPConfig)

Source from the content-addressed store, hash-verified

28const AppContext = createContext<AppContextType | undefined>(undefined);
29
30function sanitizeMCPConfig(config: MCPConfig): MCPConfig {
31 const newConfig = { ...config };
32
33 // Merge args into command if present
34 if (newConfig.args && newConfig.args.length > 0) {
35 if (!newConfig.command) newConfig.command = [];
36 if (Array.isArray(newConfig.command)) {
37 newConfig.command = [...newConfig.command, ...newConfig.args];
38 }
39 delete newConfig.args;
40 }
41
42 // Rename env to environment
43 if (newConfig.env) {
44 newConfig.environment = { ...newConfig.environment, ...newConfig.env };
45 delete newConfig.env;
46 }
47
48 return newConfig;
49}
50
51export function AppProvider({ children }: { children: ReactNode }) {
52 const [config, setConfig] = useState<OpencodeConfig | null>(null);

Callers 1

AppProviderFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected