Skip to content

Commit 32fcfff

Browse files
committed
Update to use new SDK version
1 parent 9640ccc commit 32fcfff

File tree

3 files changed

+29
-31
lines changed

3 files changed

+29
-31
lines changed

Diff for: go.mod

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ module github.com/mark3labs/mcp-filesystem-server
22

33
go 1.23.2
44

5-
require github.com/mark3labs/mcp-go v0.3.0
5+
require github.com/mark3labs/mcp-go v0.4.0
66

77
require (
88
github.com/aymanbagabas/go-osc52/v2 v2.0.1 // indirect

Diff for: go.sum

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
1212
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
1313
github.com/lucasb-eyer/go-colorful v1.2.0 h1:1nnpGOrhyZZuNyfu1QjKiUICQ74+3FNCN69Aj6K7nkY=
1414
github.com/lucasb-eyer/go-colorful v1.2.0/go.mod h1:R4dSotOR9KMtayYi1e77YzuveK+i7ruzyGqttikkLy0=
15-
github.com/mark3labs/mcp-go v0.3.0 h1:IbNgBkS2mv3/a0QHRJe4sVHckNSEQCPfpcaypiVWwRk=
16-
github.com/mark3labs/mcp-go v0.3.0/go.mod h1:ePkDSyplFbA306xRgyp587+q/vpdgxuswwjZqTQ+I8Q=
15+
github.com/mark3labs/mcp-go v0.4.0 h1:9KtOqp4Ufn4myTN8K2UPY3x6TczebHOSdF+KD4Q7+TE=
16+
github.com/mark3labs/mcp-go v0.4.0/go.mod h1:ePkDSyplFbA306xRgyp587+q/vpdgxuswwjZqTQ+I8Q=
1717
github.com/mattn/go-isatty v0.0.18 h1:DOKFKCQ7FNG2L1rbrmstDN4QVRdS89Nkh85u68Uwp98=
1818
github.com/mattn/go-isatty v0.0.18/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
1919
github.com/mattn/go-runewidth v0.0.12/go.mod h1:RAqKPSqVFrSLVXbA8x7dzmKdmGzieGRCM46jaSJTDAk=

Diff for: main.go

+26-28
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ func (s *FilesystemServer) handleListTools(
186186
"the contents of a single file. Only works within allowed directories.",
187187
InputSchema: mcp.ToolInputSchema{
188188
Type: "object",
189-
Properties: map[string]interface{}{
189+
Properties: mcp.ToolInputSchemaProperties{
190190
"path": map[string]interface{}{
191191
"type": "string",
192192
"description": "Path to the file to read",
@@ -201,7 +201,7 @@ func (s *FilesystemServer) handleListTools(
201201
"or compare multiple files.",
202202
InputSchema: mcp.ToolInputSchema{
203203
Type: "object",
204-
Properties: map[string]interface{}{
204+
Properties: mcp.ToolInputSchemaProperties{
205205
"paths": map[string]interface{}{
206206
"type": "array",
207207
"items": map[string]interface{}{
@@ -218,7 +218,7 @@ func (s *FilesystemServer) handleListTools(
218218
"Use with caution as it will overwrite existing files without warning.",
219219
InputSchema: mcp.ToolInputSchema{
220220
Type: "object",
221-
Properties: map[string]interface{}{
221+
Properties: mcp.ToolInputSchemaProperties{
222222
"path": map[string]interface{}{
223223
"type": "string",
224224
"description": "Path where to write the file",
@@ -236,7 +236,7 @@ func (s *FilesystemServer) handleListTools(
236236
"Can create multiple nested directories in one operation.",
237237
InputSchema: mcp.ToolInputSchema{
238238
Type: "object",
239-
Properties: map[string]interface{}{
239+
Properties: mcp.ToolInputSchemaProperties{
240240
"path": map[string]interface{}{
241241
"type": "string",
242242
"description": "Path of the directory to create",
@@ -250,7 +250,7 @@ func (s *FilesystemServer) handleListTools(
250250
"Results clearly distinguish between files and directories with [FILE] and [DIR] prefixes.",
251251
InputSchema: mcp.ToolInputSchema{
252252
Type: "object",
253-
Properties: map[string]interface{}{
253+
Properties: mcp.ToolInputSchemaProperties{
254254
"path": map[string]interface{}{
255255
"type": "string",
256256
"description": "Path of the directory to list",
@@ -264,7 +264,7 @@ func (s *FilesystemServer) handleListTools(
264264
"and rename them in a single operation.",
265265
InputSchema: mcp.ToolInputSchema{
266266
Type: "object",
267-
Properties: map[string]interface{}{
267+
Properties: mcp.ToolInputSchemaProperties{
268268
"source": map[string]interface{}{
269269
"type": "string",
270270
"description": "Source path of the file or directory",
@@ -282,7 +282,7 @@ func (s *FilesystemServer) handleListTools(
282282
"Searches through all subdirectories from the starting path.",
283283
InputSchema: mcp.ToolInputSchema{
284284
Type: "object",
285-
Properties: map[string]interface{}{
285+
Properties: mcp.ToolInputSchemaProperties{
286286
"path": map[string]interface{}{
287287
"type": "string",
288288
"description": "Starting path for the search",
@@ -300,7 +300,7 @@ func (s *FilesystemServer) handleListTools(
300300
"creation time, last modified time, permissions, and type.",
301301
InputSchema: mcp.ToolInputSchema{
302302
Type: "object",
303-
Properties: map[string]interface{}{
303+
Properties: mcp.ToolInputSchemaProperties{
304304
"path": map[string]interface{}{
305305
"type": "string",
306306
"description": "Path to the file or directory",
@@ -313,7 +313,7 @@ func (s *FilesystemServer) handleListTools(
313313
Description: "Returns the list of directories that this server is allowed to access.",
314314
InputSchema: mcp.ToolInputSchema{
315315
Type: "object",
316-
Properties: map[string]interface{}{},
316+
Properties: mcp.ToolInputSchemaProperties{},
317317
},
318318
},
319319
},
@@ -333,9 +333,7 @@ func (s *FilesystemServer) handleInitialize(
333333
},
334334
ProtocolVersion: "2024-11-05",
335335
Capabilities: mcp.ServerCapabilities{
336-
Tools: &struct {
337-
ListChanged bool `json:"listChanged"`
338-
}{
336+
Tools: &mcp.ServerCapabilitiesTools{
339337
ListChanged: true,
340338
},
341339
},
@@ -376,7 +374,7 @@ func (s *FilesystemServer) handleToolCall(
376374
content, err := os.ReadFile(validPath)
377375
if err != nil {
378376
return &mcp.CallToolResult{
379-
Content: []mcp.Content{
377+
Content: []interface{}{
380378
mcp.TextContent{
381379
Type: "text",
382380
Text: fmt.Sprintf("Error reading file: %v", err),
@@ -387,7 +385,7 @@ func (s *FilesystemServer) handleToolCall(
387385
}
388386

389387
return &mcp.CallToolResult{
390-
Content: []mcp.Content{
388+
Content: []interface{}{
391389
mcp.TextContent{
392390
Type: "text",
393391
Text: string(content),
@@ -428,7 +426,7 @@ func (s *FilesystemServer) handleToolCall(
428426
}
429427

430428
return &mcp.CallToolResult{
431-
Content: []mcp.Content{
429+
Content: []interface{}{
432430
mcp.TextContent{
433431
Type: "text",
434432
Text: result.String(),
@@ -453,7 +451,7 @@ func (s *FilesystemServer) handleToolCall(
453451

454452
if err := os.WriteFile(validPath, []byte(content), 0644); err != nil {
455453
return &mcp.CallToolResult{
456-
Content: []mcp.Content{
454+
Content: []interface{}{
457455
mcp.TextContent{
458456
Type: "text",
459457
Text: fmt.Sprintf("Error writing file: %v", err),
@@ -464,7 +462,7 @@ func (s *FilesystemServer) handleToolCall(
464462
}
465463

466464
return &mcp.CallToolResult{
467-
Content: []mcp.Content{
465+
Content: []interface{}{
468466
mcp.TextContent{
469467
Type: "text",
470468
Text: fmt.Sprintf("Successfully wrote to %s", path),
@@ -485,7 +483,7 @@ func (s *FilesystemServer) handleToolCall(
485483

486484
if err := os.MkdirAll(validPath, 0755); err != nil {
487485
return &mcp.CallToolResult{
488-
Content: []mcp.Content{
486+
Content: []interface{}{
489487
mcp.TextContent{
490488
Type: "text",
491489
Text: fmt.Sprintf("Error creating directory: %v", err),
@@ -496,7 +494,7 @@ func (s *FilesystemServer) handleToolCall(
496494
}
497495

498496
return &mcp.CallToolResult{
499-
Content: []mcp.Content{
497+
Content: []interface{}{
500498
mcp.TextContent{
501499
Type: "text",
502500
Text: fmt.Sprintf(
@@ -521,7 +519,7 @@ func (s *FilesystemServer) handleToolCall(
521519
entries, err := os.ReadDir(validPath)
522520
if err != nil {
523521
return &mcp.CallToolResult{
524-
Content: []mcp.Content{
522+
Content: []interface{}{
525523
mcp.TextContent{
526524
Type: "text",
527525
Text: fmt.Sprintf("Error reading directory: %v", err),
@@ -541,7 +539,7 @@ func (s *FilesystemServer) handleToolCall(
541539
}
542540

543541
return &mcp.CallToolResult{
544-
Content: []mcp.Content{
542+
Content: []interface{}{
545543
mcp.TextContent{
546544
Type: "text",
547545
Text: result.String(),
@@ -570,7 +568,7 @@ func (s *FilesystemServer) handleToolCall(
570568

571569
if err := os.Rename(validSource, validDest); err != nil {
572570
return &mcp.CallToolResult{
573-
Content: []mcp.Content{
571+
Content: []interface{}{
574572
mcp.TextContent{
575573
Type: "text",
576574
Text: fmt.Sprintf("Error moving file: %v", err),
@@ -581,7 +579,7 @@ func (s *FilesystemServer) handleToolCall(
581579
}
582580

583581
return &mcp.CallToolResult{
584-
Content: []mcp.Content{
582+
Content: []interface{}{
585583
mcp.TextContent{
586584
Type: "text",
587585
Text: fmt.Sprintf(
@@ -611,7 +609,7 @@ func (s *FilesystemServer) handleToolCall(
611609
results, err := s.searchFiles(validPath, pattern)
612610
if err != nil {
613611
return &mcp.CallToolResult{
614-
Content: []mcp.Content{
612+
Content: []interface{}{
615613
mcp.TextContent{
616614
Type: "text",
617615
Text: fmt.Sprintf("Error searching files: %v", err),
@@ -622,7 +620,7 @@ func (s *FilesystemServer) handleToolCall(
622620
}
623621

624622
return &mcp.CallToolResult{
625-
Content: []mcp.Content{
623+
Content: []interface{}{
626624
mcp.TextContent{
627625
Type: "text",
628626
Text: strings.Join(results, "\n"),
@@ -644,7 +642,7 @@ func (s *FilesystemServer) handleToolCall(
644642
info, err := s.getFileStats(validPath)
645643
if err != nil {
646644
return &mcp.CallToolResult{
647-
Content: []mcp.Content{
645+
Content: []interface{}{
648646
mcp.TextContent{
649647
Type: "text",
650648
Text: fmt.Sprintf("Error getting file info: %v", err),
@@ -655,7 +653,7 @@ func (s *FilesystemServer) handleToolCall(
655653
}
656654

657655
return &mcp.CallToolResult{
658-
Content: []mcp.Content{
656+
Content: []interface{}{
659657
mcp.TextContent{
660658
Type: "text",
661659
Text: fmt.Sprintf(
@@ -674,7 +672,7 @@ func (s *FilesystemServer) handleToolCall(
674672

675673
case "list_allowed_directories":
676674
return &mcp.CallToolResult{
677-
Content: []mcp.Content{
675+
Content: []interface{}{
678676
mcp.TextContent{
679677
Type: "text",
680678
Text: fmt.Sprintf(

0 commit comments

Comments
 (0)