The Filesystem MCP Server is a Model Context Protocol (MCP) server built using the mcp-framework
. It provides a robust foundation for developing and deploying custom tools with Server-Sent Events (SSE) capabilities. This server is designed to integrate seamlessly with the Claude Desktop client, enabling users to extend its functionality with custom tools and workflows.
To get started with the Filesystem MCP Server, follow these steps:
# Install dependencies
npm install
# Build the project
npm run build
The project is organized as follows:
filesystem/
├── src/
│ ├── tools/ # MCP Tools
│ │ └── ExampleTool.ts
│ └── index.ts # Server entry point
├── package.json
└── tsconfig.json
The project includes an example tool in src/tools/ExampleTool.ts
. You can add more tools using the CLI:
# Add a new tool
mcp add tool my-tool
# Example tools you might create:
mcp add tool data-processor
mcp add tool api-client
mcp add tool file-handler
Here’s an example of how to structure a custom tool:
import { MCPTool } from "mcp-framework";
import { z } from "zod";
interface MyToolInput {
message: string;
}
class MyTool extends MCPTool<MyToolInput> {
name = "my_tool";
description = "Describes what your tool does";
schema = {
message: {
type: z.string(),
description: "Description of this input parameter",
},
};
async execute(input: MyToolInput) {
// Your tool logic here
return `Processed: ${input.message}`;
}
}
export default MyTool;
To publish your server as an npm package:
package.json
:name
is unique and follows npm naming conventions.version
.description
, author
, license
, etc.Check bin
points to the correct entry file.
Build and test locally:
shell
npm run build
npm link
filesystem # Test your CLI locally
Login to npm (create account if necessary):
shell
npm login
Publish your package:
shell
npm publish
Add this configuration to your Claude Desktop config file:
MacOS: ~/Library/Application Support/Claude/claude_desktop_config.json
Windows: %APPDATA%/Claude/claude_desktop_config.json
{
"mcpServers": {
"filesystem": {
"command": "node",
"args":["/absolute/path/to/filesystem/dist/index.js"]
}
}
}
Once published, update your Claude Desktop config file:
{
"mcpServers": {
"filesystem": {
"command": "npx",
"args": ["filesystem"]
}
}
}
To build and test your server:
npm run build
to compile.The Filesystem MCP Server is a versatile tool for extending the capabilities of the Claude Desktop client with custom tools and workflows. It leverages the power of the MCP framework and supports Server-Sent Events (SSE) for real-time communication.