MCPcopy Index your code
hub / github.com/CodebuffAI/codebuff / hashConfig

Function hashConfig

common/src/mcp/client.ts:49–75  ·  view source on GitHub ↗
(config: MCPConfig)

Source from the content-addressed store, hash-verified

47}
48
49function hashConfig(config: MCPConfig): string {
50 if (config.type === 'stdio') {
51 return JSON.stringify({
52 command: config.command,
53 args: config.args,
54 env: config.env,
55 })
56 }
57 if (config.type === 'http') {
58 return JSON.stringify({
59 type: 'http',
60 url: config.url,
61 params: config.params,
62 })
63 }
64 if (config.type === 'sse') {
65 return JSON.stringify({
66 type: 'sse',
67 url: config.url,
68 params: config.params,
69 })
70 }
71 config.type satisfies never
72 throw new Error(
73 `Internal error in hashConfig: invalid MCP config type ${config.type}`,
74 )
75}
76
77export async function getMCPClient(config: MCPConfig): Promise<string> {
78 let key = hashConfig(config)

Callers 1

getMCPClientFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected