feat: Add filesystem as an example (#52)
This commit is contained in:
parent
85de8638db
commit
167a20c9ba
4 changed files with 139 additions and 0 deletions
BIN
examples/file-system-node/icon.png
Normal file
BIN
examples/file-system-node/icon.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 679 B |
97
examples/file-system-node/manifest.json
Normal file
97
examples/file-system-node/manifest.json
Normal file
|
|
@ -0,0 +1,97 @@
|
|||
{
|
||||
"dxt_version": "0.1",
|
||||
"id": "anthropic.demo.filesystem",
|
||||
"name": "Filesystem",
|
||||
"display_name": "Filesystem",
|
||||
"version": "0.1.3",
|
||||
"description": "Let Claude access your filesystem to read and write files.",
|
||||
"long_description": "This extension allows Claude to interact with your local filesystem, enabling it to read and write files directly. This can be useful for tasks such as file management, data processing, and automation of repetitive tasks. The extension provides a set of tools that can be used to navigate directories, read file contents, and write new files or modify existing ones.\n\nUnderneath the hood, it uses @modelcontextprotocol/server-filesystem.",
|
||||
"author": {
|
||||
"name": "Anthropic",
|
||||
"url": "https://www.claude.ai"
|
||||
},
|
||||
"homepage": "https://www.claude.ai",
|
||||
"documentation": "https://support.anthropic.com/en/collections/4078531-claude-ai",
|
||||
"support": "https://support.anthropic.com/en/collections/4078531-claude-ai",
|
||||
"icon": "icon.png",
|
||||
"tools": [
|
||||
{
|
||||
"name": "read_file",
|
||||
"description": "Read the contents of a file"
|
||||
},
|
||||
{
|
||||
"name": "read_multiple_files",
|
||||
"description": "Read the contents of multiple files"
|
||||
},
|
||||
{
|
||||
"name": "write_file",
|
||||
"description": "Write content to a file"
|
||||
},
|
||||
{
|
||||
"name": "edit_file",
|
||||
"description": "Edit the contents of a file"
|
||||
},
|
||||
{
|
||||
"name": "create_directory",
|
||||
"description": "Create a new directory"
|
||||
},
|
||||
{
|
||||
"name": "list_directory",
|
||||
"description": "List contents of a directory"
|
||||
},
|
||||
{
|
||||
"name": "directory_tree",
|
||||
"description": "Display directory structure as a tree"
|
||||
},
|
||||
{
|
||||
"name": "move_file",
|
||||
"description": "Move or rename a file"
|
||||
},
|
||||
{
|
||||
"name": "search_files",
|
||||
"description": "Search for files by name or content"
|
||||
},
|
||||
{
|
||||
"name": "get_file_info",
|
||||
"description": "Get information about a file"
|
||||
},
|
||||
{
|
||||
"name": "list_allowed_directories",
|
||||
"description": "List directories that can be accessed"
|
||||
}
|
||||
],
|
||||
"server": {
|
||||
"type": "node",
|
||||
"entry_point": "server/index.js",
|
||||
"mcp_config": {
|
||||
"command": "node",
|
||||
"args": [
|
||||
"${__dirname}/server/index.js",
|
||||
"${user_config.allowed_directories}"
|
||||
]
|
||||
}
|
||||
},
|
||||
"keywords": [
|
||||
"api",
|
||||
"automation",
|
||||
"productivity"
|
||||
],
|
||||
"license": "MIT",
|
||||
"compatibility": {
|
||||
"claude_desktop": ">=0.10.0",
|
||||
"platforms": ["darwin", "win32", "linux"],
|
||||
"runtimes": {
|
||||
"node": ">=16.0.0"
|
||||
}
|
||||
},
|
||||
"user_config": {
|
||||
"allowed_directories": {
|
||||
"type": "directory",
|
||||
"title": "Allowed Directories",
|
||||
"description": "Select directories the filesystem server can access",
|
||||
"multiple": true,
|
||||
"required": true,
|
||||
"default": []
|
||||
}
|
||||
}
|
||||
}
|
||||
10
examples/file-system-node/package.json
Normal file
10
examples/file-system-node/package.json
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
{
|
||||
"name": "ant.dir.ant.anthropic.filesystem",
|
||||
"version": "0.1.3",
|
||||
"type": "module",
|
||||
"private": true,
|
||||
"main": "server/index.js",
|
||||
"dependencies": {
|
||||
"@modelcontextprotocol/server-filesystem": "2025.1.14"
|
||||
}
|
||||
}
|
||||
32
examples/file-system-node/server/index.js
Normal file
32
examples/file-system-node/server/index.js
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
#!/usr/bin/env node
|
||||
|
||||
/**
|
||||
* Entry point for the Filesystem MCP server extension
|
||||
* This wraps the @modelcontextprotocol/server-filesystem package
|
||||
*/
|
||||
|
||||
// Get allowed directories from command line arguments
|
||||
const args = process.argv.slice(2);
|
||||
|
||||
// Use dynamic require since we need CommonJS compatibility
|
||||
const loadServer = async () => {
|
||||
try {
|
||||
// Save original argv
|
||||
const originalArgv = process.argv;
|
||||
|
||||
// The filesystem server expects directories as command line arguments
|
||||
process.argv = [process.argv[0], process.argv[1], ...args];
|
||||
|
||||
// Dynamically import the ESM module
|
||||
await import('@modelcontextprotocol/server-filesystem/dist/index.js');
|
||||
|
||||
// Restore original argv
|
||||
process.argv = originalArgv;
|
||||
} catch (error) {
|
||||
console.error('Failed to load @modelcontextprotocol/server-filesystem:', error);
|
||||
process.exit(1);
|
||||
}
|
||||
};
|
||||
|
||||
// Execute the async function
|
||||
loadServer();
|
||||
Loading…
Reference in a new issue