MCPcopy Index your code
hub / github.com/Waishnav/devspace / createMcpServer

Function createMcpServer

src/server.ts:655–1549  ·  view source on GitHub ↗
(
  config: ServerConfig,
  workspaces: WorkspaceRegistry,
  reviewCheckpoints: ReturnType<typeof createReviewCheckpointManager>,
  processSessions: ProcessSessionManager,
)

Source from the content-addressed store, hash-verified

653}
654
655function createMcpServer(
656 config: ServerConfig,
657 workspaces: WorkspaceRegistry,
658 reviewCheckpoints: ReturnType<typeof createReviewCheckpointManager>,
659 processSessions: ProcessSessionManager,
660): McpServer {
661 const toolNames = toolNamesFor(config);
662 const server = new McpServer(
663 {
664 name: "devspace",
665 title: "DevSpace",
666 version: "0.1.0",
667 description:
668 "Secure local coding workspace for MCP clients. Provides workspace-scoped file, search, edit, write, and shell tools.",
669 },
670 {
671 instructions: serverInstructions(config, toolNames),
672 },
673 );
674
675 registerAppResource(
676 server,
677 "DevSpace Diff Card",
678 WORKSPACE_APP_URI,
679 {
680 description: "Interactive card for viewing DevSpace file diffs.",
681 _meta: {
682 ui: {
683 csp: appCsp(config),
684 },
685 },
686 },
687 async () => {
688 await assertWorkspaceAppAssets();
689 return {
690 contents: [
691 {
692 uri: WORKSPACE_APP_URI,
693 mimeType: RESOURCE_MIME_TYPE,
694 text: workspaceAppHtml(config),
695 _meta: {
696 ui: {
697 csp: appCsp(config),
698 },
699 },
700 },
701 ],
702 };
703 },
704 );
705
706 registerAppTool(
707 server,
708 "open_workspace",
709 {
710 title: "Open workspace",
711 description:
712 "Open a local project directory as a coding workspace. Call this once per project folder or worktree before reading, editing, searching, writing, showing changes, or running commands. Reuse the returned workspaceId for later calls in the same folder; do not call open_workspace again unless switching folders/worktrees, changing checkout/worktree mode, the workspaceId is rejected as unknown, or the user explicitly asks to reopen. By default this opens the actual checkout; set mode=\"worktree\" when the user asks for an isolated or parallel coding session. Returns a workspaceId, loaded root project instructions, and nested instruction file paths the model should read before working in those directories.",

Callers 1

createServerFunction · 0.85

Calls 15

toolNamesForFunction · 0.85
serverInstructionsFunction · 0.85
appCspFunction · 0.85
assertWorkspaceAppAssetsFunction · 0.85
workspaceAppHtmlFunction · 0.85
toolWidgetDescriptorMetaFunction · 0.85
formatPathForPromptFunction · 0.85
formatAgentsPathFunction · 0.85
logToolCallFunction · 0.85
resultOutputSchemaFunction · 0.85
readFileToolFunction · 0.85
logFailedToolResponseFunction · 0.85

Tested by

no test coverage detected