Initial commit
This commit is contained in:
12
.claude-plugin/plugin.json
Normal file
12
.claude-plugin/plugin.json
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
{
|
||||||
|
"name": "desktop-integrator",
|
||||||
|
"description": "This command provides the context necessary for Claude Code to create the Desktop Extension or .dxt file of an MCP.",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"author": {
|
||||||
|
"name": "ClaudeForge Community",
|
||||||
|
"url": "https://github.com/claudeforge/marketplace"
|
||||||
|
},
|
||||||
|
"commands": [
|
||||||
|
"./commands"
|
||||||
|
]
|
||||||
|
}
|
||||||
3
README.md
Normal file
3
README.md
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
# desktop-integrator
|
||||||
|
|
||||||
|
This command provides the context necessary for Claude Code to create the Desktop Extension or .dxt file of an MCP.
|
||||||
166
commands/claude-desktop-extension.md
Normal file
166
commands/claude-desktop-extension.md
Normal file
@@ -0,0 +1,166 @@
|
|||||||
|
---
|
||||||
|
description: Build Claude Desktop Extensions (DXT) with proper MCP server setup and manifest configuration
|
||||||
|
version: 1.0.0
|
||||||
|
---
|
||||||
|
|
||||||
|
# Claude Desktop Extension Builder
|
||||||
|
|
||||||
|
Build Claude Desktop Extensions using the Model Context Protocol to extend Claude Desktop with custom tools and capabilities.
|
||||||
|
|
||||||
|
## What It Does
|
||||||
|
|
||||||
|
- Creates MCP-compatible server implementations
|
||||||
|
- Generates valid extension manifest files
|
||||||
|
- Sets up proper tool definitions and schemas
|
||||||
|
- Configures stdio transport for local execution
|
||||||
|
- Enables custom functionality in Claude Desktop
|
||||||
|
|
||||||
|
## How to Use
|
||||||
|
|
||||||
|
Run this command when you want to create a new Desktop Extension:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
/claude-desktop-extension
|
||||||
|
```
|
||||||
|
|
||||||
|
The command will guide you through creating a complete extension with server code and manifest.
|
||||||
|
|
||||||
|
## Example Structure
|
||||||
|
|
||||||
|
A basic DXT includes two main files:
|
||||||
|
|
||||||
|
**manifest.json**
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"name": "my-extension",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"description": "Custom tools for Claude",
|
||||||
|
"main": "server.js",
|
||||||
|
"mcp": {
|
||||||
|
"transport": "stdio"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
**server.js**
|
||||||
|
```javascript
|
||||||
|
import { Server } from '@modelcontextprotocol/sdk/server/index.js';
|
||||||
|
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
|
||||||
|
|
||||||
|
const server = new Server({
|
||||||
|
name: 'my-extension',
|
||||||
|
version: '1.0.0'
|
||||||
|
}, {
|
||||||
|
capabilities: {
|
||||||
|
tools: {}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
server.setRequestHandler('tools/list', async () => ({
|
||||||
|
tools: [{
|
||||||
|
name: 'my_tool',
|
||||||
|
description: 'Does something useful',
|
||||||
|
inputSchema: {
|
||||||
|
type: 'object',
|
||||||
|
properties: {
|
||||||
|
input: { type: 'string' }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}]
|
||||||
|
}));
|
||||||
|
|
||||||
|
server.setRequestHandler('tools/call', async (request) => {
|
||||||
|
const { name, arguments: args } = request.params;
|
||||||
|
|
||||||
|
if (name === 'my_tool') {
|
||||||
|
return {
|
||||||
|
content: [{ type: 'text', text: `Processed: ${args.input}` }]
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
throw new Error(`Unknown tool: ${name}`);
|
||||||
|
});
|
||||||
|
|
||||||
|
const transport = new StdioServerTransport();
|
||||||
|
await server.connect(transport);
|
||||||
|
```
|
||||||
|
|
||||||
|
## Use Cases
|
||||||
|
|
||||||
|
- **File System Tools**: Add custom file operations beyond built-in capabilities
|
||||||
|
- **API Integrations**: Connect Claude to external services and APIs
|
||||||
|
- **Data Processing**: Create specialized data transformation tools
|
||||||
|
- **System Utilities**: Access system information or execute commands
|
||||||
|
- **Database Access**: Query and modify database contents
|
||||||
|
|
||||||
|
## Best Practices
|
||||||
|
|
||||||
|
- **Error Handling**: Wrap tool logic in try-catch blocks and return meaningful error messages
|
||||||
|
- **Input Validation**: Use JSON Schema to validate tool inputs before processing
|
||||||
|
- **Async Operations**: Use async/await for I/O operations and external API calls
|
||||||
|
- **Logging**: Add console.error() for debugging (output goes to Claude Desktop logs)
|
||||||
|
- **Tool Naming**: Use snake_case for tool names and be descriptive
|
||||||
|
- **Schema Design**: Define clear input schemas with required fields and types
|
||||||
|
- **Response Format**: Always return structured content arrays
|
||||||
|
- **Testing**: Test with sample inputs before deploying to Claude Desktop
|
||||||
|
|
||||||
|
## Installation
|
||||||
|
|
||||||
|
After building your extension:
|
||||||
|
|
||||||
|
1. Save files in a dedicated directory
|
||||||
|
2. Run `npm install @modelcontextprotocol/sdk`
|
||||||
|
3. Add to Claude Desktop config:
|
||||||
|
|
||||||
|
**macOS**: `~/Library/Application Support/Claude/claude_desktop_config.json`
|
||||||
|
**Windows**: `%APPDATA%/Claude/claude_desktop_config.json`
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"mcpServers": {
|
||||||
|
"my-extension": {
|
||||||
|
"command": "node",
|
||||||
|
"args": ["/path/to/your/server.js"]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
4. Restart Claude Desktop
|
||||||
|
|
||||||
|
## Common Patterns
|
||||||
|
|
||||||
|
**Reading environment variables:**
|
||||||
|
```javascript
|
||||||
|
const apiKey = process.env.API_KEY;
|
||||||
|
if (!apiKey) {
|
||||||
|
throw new Error('API_KEY not configured');
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
**Making HTTP requests:**
|
||||||
|
```javascript
|
||||||
|
const response = await fetch('https://api.example.com/data');
|
||||||
|
const data = await response.json();
|
||||||
|
return { content: [{ type: 'text', text: JSON.stringify(data) }] };
|
||||||
|
```
|
||||||
|
|
||||||
|
**File operations:**
|
||||||
|
```javascript
|
||||||
|
import fs from 'fs/promises';
|
||||||
|
const content = await fs.readFile(args.path, 'utf-8');
|
||||||
|
return { content: [{ type: 'text', text: content }] };
|
||||||
|
```
|
||||||
|
|
||||||
|
## Troubleshooting
|
||||||
|
|
||||||
|
- **Extension not appearing**: Check Claude Desktop logs for connection errors
|
||||||
|
- **Tool failures**: Ensure proper error handling and valid return formats
|
||||||
|
- **Transport issues**: Verify stdio transport is configured correctly
|
||||||
|
- **Schema validation**: Test input schemas match your tool expectations
|
||||||
|
|
||||||
|
## Resources
|
||||||
|
|
||||||
|
- DXT Documentation: https://github.com/anthropics/dxt
|
||||||
|
- MCP SDK: https://github.com/modelcontextprotocol
|
||||||
|
- Examples: https://github.com/anthropics/dxt/tree/main/examples
|
||||||
45
plugin.lock.json
Normal file
45
plugin.lock.json
Normal file
@@ -0,0 +1,45 @@
|
|||||||
|
{
|
||||||
|
"$schema": "internal://schemas/plugin.lock.v1.json",
|
||||||
|
"pluginId": "gh:claudeforge/marketplace:plugins/commands/desktop-integrator",
|
||||||
|
"normalized": {
|
||||||
|
"repo": null,
|
||||||
|
"ref": "refs/tags/v20251128.0",
|
||||||
|
"commit": "2383c52297c5f33da851cdaa5e73d3339f6ba1b5",
|
||||||
|
"treeHash": "246f7c4a61654ab988724532698c254e57aabbbf99cef2a6772c9d0c3009af0b",
|
||||||
|
"generatedAt": "2025-11-28T10:15:28.885659Z",
|
||||||
|
"toolVersion": "publish_plugins.py@0.2.0"
|
||||||
|
},
|
||||||
|
"origin": {
|
||||||
|
"remote": "git@github.com:zhongweili/42plugin-data.git",
|
||||||
|
"branch": "master",
|
||||||
|
"commit": "aa1497ed0949fd50e99e70d6324a29c5b34f9390",
|
||||||
|
"repoRoot": "/Users/zhongweili/projects/openmind/42plugin-data"
|
||||||
|
},
|
||||||
|
"manifest": {
|
||||||
|
"name": "desktop-integrator",
|
||||||
|
"description": "This command provides the context necessary for Claude Code to create the Desktop Extension or .dxt file of an MCP.",
|
||||||
|
"version": "1.0.0"
|
||||||
|
},
|
||||||
|
"content": {
|
||||||
|
"files": [
|
||||||
|
{
|
||||||
|
"path": "README.md",
|
||||||
|
"sha256": "15cbdbe9215ff4077f6d1b03a7ed237f2c78ab72cd5cdeda2d5bf016ecfff338"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": ".claude-plugin/plugin.json",
|
||||||
|
"sha256": "04264fb9c492108914e84e420e03438db371b6c26a81e94cab34f053511d34d6"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": "commands/claude-desktop-extension.md",
|
||||||
|
"sha256": "e98dc77f9adf2e57bda1d3a4765212020dfb15351d439acb9b6c0537615425be"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"dirSha256": "246f7c4a61654ab988724532698c254e57aabbbf99cef2a6772c9d0c3009af0b"
|
||||||
|
},
|
||||||
|
"security": {
|
||||||
|
"scannedAt": null,
|
||||||
|
"scannerVersion": null,
|
||||||
|
"flags": []
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user