Skip to main content
Glama

@profullstack/mcp-server

by profullstack
node_modules_fix.md3.77 kB
# Node Modules Fix Documentation ## Problem The `node_modules` directories in `mcp_modules/` subdirectories were being committed to git and potentially published to npm when packages were published. This caused several issues: 1. **Repository bloat**: Large `node_modules` directories were being tracked by git 2. **Publishing issues**: npm packages were including unnecessary dependencies 3. **Storage waste**: Redundant files in version control and published packages ## Solution Implemented ### 1. Updated `.gitignore` Enhanced the main `.gitignore` file to properly ignore `node_modules` and related files in all `mcp_modules/` subdirectories: ```gitignore # MCP modules dependencies and build artifacts mcp_modules/*/node_modules/ mcp_modules/*/pnpm-lock.yaml mcp_modules/*/package-lock.json mcp_modules/*/yarn.lock mcp_modules/*/dist/ mcp_modules/*/build/ mcp_modules/*/.nyc_output/ mcp_modules/*/coverage/ ``` ### 2. Created `.npmignore` Files Added comprehensive `.npmignore` files to all mcp_modules projects that include: - `node_modules/` - Dependencies - Lock files (`pnpm-lock.yaml`, `package-lock.json`, `yarn.lock`) - Build outputs (`dist/`, `build/`, `.output/`) - Testing artifacts (`coverage/`, `.nyc_output/`, `test-db.js`) - Development files (ESLint configs, Mocha configs) - Environment files (`.env`, `.env.*`) - IDE and OS files (`.vscode/`, `.DS_Store`, etc.) - Temporary files (`*.tmp`, `*.temp`, etc.) ### 3. Cleaned Up Existing Files - Removed all existing `node_modules` directories from the filesystem - Ensured no `node_modules` files are tracked by git ### 4. Created Maintenance Script Created [`scripts/fix-npmignore.js`](../scripts/fix-npmignore.js) for future maintenance: ```bash node scripts/fix-npmignore.js ``` This script automatically creates `.npmignore` files for any new mcp_modules that don't have them. ## Verification The fix was verified by: 1. Installing dependencies in a test module (`mcp_modules/backlinks`) 2. Confirming that `node_modules` directory was created but ignored by git 3. Confirming that only legitimate files (like `pnpm-lock.yaml`) were tracked 4. Running all tests to ensure no functionality was broken ## Future Maintenance ### For New MCP Modules When creating new modules in `mcp_modules/`: 1. Run the maintenance script: `node scripts/fix-npmignore.js` 2. Or manually create a `.npmignore` file using the template from any existing module ### For Existing Modules If you notice `node_modules` being tracked in git: 1. Run: `git rm -r --cached mcp_modules/*/node_modules` (if any are tracked) 2. Run: `node scripts/fix-npmignore.js` to ensure all modules have `.npmignore` 3. Commit the changes ### Publishing Packages When publishing any mcp_modules to npm: 1. Verify the `.npmignore` file exists and is comprehensive 2. Use `npm pack --dry-run` to preview what files will be included 3. Ensure `node_modules/` is not in the package contents ## Files Modified/Created ### Modified - [`.gitignore`](../.gitignore) - Enhanced to ignore mcp_modules dependencies ### Created - [`scripts/fix-npmignore.js`](../scripts/fix-npmignore.js) - Maintenance script - 18 `.npmignore` files in various `mcp_modules/` subdirectories - This documentation file ## Benefits 1. **Reduced repository size**: No more `node_modules` in git history 2. **Cleaner npm packages**: Published packages only include necessary files 3. **Better performance**: Faster git operations and npm installs 4. **Automated maintenance**: Script ensures consistency across all modules 5. **Future-proof**: Pattern works for any new modules added ## Testing All existing tests continue to pass, confirming that the changes don't break any functionality while solving the `node_modules` tracking issue.

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/profullstack/mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server