Skip to content

Commit 59e133c

Browse files
cursoragentmsukkari
andcommitted
revert: remove changes to deprecated packages/mcp
The packages/mcp package is deprecated and should not be modified. Reverted the conditional ask_codebase registration changes from this package. Co-authored-by: Michael Sukkarieh <msukkari@users.noreply.github.com>
1 parent 5aa8e8a commit 59e133c

File tree

1 file changed

+38
-44
lines changed

1 file changed

+38
-44
lines changed

packages/mcp/src/index.ts

Lines changed: 38 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,14 @@ import { buildTreeNodeIndex, joinTreePath, normalizeTreePath, sortTreeEntries }
1414

1515
const dedent = _dedent.withOptions({ alignValues: true });
1616

17-
function registerTools(server: McpServer, hasLanguageModels: boolean) {
18-
server.tool(
17+
// Create MCP server
18+
const server = new McpServer({
19+
name: 'sourcebot-mcp-server',
20+
version: '0.1.0',
21+
});
22+
23+
24+
server.tool(
1925
"search_code",
2026
dedent`
2127
Searches for code that matches the provided search query as a substring by default, or as a regular expression if useRegex is true. Useful for exploring remote repositories by searching for exact symbols, functions, variables, or specific code patterns. To determine if a repository is indexed, use the \`list_repos\` tool. By default, searches are global and will search the default branch of all repositories. Searches can be scoped to specific repositories, languages, and branches. When referencing code outputted by this tool, always include the file's external URL as a link. This makes it easier for the user to view the file, even if they don't have it locally checked out.
@@ -407,58 +413,46 @@ server.tool(
407413
}
408414
);
409415

410-
if (hasLanguageModels) {
411-
server.tool(
412-
"ask_codebase",
413-
dedent`
414-
Ask a natural language question about the codebase. This tool uses an AI agent to autonomously search code, read files, and find symbol references/definitions to answer your question.
416+
server.tool(
417+
"ask_codebase",
418+
dedent`
419+
Ask a natural language question about the codebase. This tool uses an AI agent to autonomously search code, read files, and find symbol references/definitions to answer your question.
415420
416-
The agent will:
417-
- Analyze your question and determine what context it needs
418-
- Search the codebase using multiple strategies (code search, symbol lookup, file reading)
419-
- Synthesize findings into a comprehensive answer with code references
421+
The agent will:
422+
- Analyze your question and determine what context it needs
423+
- Search the codebase using multiple strategies (code search, symbol lookup, file reading)
424+
- Synthesize findings into a comprehensive answer with code references
420425
421-
Returns a detailed answer in markdown format with code references, plus a link to view the full research session (including all tool calls and reasoning) in the Sourcebot web UI.
426+
Returns a detailed answer in markdown format with code references, plus a link to view the full research session (including all tool calls and reasoning) in the Sourcebot web UI.
422427
423-
When using this in shared environments (e.g., Slack), you can set the visibility parameter to 'PUBLIC' to ensure everyone can access the chat link.
428+
When using this in shared environments (e.g., Slack), you can set the visibility parameter to 'PUBLIC' to ensure everyone can access the chat link.
424429
425-
This is a blocking operation that may take 30-60+ seconds for complex questions as the agent researches the codebase.
426-
`,
427-
askCodebaseRequestSchema.shape,
428-
{ readOnlyHint: true },
429-
async (request: AskCodebaseRequest) => {
430-
const response = await askCodebase(request);
430+
This is a blocking operation that may take 30-60+ seconds for complex questions as the agent researches the codebase.
431+
`,
432+
askCodebaseRequestSchema.shape,
433+
{ readOnlyHint: true },
434+
async (request: AskCodebaseRequest) => {
435+
const response = await askCodebase(request);
431436

432-
// Format the response with the answer and a link to the chat
433-
const formattedResponse = dedent`
434-
${response.answer}
437+
// Format the response with the answer and a link to the chat
438+
const formattedResponse = dedent`
439+
${response.answer}
435440
436-
---
437-
**View full research session:** ${response.chatUrl}
438-
**Model used:** ${response.languageModel.model}
439-
`;
441+
---
442+
**View full research session:** ${response.chatUrl}
443+
**Model used:** ${response.languageModel.model}
444+
`;
440445

441-
return {
442-
content: [{
443-
type: "text",
444-
text: formattedResponse,
445-
}],
446-
};
447-
}
448-
);
446+
return {
447+
content: [{
448+
type: "text",
449+
text: formattedResponse,
450+
}],
451+
};
449452
}
450-
}
453+
);
451454

452455
const runServer = async () => {
453-
const server = new McpServer({
454-
name: 'sourcebot-mcp-server',
455-
version: '0.1.0',
456-
});
457-
458-
const models = await listLanguageModels();
459-
const hasLanguageModels = models.length > 0;
460-
registerTools(server, hasLanguageModels);
461-
462456
const transport = new StdioServerTransport();
463457
await server.connect(transport);
464458
}

0 commit comments

Comments
 (0)