Want to do Vibe Coding with AI assistance but tired of being limited to tools like Cursor or Windsurf with additional API costs? Why not leverage the AI assistants you're already paying for, like Claude Desktop, for your development workflow? With this mindset, I developed this MCP Server (or rather, I had Claude help me develop this tool). Once you set up this MCP Server, your AI assistant can automatically search through relevant files in your project, analyze the codebase, and provide intelligent correction suggestions. While you'll still need to handle building and running your project manually and paste error messages back into the conversation, this approach can significantly reduce repetitive copy-paste work for users who are already subscribed to AI services, making the development process much more streamlined.
- Read Files: Securely read source code files with size limits
- Write Files: Create and update files with optional backup
- List Files: Browse directory contents with metadata
- Stream Writing: Efficient handling of large file writes
- Delete Files: Safely delete files with automatic backup
- Rename/Move Files: Rename files or move them between directories
- Partial Write: LLM-optimized feature to update specific file sections without rewriting entire files
- Directory Traversal Protection: Prevents access outside workspace
- File Extension Whitelist: Only allows approved file types
- Path Blacklisting: Blocks access to sensitive directories
- Size Limits: Prevents excessive file operations
- Concurrent Operation Limits: Protects system resources
# Clone the repository
git clone [email protected]/Chakotay-Lee/mcp-source-server
cd mcp-source-server
# Install dependencies
npm install
# Build the project
npm run build
# Run tests
npm test
Add the following configuration to your Claude Desktop config file:
macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
Windows: %APPDATA%\Claude\claude_desktop_config.json
{
"mcpServers": {
"source-code-server": {
"command": "node",
"args": ["/path/to/your/mcp-source-server/dist/index.js"],
"env": {
"MCP_WORKSPACE_DIR": "/path/to/your/workspace"
}
}
}
}
Replace /path/to/your/mcp-source-server
with the actual path to this project, and /path/to/your/workspace
with your desired workspace directory.
read_source_file
- Read file contentwrite_source_file
- Write content to filelist_source_files
- List files in directorystream_write_source_file
- Stream write for large files
delete_source_file
- Delete file with backup optionrename_source_file
- Rename or move file with backuppartial_write_source_file
- Update specific file content (LLM optimized)
get_server_stats
- Get server status and statistics
MCP_WORKSPACE_DIR
: Set the workspace directory (default:./workspace
)
The server includes built-in security configurations:
- Programming:
.js
,.ts
,.jsx
,.tsx
,.py
,.cpp
,.c
,.h
, etc. - Web:
.html
,.css
,.scss
,.json
,.xml
,.yaml
, etc. - Documentation:
.md
,.txt
,.rst
,.adoc
- Templates:
.template
,.example
,.sample
,.config
- No extension:
Dockerfile
,Makefile
,.gitignore
, etc.
..
- Directory traversal prevention.git/
- Git repository filesnode_modules/
- Dependencies directory.env.
- Environment files (except templates)secrets/
- Secrets directory- System files (
.DS_Store
,Thumbs.db
)
// Read a file
await callTool('read_source_file', { filePath: 'src/index.js' });
// Write a file
await callTool('write_source_file', {
filePath: 'src/new-file.js',
content: 'console.log("Hello World");',
createBackup: true
});
// List files
await callTool('list_source_files', { dirPath: 'src' });
// Delete a file (with backup)
await callTool('delete_source_file', {
filePath: 'old-file.js',
createBackup: true
});
// Rename/move a file
await callTool('rename_source_file', {
oldPath: 'old-name.js',
newPath: 'src/new-name.js',
createBackup: true
});
// LLM-optimized partial update
await callTool('partial_write_source_file', {
filePath: 'utils.js',
oldContent: 'function oldFunction() { return "old"; }',
newContent: 'function newFunction() { return "updated"; }'
});
β
.gitignore
, .env.template
, Dockerfile
, Makefile
, package.json
, tsconfig.json
π .env
, .env.local
, .env.production
, .git/config
, node_modules/
, secrets/
# Run all tests
npm test
# Run specific test
npm test -- --testNamePattern="should allow development configuration files"
# Run with coverage
npm run test:coverage
The server automatically creates backups in the .backups
directory with timestamps:
- Format:
filename.timestamp.backup
- Location:
workspace/.backups/
- Automatic cleanup recommended
- Concurrent Operation Limits: Prevents system overload
- File Size Limits: Default 10MB per file
- LLM Optimization: Partial write reduces file I/O for small changes
- Stream Processing: Efficient handling of large files
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests for new functionality
- Ensure all tests pass
- Submit a pull request
[Your License Here]
- β¨ Added file deletion functionality
- β¨ Added file rename/move functionality
- β¨ Added LLM-optimized partial write functionality
- π§ Fixed .env.template file access
- π§ Enhanced security with precise pattern matching
- π§ͺ Comprehensive test suite (21 tests)
- π Initial release with basic file operations
- π Security features and path validation
- π MCP protocol implementation