Add comprehensive file operations tool to MCP everything server and new test files#3338
Closed
hamzaMissewi wants to merge 2 commits intomodelcontextprotocol:mainfrom
Closed
Add comprehensive file operations tool to MCP everything server and new test files#3338hamzaMissewi wants to merge 2 commits intomodelcontextprotocol:mainfrom
hamzaMissewi wants to merge 2 commits intomodelcontextprotocol:mainfrom
Conversation
- New file-operations.ts tool with read, write, delete, list, create-dir operations - Comprehensive error handling with proper MCP annotations - Added complete test suite with 15 test cases covering all operations - Updated tools/index.ts to register new tool - Enhanced server capabilities with production-ready file operations Features: - Input validation with Zod schemas - Security annotations for different audiences (user/assistant) - Proper error handling and edge case coverage - Modern async/await with fs/promises - MCP-compliant response formatting This addresses the missing file operations capability in the everything server and provides a foundation for more advanced file management features.
### **Changes Made:** **New Tool ([file-operations.ts](cci:7://file:///f:/projects/contribution-forks/mcp-servers/src/everything/tools/file-operations.ts:0:0-0:0)):** - Read, write, delete, list, create-dir operations - Comprehensive error handling with proper annotations - Input validation and security checks - MCP-compliant response formatting **Enhanced Test Coverage:** - Added [file-operations.test.ts](cci:7://file:///f:/projects/contribution-forks/mcp-servers/src/everything/__tests__/file-operations.test.ts:0:0-0:0) with 15 test cases - Covers all operations, error scenarios, and input validation - Mocked file system operations for isolated testing **Integration:** - Updated [tools/index.ts](cci:7://file:///f:/projects/contribution-forks/mcp-servers/src/everything/tools/index.ts:0:0-0:0) to register new tool - Tool available as `file-operations` in MCP server ### **Benefits:** 1. **Enhanced Functionality** - Provides missing file operations capability 2. **Production Ready** - Proper error handling and validation 3. **Well Tested** - Comprehensive test coverage for reliability 4. **MCP Compliant** - Follows protocol standards with annotations 5. **Security Focused** - Input validation and safe operations ### **Technical Details:** - Uses modern `fs/promises` with proper async/await - Implements Zod schema validation - Provides audience-specific annotations (user/assistant) - Handles edge cases like empty paths and permission errors
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Features:
This addresses the missing file operations capability in the everything server and provides a foundation for more advanced file management features.
Description
Publishing Your Server
Note: We are no longer accepting PRs to add servers to the README. Instead, please publish your server to the MCP Server Registry to make it discoverable to the MCP ecosystem.
To publish your server, follow the quickstart guide. You can browse published servers at https://registry.modelcontextprotocol.io/.
Server Details
Motivation and Context
How Has This Been Tested?
Breaking Changes
Types of changes
Checklist
Additional context