@wonderwhy-er/desktop-commander 0.2.16 → 0.2.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -1
- package/dist/data/spec-kit-prompts.json +123 -0
- package/dist/handlers/filesystem-handlers.js +5 -2
- package/dist/handlers/history-handlers.d.ts +5 -0
- package/dist/handlers/history-handlers.js +35 -0
- package/dist/handlers/index.d.ts +1 -0
- package/dist/handlers/index.js +1 -0
- package/dist/http-index.d.ts +45 -0
- package/dist/http-index.js +51 -0
- package/dist/server.js +284 -203
- package/dist/tools/config.js +13 -1
- package/dist/tools/filesystem.d.ts +1 -1
- package/dist/tools/filesystem.js +51 -3
- package/dist/tools/schemas.d.ts +16 -0
- package/dist/tools/schemas.js +7 -0
- package/dist/utils/toolHistory.d.ts +73 -0
- package/dist/utils/toolHistory.js +197 -0
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +5 -1
package/README.md
CHANGED
|
@@ -427,7 +427,7 @@ The server provides a comprehensive set of tools organized into several categori
|
|
|
427
427
|
| | `read_multiple_files` | Read multiple files simultaneously |
|
|
428
428
|
| | `write_file` | Write file contents with options for rewrite or append mode (uses configurable line limits) |
|
|
429
429
|
| | `create_directory` | Create a new directory or ensure it exists |
|
|
430
|
-
| | `list_directory` | Get detailed listing of files and directories |
|
|
430
|
+
| | `list_directory` | Get detailed recursive listing of files and directories (supports depth parameter, default depth=2) |
|
|
431
431
|
| | `move_file` | Move or rename files and directories |
|
|
432
432
|
| | `start_search` | Start streaming search for files by name or content patterns (unified ripgrep-based search) |
|
|
433
433
|
| | `get_more_search_results` | Get paginated results from active search with offset support |
|
|
@@ -436,6 +436,7 @@ The server provides a comprehensive set of tools organized into several categori
|
|
|
436
436
|
| | `get_file_info` | Retrieve detailed metadata about a file or directory |
|
|
437
437
|
| **Text Editing** | `edit_block` | Apply targeted text replacements with enhanced prompting for smaller edits (includes character-level diff feedback) |
|
|
438
438
|
| **Analytics** | `get_usage_stats` | Get usage statistics for your own insight |
|
|
439
|
+
| | `get_recent_tool_calls` | Get recent tool call history with arguments and outputs for debugging and context recovery |
|
|
439
440
|
| | `give_feedback_to_desktop_commander` | Open feedback form in browser to provide feedback to Desktop Commander Team |
|
|
440
441
|
|
|
441
442
|
### Quick Examples
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": "1.0.0",
|
|
3
|
+
"description": "Spec-Kit prompts for specification-driven development workflows",
|
|
4
|
+
"prompts": [
|
|
5
|
+
{
|
|
6
|
+
"id": "spec_001",
|
|
7
|
+
"title": "Initialize Spec-Kit Project",
|
|
8
|
+
"description": "Set up a new project with spec-driven development workflow including templates, scripts, and AI agent integration.",
|
|
9
|
+
"prompt": "Let's initialize a new spec-driven development project! 🎯\n\n**Project Setup Process:**\n\n1. **Check Current Environment**: I'll verify if we're already in a spec-kit project (look for `.specify` folder)\n2. **Initialize New Project**: Set up project structure with `specify init <project-name>`\n3. **Configure AI Integration**: Choose your preferred AI agent (claude, copilot, gemini, cursor, etc.)\n4. **Explain Workflow**: Show you the available slash commands and methodology\n\n**What's the name of your new project?**\n\n*Example: `my-photo-app` or `user-auth-service`*\n\nOnce initialized, you'll have access to the complete spec-driven workflow:\n• `/constitution` - Define project principles\n• `/specify` - Create feature specifications\n• `/plan` - Generate technical plans\n• `/tasks` - Break down into actionable tasks\n• `/implement` - Execute implementation\n\nReady to get started?",
|
|
10
|
+
"categories": ["spec-kit"],
|
|
11
|
+
"secondaryTag": "Setup",
|
|
12
|
+
"votes": 0,
|
|
13
|
+
"gaClicks": 0,
|
|
14
|
+
"icon": "Rocket",
|
|
15
|
+
"author": "GitHub Spec-Kit",
|
|
16
|
+
"verified": true
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
"id": "spec_002",
|
|
20
|
+
"title": "Create Project Constitution",
|
|
21
|
+
"description": "Define project principles and governance that will guide all development decisions and ensure consistency across features.",
|
|
22
|
+
"prompt": "Let's establish your project constitution - the foundational principles that will guide all development! 📜\n\n**Constitution Creation Process:**\n\n1. **Analyze Current Context**: I'll check if you already have a constitution and understand your project\n2. **Define Core Principles**: Create non-negotiable rules for your development process\n3. **Set Governance**: Establish how principles are updated and enforced\n4. **Sync Dependencies**: Ensure all templates align with your new principles\n\n**What principles should guide your project?**\n\n*Examples:*\n• Code quality standards (testing requirements, review processes)\n• User experience consistency (accessibility-first, performance targets)\n• Technical constraints (preferred frameworks, deployment requirements)\n• Security requirements (authentication standards, data protection)\n\n**Tell me about your project's core values and constraints:**\n\nI'll create a comprehensive constitution that includes:\n• Principle definitions with clear rationale\n• Amendment procedures and versioning\n• Compliance review expectations\n• Template synchronization\n\nThis becomes the foundation for all future specifications and technical decisions!",
|
|
23
|
+
"categories": ["spec-kit"],
|
|
24
|
+
"secondaryTag": "Setup",
|
|
25
|
+
"votes": 0,
|
|
26
|
+
"gaClicks": 0,
|
|
27
|
+
"icon": "BookOpen",
|
|
28
|
+
"author": "GitHub Spec-Kit",
|
|
29
|
+
"verified": true
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
"id": "spec_003",
|
|
33
|
+
"title": "Create Feature Specification",
|
|
34
|
+
"description": "Generate a comprehensive feature specification from natural language description using spec-kit methodology and templates.",
|
|
35
|
+
"prompt": "Let's create a detailed feature specification using the spec-kit methodology! 📋\n\n**Specification Process:**\n\n1. **Create Feature Branch**: I'll run the create-new-feature script to set up a new branch and spec file\n2. **Generate Comprehensive Spec**: Use the spec-kit template to create:\n • User scenarios and testing approaches\n • Functional requirements (testable and unambiguous)\n • Key entities and data models\n • Success criteria and acceptance criteria\n3. **Mark Clarifications**: Highlight any areas that need more detail with [NEEDS CLARIFICATION] markers\n4. **Review Checklist**: Validate completeness and business alignment\n\n**What feature do you want to build?**\n\n*Be as detailed as possible about WHAT and WHY, avoid HOW:*\n\n*Examples:*\n• \"User authentication system with login, logout, and password reset\"\n• \"Photo album management with drag-and-drop organization\"\n• \"Real-time chat with message history and user presence\"\n• \"Task management with projects, assignments, and Kanban boards\"\n\n**Feature Description:**\n\nI'll focus on:\n✅ What users need and why\n✅ Business requirements and user scenarios\n✅ Testable functional requirements\n❌ Technical implementation details (saved for planning phase)\n\nReady to create your specification?",
|
|
36
|
+
"categories": ["spec-kit"],
|
|
37
|
+
"secondaryTag": "Specification",
|
|
38
|
+
"votes": 0,
|
|
39
|
+
"gaClicks": 0,
|
|
40
|
+
"icon": "FileText",
|
|
41
|
+
"author": "GitHub Spec-Kit",
|
|
42
|
+
"verified": true
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
"id": "spec_004",
|
|
46
|
+
"title": "Clarify Specification Requirements",
|
|
47
|
+
"description": "Run structured clarification workflow to resolve ambiguous requirements and ensure specification completeness before planning.",
|
|
48
|
+
"prompt": "Let's clarify any ambiguous areas in your specification before moving to technical planning! 🔍\n\n**Clarification Workflow:**\n\n1. **Analyze Current Spec**: I'll read your feature specification and identify areas marked with [NEEDS CLARIFICATION]\n2. **Structured Questioning**: Ask targeted questions about:\n • User types and permissions\n • Data retention and deletion policies\n • Performance targets and scale requirements\n • Error handling behaviors\n • Integration requirements\n3. **Document Answers**: Record all clarifications in the specification\n4. **Validate Completeness**: Ensure all requirements are testable and unambiguous\n\n**Current clarification areas in your spec:**\n\nI'll systematically work through each unclear aspect:\n• Who are the users and what are their roles?\n• What are the data and storage requirements?\n• What are the performance and scale expectations?\n• How should errors and edge cases be handled?\n• What integrations or external dependencies exist?\n\n**Ready to clarify your specification?**\n\n*This step is crucial for reducing rework during planning and implementation phases.*\n\nOnce clarified, your specification will be ready for technical planning with `/plan`!",
|
|
49
|
+
"categories": ["spec-kit"],
|
|
50
|
+
"secondaryTag": "Specification",
|
|
51
|
+
"votes": 0,
|
|
52
|
+
"gaClicks": 0,
|
|
53
|
+
"icon": "HelpCircle",
|
|
54
|
+
"author": "GitHub Spec-Kit",
|
|
55
|
+
"verified": true
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
"id": "spec_005",
|
|
59
|
+
"title": "Generate Technical Implementation Plan",
|
|
60
|
+
"description": "Create detailed technical plan from specification including architecture, tech stack, data models, and implementation strategy.",
|
|
61
|
+
"prompt": "Let's create a comprehensive technical implementation plan for your feature! 🏗️\n\n**Planning Process:**\n\n1. **Analyze Specification**: I'll read your feature spec and understand all requirements\n2. **Check Constitution**: Ensure alignment with project principles and constraints\n3. **Generate Implementation Plan**: Create detailed technical plan including:\n • Architecture and tech stack decisions\n • Data models based on key entities\n • API contracts and interfaces\n • Research for technical decisions\n • Quickstart validation scenarios\n4. **Validate Against Gates**: Check simplicity, anti-abstraction, and constitutional compliance\n\n**What's your preferred technology approach?**\n\n*Specify your tech stack and architectural preferences:*\n\n*Examples:*\n• \"React with TypeScript, Node.js backend, PostgreSQL database\"\n• \"Vanilla HTML/CSS/JavaScript, SQLite for local storage\"\n• \"Python FastAPI, Redis for caching, Docker deployment\"\n• \"Vue.js frontend, .NET Core API, SQL Server database\"\n\n**Technical Context:**\n\nI'll generate:\n📋 **Implementation Plan** - Architecture and approach\n🗄️ **Data Model** - Entities and relationships\n🔌 **API Contracts** - Endpoints and specifications\n🔬 **Research Notes** - Technical decisions and rationale\n⚡ **Quickstart Guide** - Key validation scenarios\n\nReady to create your technical plan?",
|
|
62
|
+
"categories": ["spec-kit"],
|
|
63
|
+
"secondaryTag": "Planning",
|
|
64
|
+
"votes": 0,
|
|
65
|
+
"gaClicks": 0,
|
|
66
|
+
"icon": "Blueprint",
|
|
67
|
+
"author": "GitHub Spec-Kit",
|
|
68
|
+
"verified": true
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
"id": "spec_006",
|
|
72
|
+
"title": "Generate Implementation Tasks",
|
|
73
|
+
"description": "Break down technical plan into actionable, dependency-ordered tasks ready for execution with parallel execution markers.",
|
|
74
|
+
"prompt": "Let's break down your implementation plan into actionable tasks! ✅\n\n**Task Generation Process:**\n\n1. **Analyze Design Artifacts**: I'll read your plan.md, data-model.md, contracts/, and other design documents\n2. **Generate Task Breakdown**: Create specific tasks organized by phases:\n • **Setup Tasks**: Project init, dependencies, configuration\n • **Test Tasks [P]**: Contract tests, integration scenarios (parallel)\n • **Core Tasks**: Models, services, CLI commands, endpoints\n • **Integration Tasks**: Database, middleware, logging\n • **Polish Tasks [P]**: Unit tests, performance, docs (parallel)\n3. **Order Dependencies**: Ensure proper execution sequence (TDD approach)\n4. **Mark Parallelization**: Identify tasks that can run simultaneously with [P]\n\n**Task Generation Rules:**\n• Each contract → test task marked [P]\n• Each entity → model creation task marked [P]\n• Each endpoint → implementation task\n• Different files = parallel [P]\n• Same files = sequential\n• Tests before implementation (TDD)\n\n**Additional context for task generation:**\n\n*Any specific requirements or preferences for the implementation approach?*\n\nI'll create a `tasks.md` file with:\n📝 **Numbered Tasks** (T001, T002, etc.)\n📁 **File Paths** for each task\n🔗 **Dependencies** clearly marked\n⚡ **Parallel Groups** for efficient execution\n\nReady to generate your implementation tasks?",
|
|
75
|
+
"categories": ["spec-kit"],
|
|
76
|
+
"secondaryTag": "Planning",
|
|
77
|
+
"votes": 0,
|
|
78
|
+
"gaClicks": 0,
|
|
79
|
+
"icon": "CheckSquare",
|
|
80
|
+
"author": "GitHub Spec-Kit",
|
|
81
|
+
"verified": true
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
"id": "spec_007",
|
|
85
|
+
"title": "Execute Feature Implementation",
|
|
86
|
+
"description": "Execute all implementation tasks following the task breakdown with TDD approach, dependency management, and progress tracking.",
|
|
87
|
+
"prompt": "Let's implement your feature following the spec-driven task breakdown! 🚀\n\n**Implementation Process:**\n\n1. **Load Implementation Context**: I'll read all your design documents:\n • tasks.md (execution plan)\n • plan.md (architecture and tech stack)\n • data-model.md (entities and relationships)\n • contracts/ (API specifications)\n • research.md (technical decisions)\n\n2. **Execute Phase-by-Phase**:\n • **Setup**: Project structure, dependencies, configuration\n • **Tests**: Contract tests and integration scenarios (TDD)\n • **Core**: Models, services, CLI commands, endpoints\n • **Integration**: Database, middleware, logging\n • **Polish**: Unit tests, performance, documentation\n\n3. **Follow Execution Rules**:\n • Respect task dependencies (sequential vs parallel)\n • Tests before implementation (TDD approach)\n • File-based coordination (same file = sequential)\n • Mark completed tasks with [X]\n\n4. **Progress Tracking**: Report after each completed task with validation\n\n**Implementation preferences:**\n\n*Any specific notes for the implementation (deployment targets, testing frameworks, etc.)?*\n\nI'll execute tasks systematically:\n✅ **Validate Prerequisites** - All documents ready\n📋 **Phase-by-Phase Execution** - Setup → Tests → Core → Integration → Polish\n🔄 **Real-time Progress** - Track completion and handle errors\n🎯 **Final Validation** - Ensure specs match implementation\n\nReady to build your feature?",
|
|
88
|
+
"categories": ["spec-kit"],
|
|
89
|
+
"secondaryTag": "Implementation",
|
|
90
|
+
"votes": 0,
|
|
91
|
+
"gaClicks": 0,
|
|
92
|
+
"icon": "Play",
|
|
93
|
+
"author": "GitHub Spec-Kit",
|
|
94
|
+
"verified": true
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
"id": "spec_008",
|
|
98
|
+
"title": "Analyze Spec-Kit Project Status",
|
|
99
|
+
"description": "Comprehensive analysis of current spec-kit project state including features, phases, and recommended next steps.",
|
|
100
|
+
"prompt": "Let me analyze your spec-kit project and show you the current state! 📊\n\n**Project Analysis Process:**\n\n1. **Project Structure Review**: I'll examine your `.specify` directory and validate:\n • Templates and scripts availability\n • Project constitution and principles\n • Current branch and feature context\n\n2. **Feature Inventory**: Scan the `specs/` directory to identify:\n • All features and their completion status\n • Current phase (specification, planning, tasks, implementation)\n • Missing or incomplete artifacts\n\n3. **Health Check**: Verify project follows spec-kit best practices:\n • All required templates present\n • Script permissions and functionality\n • Git branch structure and workflow\n\n4. **Progress Assessment**: For the current feature:\n • What phase are you in?\n • What files exist vs. what's missing?\n • What's the logical next step?\n\n**Current Project Overview:**\n\nI'll provide:\n📋 **Feature Status Matrix** - All features and their phases\n🎯 **Current Focus** - Active feature and next steps\n⚙️ **Configuration Health** - Templates and scripts status\n📈 **Recommendations** - Suggested workflow continuations\n\n**Any specific areas you'd like me to focus on?**\n\n*Examples: \"Focus on feature completion status\" or \"Check for any configuration issues\"*\n\nLet me give you a complete project status report!",
|
|
101
|
+
"categories": ["spec-kit"],
|
|
102
|
+
"secondaryTag": "Analysis",
|
|
103
|
+
"votes": 0,
|
|
104
|
+
"gaClicks": 0,
|
|
105
|
+
"icon": "BarChart3",
|
|
106
|
+
"author": "GitHub Spec-Kit",
|
|
107
|
+
"verified": true
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
"id": "spec_009",
|
|
111
|
+
"title": "Validate Spec-Kit Workflow Compliance",
|
|
112
|
+
"description": "Check project adherence to spec-kit methodology and constitutional requirements with recommendations for improvements.",
|
|
113
|
+
"prompt": "Let's validate your project's compliance with spec-kit methodology and constitutional requirements! ✅\n\n**Compliance Validation Process:**\n\n1. **Constitutional Compliance**: I'll check if your features align with project constitution:\n • Principle adherence in specifications\n • Technical decisions follow governance\n • Implementation respects constraints\n\n2. **Methodology Validation**: Verify proper spec-kit workflow:\n • Specifications focus on WHAT/WHY (not HOW)\n • Technical plans follow from specifications\n • Tasks properly break down implementation\n • Test-driven development approach\n\n3. **Quality Assessment**: Review specification and planning quality:\n • Requirements are testable and unambiguous\n • No [NEEDS CLARIFICATION] markers remain\n • Success criteria are measurable\n • Technical decisions have clear rationale\n\n4. **Process Adherence**: Check workflow execution:\n • Proper phase progression (spec → plan → tasks → implement)\n • Branch management and version control\n • Documentation completeness\n\n**Compliance Report:**\n\nI'll generate:\n📋 **Constitutional Alignment** - Principle compliance score\n🔄 **Workflow Adherence** - Methodology following assessment\n📝 **Quality Metrics** - Specification and planning quality\n⚠️ **Issue Identification** - Areas needing attention\n🎯 **Recommendations** - Specific improvement actions\n\n**Any specific compliance areas you're concerned about?**\n\nReady for a complete compliance assessment?",
|
|
114
|
+
"categories": ["spec-kit"],
|
|
115
|
+
"secondaryTag": "Analysis",
|
|
116
|
+
"votes": 0,
|
|
117
|
+
"gaClicks": 0,
|
|
118
|
+
"icon": "Shield",
|
|
119
|
+
"author": "GitHub Spec-Kit",
|
|
120
|
+
"verified": true
|
|
121
|
+
}
|
|
122
|
+
]
|
|
123
|
+
}
|
|
@@ -166,10 +166,13 @@ export async function handleCreateDirectory(args) {
|
|
|
166
166
|
*/
|
|
167
167
|
export async function handleListDirectory(args) {
|
|
168
168
|
try {
|
|
169
|
+
const startTime = Date.now();
|
|
169
170
|
const parsed = ListDirectoryArgsSchema.parse(args);
|
|
170
|
-
const entries = await listDirectory(parsed.path);
|
|
171
|
+
const entries = await listDirectory(parsed.path, parsed.depth);
|
|
172
|
+
const duration = Date.now() - startTime;
|
|
173
|
+
const resultText = entries.join('\n');
|
|
171
174
|
return {
|
|
172
|
-
content: [{ type: "text", text:
|
|
175
|
+
content: [{ type: "text", text: resultText }],
|
|
173
176
|
};
|
|
174
177
|
}
|
|
175
178
|
catch (error) {
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { toolHistory } from '../utils/toolHistory.js';
|
|
2
|
+
import { GetRecentToolCallsArgsSchema } from '../tools/schemas.js';
|
|
3
|
+
/**
|
|
4
|
+
* Handle get_recent_tool_calls command
|
|
5
|
+
*/
|
|
6
|
+
export async function handleGetRecentToolCalls(args) {
|
|
7
|
+
try {
|
|
8
|
+
const parsed = GetRecentToolCallsArgsSchema.parse(args);
|
|
9
|
+
// Use formatted version with local timezone
|
|
10
|
+
const calls = toolHistory.getRecentCallsFormatted({
|
|
11
|
+
maxResults: parsed.maxResults,
|
|
12
|
+
toolName: parsed.toolName,
|
|
13
|
+
since: parsed.since
|
|
14
|
+
});
|
|
15
|
+
const stats = toolHistory.getStats();
|
|
16
|
+
// Format the response (excluding file path per user request)
|
|
17
|
+
const summary = `Tool Call History (${calls.length} results, ${stats.totalEntries} total in memory)`;
|
|
18
|
+
const historyJson = JSON.stringify(calls, null, 2);
|
|
19
|
+
return {
|
|
20
|
+
content: [{
|
|
21
|
+
type: "text",
|
|
22
|
+
text: `${summary}\n\n${historyJson}`
|
|
23
|
+
}]
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
catch (error) {
|
|
27
|
+
return {
|
|
28
|
+
content: [{
|
|
29
|
+
type: "text",
|
|
30
|
+
text: `Error getting tool history: ${error instanceof Error ? error.message : String(error)}`
|
|
31
|
+
}],
|
|
32
|
+
isError: true
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
}
|
package/dist/handlers/index.d.ts
CHANGED
package/dist/handlers/index.js
CHANGED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* HTTP Server Entry Point for Desktop Commander
|
|
4
|
+
*
|
|
5
|
+
* This file is used by Smithery CLI to create a Streamable HTTP server.
|
|
6
|
+
* For local stdio usage, see src/index.ts
|
|
7
|
+
*
|
|
8
|
+
* This is a thin wrapper that:
|
|
9
|
+
* 1. Applies configuration from Smithery
|
|
10
|
+
* 2. Returns the existing MCP server for HTTP transport
|
|
11
|
+
*/
|
|
12
|
+
interface ServerConfig {
|
|
13
|
+
config?: {
|
|
14
|
+
allowedDirectories?: string[];
|
|
15
|
+
blockedCommands?: string[];
|
|
16
|
+
defaultShell?: string;
|
|
17
|
+
fileReadLineLimit?: number;
|
|
18
|
+
fileWriteLineLimit?: number;
|
|
19
|
+
telemetryEnabled?: boolean;
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
export default function createServer({ config }?: ServerConfig): Promise<import("@modelcontextprotocol/sdk/server").Server<{
|
|
23
|
+
method: string;
|
|
24
|
+
params?: {
|
|
25
|
+
[x: string]: unknown;
|
|
26
|
+
_meta?: {
|
|
27
|
+
[x: string]: unknown;
|
|
28
|
+
progressToken?: string | number | undefined;
|
|
29
|
+
} | undefined;
|
|
30
|
+
} | undefined;
|
|
31
|
+
}, {
|
|
32
|
+
method: string;
|
|
33
|
+
params?: {
|
|
34
|
+
[x: string]: unknown;
|
|
35
|
+
_meta?: {
|
|
36
|
+
[x: string]: unknown;
|
|
37
|
+
} | undefined;
|
|
38
|
+
} | undefined;
|
|
39
|
+
}, {
|
|
40
|
+
[x: string]: unknown;
|
|
41
|
+
_meta?: {
|
|
42
|
+
[x: string]: unknown;
|
|
43
|
+
} | undefined;
|
|
44
|
+
}>>;
|
|
45
|
+
export {};
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* HTTP Server Entry Point for Desktop Commander
|
|
4
|
+
*
|
|
5
|
+
* This file is used by Smithery CLI to create a Streamable HTTP server.
|
|
6
|
+
* For local stdio usage, see src/index.ts
|
|
7
|
+
*
|
|
8
|
+
* This is a thin wrapper that:
|
|
9
|
+
* 1. Applies configuration from Smithery
|
|
10
|
+
* 2. Returns the existing MCP server for HTTP transport
|
|
11
|
+
*/
|
|
12
|
+
import { server } from './server.js';
|
|
13
|
+
import { configManager } from './config-manager.js';
|
|
14
|
+
import { logToStderr } from './utils/logger.js';
|
|
15
|
+
export default async function createServer({ config } = {}) {
|
|
16
|
+
logToStderr('info', '🌐 Starting Desktop Commander HTTP Server...');
|
|
17
|
+
// Apply configuration if provided
|
|
18
|
+
if (config) {
|
|
19
|
+
try {
|
|
20
|
+
logToStderr('info', 'Applying HTTP server configuration...');
|
|
21
|
+
if (config.allowedDirectories !== undefined) {
|
|
22
|
+
await configManager.setValue('allowedDirectories', config.allowedDirectories);
|
|
23
|
+
}
|
|
24
|
+
if (config.blockedCommands !== undefined) {
|
|
25
|
+
await configManager.setValue('blockedCommands', config.blockedCommands);
|
|
26
|
+
}
|
|
27
|
+
if (config.defaultShell !== undefined) {
|
|
28
|
+
await configManager.setValue('defaultShell', config.defaultShell);
|
|
29
|
+
}
|
|
30
|
+
if (config.fileReadLineLimit !== undefined) {
|
|
31
|
+
await configManager.setValue('fileReadLineLimit', config.fileReadLineLimit);
|
|
32
|
+
}
|
|
33
|
+
if (config.fileWriteLineLimit !== undefined) {
|
|
34
|
+
await configManager.setValue('fileWriteLineLimit', config.fileWriteLineLimit);
|
|
35
|
+
}
|
|
36
|
+
if (config.telemetryEnabled !== undefined) {
|
|
37
|
+
await configManager.setValue('telemetryEnabled', config.telemetryEnabled);
|
|
38
|
+
}
|
|
39
|
+
logToStderr('info', '✅ HTTP server configuration applied successfully');
|
|
40
|
+
}
|
|
41
|
+
catch (error) {
|
|
42
|
+
logToStderr('error', `Failed to apply configuration: ${error instanceof Error ? error.message : String(error)}`);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
else {
|
|
46
|
+
logToStderr('info', 'No configuration provided, using defaults');
|
|
47
|
+
}
|
|
48
|
+
logToStderr('info', '✅ Desktop Commander HTTP Server ready');
|
|
49
|
+
// Return the existing server instance - it already has all tools registered
|
|
50
|
+
return server;
|
|
51
|
+
}
|