feat(filesystem): add Resources and Prompts#4093
Open
mesutoezdil wants to merge 1 commit intomodelcontextprotocol:mainfrom
Open
feat(filesystem): add Resources and Prompts#4093mesutoezdil wants to merge 1 commit intomodelcontextprotocol:mainfrom
mesutoezdil wants to merge 1 commit intomodelcontextprotocol:mainfrom
Conversation
7a2963d to
afca10f
Compare
51e717f to
f583c0c
Compare
1fde38d to
f862bbd
Compare
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.
Description
This PR adds Resources and Prompts to the filesystem reference server, which previously exposed only Tools. Per CONTRIBUTING.md, demonstrating underutilized protocol features (Resources, Prompts, Roots) on existing reference servers is explicitly encouraged. The filesystem server is also called out by name in CONTRIBUTING.md as a good vehicle for showcasing these features.
Server Details
What is added
Resources
filesystem://allowed-directories(static) — exposes the live set of allowed directories. The content reflects whether directories were set via command-line arguments or updated dynamically through MCP Roots.file://{path}(template) — reads a file within the allowed directories and returns its contents as a resource. The path is validated against the allowed-directories list before the read, so the existing security boundary is preserved.Prompts
read-file— a simple prompt that asks the model to read and summarize a file at a given absolute path.Motivation and Context
allowed-directoriesas a Resource is a natural fit: clients can subscribe to it and get a live, structured view of what the server can see, rather than calling a tool every time they want to check.file://{path}as a template lets clients reference files declaratively in conversation context, which is what Resources are designed for, complementing the existingread_text_filetool rather than duplicating it.read-filePrompt demonstrates the simplest useful prompt pattern: argument-driven, references a path, and pairs naturally with the tools and resources above.How Has This Been Tested?
npm run build— cleannpm test— 151 tests passresources/listreturns the static resourceresources/templates/listreturns the file templateresources/readonfilesystem://allowed-directoriesreturns the configured directoryprompts/listreturnsread-filetools,resources, andpromptscapabilities, and responds correctly totools/list,resources/list,prompts/list, andresources/read.Breaking Changes
None. This is a purely additive change.
Types of changes
Checklist