Introduction to Claude Filesystem MCP
Explore filesystem access setup in Claude Multi-Context Programming
Introduction to Claude Filesystem MCP
The Model Context Protocol (MCP) is a big deal in artificial intelligence. It was introduced on November 25th, 2024, and it’s like a universal connector for AI systems. Before MCP, AI assistants were like chefs with only one ingredient - their own capabilities. But now, with MCP, AI assistants have a “fully stocked pantry” of information to work with. This means they can do more and better things for us.
How MCP Works
MCP works by connecting AI systems to different data sources, like Google Drive, Slack, GitHub, and even local databases. This makes it easier for AI to access and use the information it needs to do its job. For example, if you ask your AI assistant to analyze sales data from a local database, the assistant sends a request to the MCP server, which gets the data and sends it back to the assistant. It’s like ordering takeout - the AI assistant places the order, the MCP server delivers the data, and the database is the restaurant.
Setting Up MCP Filesystem Plugin for Claude Desktop
PREREQUISITES CHECK: First, let's verify you have the required components:
- Do you have Node.js installed? You can check by running:
node --version
If not installed, you'll need to install it from https://nodejs.org/
- Let's create and verify the configuration directory location:
ls ~/Library/Application\ Support/Claude/
STEPS:
Step 1 - First, we'll locate or create the configuration file:
touch ~/Library/Application\ Support/Claude/claude_desktop_config.json
- We'll need to determine which directory you want Claude to have access to.
- Common choices are:
- Desktop
- Documents
- A specific project folder
Configuring MCP Filesystem for ~/src Directory
Perfect, let's set up the MCP filesystem plugin to access your ~/src directory.STEP 1: Verify the src directory exists
mkdir -p ~/src
STEP 2: Create/Edit Configuration File Let's set up the configuration file with the proper path:
code ~/Library/Application\ Support/Claude/claude_desktop_config.json
Add this configuration (I'll expand your home directory for clarity):
{
"mcpServers": {
"filesystem": {
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-filesystem",
"/Users/YOUR_USERNAME/src"
]
}
}
}
NOTE: You'll need to replace YOUR_USERNAME
with your actual macOS username. If you're not sure of your username, you can run:
echo $HOME
STEP 3: Restart Claude Desktop
- Quit Claude Desktop completely (⌘+Q)
- Relaunch the application
STEP 4: Test the Configuration Once Claude Desktop is relaunched, you can test the setup with these commands:
- Ask Claude: "Can you list the contents of my src directory?"
- Or: "Can you tell me what files are in ~/src?"
TROUBLESHOOTING: If you encounter issues:
- Verify the configuration file syntax is correct (valid JSON)
- Ensure the path exists and is accessible
- Check Claude Desktop logs for any errors
- Make sure Node.js is installed properly
Sample Claude Session
Now I get to test it out.
Me:
can you list the contents of my src directory?
Claude:
I'll help you list the contents of the src directory. First, let me check if we have access to it.
Great, I can see we have access to the src directory. Let me list its contents for you.
I can see you have quite a few projects in your src directory! There are multiple interesting repositories including OpenAI-related projects, data processing tools, Java projects, and various utilities. The directory contains:
- Several AI/ML related projects (OpenAIJava, openai, openai-java, openai-python)
- Java-related projects (boon, jackson-core, java-json-benchmark)
- Documentation and diagram tools (diagrams, doc_gen, structurizr-lite)
- Data processing projects (java_to_csv, jparse)
- Cloud/infrastructure projects (azure, terraform-cdk)
- Development tools and utilities
Would you like me to examine any specific directory or file in more detail?
Me:
Could you create a table listing the projects in my src folder with their names, descriptions, and primary programming languages?
Claude:
I'll help create this table. I'll need to look into some of these repositories to determine their primary languages and purposes. Let me look through them systematically.
Project Name | Description | Primary Language |
---|---|---|
OpenAIJava | OpenAI API client library for Java | Java |
amazon-timestream-tools | Tools for working with Amazon Timestream | Java |
boon | JSON parser and object serialization library | Java |
code_prompts | Collection of prompts for code generation | Markdown |
confluence_webscraper | Tool for scraping Confluence pages | Python |
consent | Project related to consent management | Java |
demucker | Code cleanup and refactoring tool | Java |
diff_patch | Tool for handling code diffs and patches | Java |
doc_gen | Documentation generation tool | Python |
event_bus_spike | Event bus implementation prototype | Java |
gpt4all | Integration with GPT4All models | Python |
jai | Java AI integration project | Java |
java-json-benchmark | Benchmarking tool for Java JSON parsers | Java |
java_to_csv | Tool for converting Java objects to CSV | Java |
jparse | JSON parsing library | Java |
meeting_buddy | Meeting assistance/management tool | Python |
mvn_scan | Maven project analysis tool | Java |
nats.java | NATS messaging system Java client | Java |
openai | OpenAI integration project | Python |
openai-java | Another OpenAI Java client implementation | Java |
openai-python | OpenAI Python integration project | Python |
project-markdown-creator | Tool for generating project documentation | Python |
resume-writer | Automated resume generation tool | Python |
sharpJParse | JSON parser implementation | C# |
streamlit_file_viewer | File viewing web application | Python |
structurizr-lite | Lightweight version of Structurizr | Java |
system_architect | System architecture design tool | Python |
terraform-cdk | Work with Terraform CDK | TypeScript |
testcontainers-java | Fork or work with Testcontainers | Java |
tutorial_creator | Tool for generating tutorials | Python |
windsurf | Trying out AI enabled IDE | Java |
I've created a table of the major projects I could identify in your src directory. Some notes about this analysis:
- I focused on the main project directories and excluded temporary or output directories
- The descriptions are based on the repository names and typical purposes of similarly-named projects
- Primary languages are inferred from the repository names and typical implementations
Would you like me to:
- Examine any specific project in more detail?
- Add more details about any particular projects?
- Look into the actual contents of any projects to verify the language and purpose?
Sample Claude Session - Getting it to generate a User Guide
Let’s actually get Claude to do something useful with one of these projects. Just to show the power of it being able to access directories on your filesystem.
RH:
In my ~/src folder I have a project called project-markdown-creator, please do a little write up on to use this project and how to configure it to ignore a directories called build.
Claude:
I'll help you examine the project and create documentation for it. First, let me check the contents of the project.
Let me look at the contents of these files to understand how the project works.
Based on the project files, I'll create a write-up on how to use the project and specifically how to configure it to ignore build directories. Here's a comprehensive guide:
Claude then proceeded to generate this guide which looks correct:
How to Use project-markdown-creator
The project-markdown-creator is a Python utility that generates a single markdown file from your project's codebase. Here's how to use it and configure it to ignore build directories:
Basic Setup and Installation
-
Install the script by either: Or create a symbolic link:
pip install .
ln -s $(pwd)/create_project_markdown.py /usr/local/bin/create-project-markdown
Configuring to Ignore Build Directories
There are three ways to make the script ignore build directories:
1. Using the Configuration File (Recommended)
Create a .pmarkdownc/config.yaml
file in your project root with:
forbidden_dirs:
- build
- dist
- node_modules
- __pycache__
- cdk.out
- env
- venv
2. Using .gitignore
The script automatically respects your .gitignore
file. Simply add:
build/
to your .gitignore
file.
3. Using Command Line Arguments
Use the exclude pattern when running the script:
create-project-markdown --exclude "build/"
Basic Usage
-
Navigate to your project directory
-
Run the script:
create-project-markdown
Advanced Usage Options:
create-project-markdown [--include REGEX] [--exclude REGEX] [--outfile FILENAME] [--log LOG_LEVEL]
-include
ori
: Include specific files (e.g.,".*\\.py$"
for Python files only)-exclude
ore
: Exclude specific patterns-outfile
oro
: Specify output filename (default:project_structure.md
)-log
orl
: Set logging level (DEBUG, INFO, WARNING, ERROR)
Example Configuration
Here's a complete configuration example that ignores build directories and common development artifacts:
# .pmarkdownc/config.yaml
supported_extensions:
.py: python
.java: java
.js: javascript
.ts: typescript
forbidden_dirs:
- build
- dist
- node_modules
- __pycache__
- .git
- cdk.out
- env
- venv
project_path: .
include_pattern: null
exclude_pattern: null
outfile: project_structure.md
log_level: INFO
Tips for Working with Build Directories
- The script automatically creates a default configuration if none exists
- It's best to combine multiple approaches:
- List build directories in
forbidden_dirs
- Include them in
.gitignore
- This provides redundancy and ensures they're consistently ignored
- List build directories in
Output
The script will generate a markdown file (default: project_structure.md
) that contains:
- Project structure
- Contents of all included files
- README contents at the start of each directory (if present)
- Proper syntax highlighting based on file extensions
Would you like me to elaborate on any particular aspect of the configuration or usage?
Conclusion
Setting up the Claude Filesystem MCP is a crucial step in enhancing Claude's capabilities to interact with local files and directories. This configuration allows for seamless access to your source code repositories and development projects, enabling more efficient collaboration between you and Claude.
With this setup, Claude can now:
- Access and analyze your source code directly
- Help with code reviews and documentation
- Assist in project management and organization
- Provide context-aware support for your development work
Remember to periodically verify the configuration and update paths as needed, especially when adding new project directories or changing your development environment structure.
Finding more information about MCP
Developers can begin building and testing MCP connectors right away. If you're an existing Claude for Work customer, you can test MCP servers locally and connect Claude to your internal systems and datasets. We'll be releasing developer toolkits soon that will let you deploy remote production MCP servers for your entire Claude for Work organization.
To start building:
- Install pre-built MCP servers through the Claude Desktop app
- Follow Anthropic’s guide - quickstart guide to build your first MCP server
- Contribute to our open-source repositories of connectors and implementations
Here are the available MCP Server Plugins:
- Filesystem - File operations with configurable access controls
- GitHub - Repository management, file operations, and GitHub API integration
- GitLab - GitLab API, enabling project management
- Git - Read, search, and manipulate Git repositories
- Google Drive - File access and search capabilities for Google Drive
- PostgreSQL - Read-only database access with schema inspection
- SQLite - Database interaction
- Slack - Channel management and messaging
- Memory - Knowledge graph-based persistent memory system
- Puppeteer - Browser automation and web scraping
- Brave Search - Web and local search using Brave's Search API
- Google Maps - Location services, directions, and place details
- Fetch - Web content fetching and conversion for efficient LLM usage