( config: ServerConfig, workspaces: WorkspaceRegistry, reviewCheckpoints: ReturnType<typeof createReviewCheckpointManager>, processSessions: ProcessSessionManager, )
| 653 | } |
| 654 | |
| 655 | function 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.", |
no test coverage detected