MCPcopy
hub / github.com/inkeep/open-knowledge / resolveServerUrlForCwd

Function resolveServerUrlForCwd

packages/cli/src/mcp/server.ts:228–243  ·  view source on GitHub ↗
(cwd?: string)

Source from the content-addressed store, hash-verified

226 };
227
228 const resolveServerUrlForCwd = async (cwd?: string): Promise<string | undefined> => {
229 const r = await resolveStickyProjectDir(cwd, stickyProjectDir, rootsFallback);
230 stickyProjectDir = r.nextSticky ?? stickyProjectDir;
231 if (r.projectDir === undefined) return undefined;
232 if (r.viaRootGuess) void maybeWarnWorktreeAmbiguity(r.projectDir);
233 const projectDir = r.projectDir;
234 const config = await resolveConfigForCwd(projectDir);
235 const mcpUrl = await resolveMcpHttpUrl({
236 lockDir: getLocalDir(projectDir),
237 contentDir: resolveContentDir(config, projectDir),
238 envAutoStart,
239 ...(spawnTimeoutMs !== undefined ? { timeoutMs: spawnTimeoutMs } : {}),
240 });
241 ensureKeepaliveForProject(projectDir);
242 return mcpUrl.replace(/\/mcp$/, '');
243 };
244
245 server.server.oninitialized = () => {
246 const clientInfo = server.server.getClientVersion();

Callers

nothing calls this directly

Calls 6

resolveMcpHttpUrlFunction · 0.90
resolveStickyProjectDirFunction · 0.85
getLocalDirFunction · 0.85
resolveContentDirFunction · 0.50

Tested by

no test coverage detected