Thank you for your interest in contributing! This document provides guidelines for contributing to the project.
- Fork and Clone
git clone https://github.com/alisaitteke/npm-mcp.git
cd npm-mcp- Install Dependencies
npm install- Build
npm run build- Run Tests
npm testfeature/- New featuresfix/- Bug fixesdocs/- Documentation updatestest/- Test additions or fixesrefactor/- Code refactoring
Follow conventional commits:
feat: add new search filter
fix: resolve caching issue
docs: update README examples
test: add coverage for quality analysis
refactor: simplify version comparison logic
- Use TypeScript with strict mode
- Follow existing code patterns
- Add JSDoc comments for public APIs
- Keep functions small and focused
- Use descriptive variable names
- Write tests for all new features
- Maintain or improve code coverage
- Test both success and error cases
- Use descriptive test names
it('should handle invalid package names gracefully', async () => {
// Test implementation
});- Create a Feature Branch
git checkout -b feature/my-new-feature- Make Your Changes
- Write code
- Add tests
- Update documentation
- Run Tests
npm test
npm run test:coverage
npm run typecheck- Commit and Push
git add .
git commit -m "feat: add my new feature"
git push origin feature/my-new-feature- Open Pull Request
- Provide clear description
- Link related issues
- Ensure CI passes
src/
├── index.ts # Main server entry point
├── registry-client.ts # NPM API client
├── types.ts # TypeScript type definitions
└── tools/ # MCP tool implementations
├── search-packages.ts
├── package-details.ts
├── security-audit.ts
├── version-compatibility.ts
├── quality-analysis.ts
└── npx-command.ts
- Create Tool File
// src/tools/my-tool.ts
import { z } from 'zod';
import { RegistryClient } from '../registry-client.js';
export const MyToolSchema = z.object({
param: z.string(),
});
export async function myTool(
params: z.infer<typeof MyToolSchema>,
client: RegistryClient
): Promise<string> {
const validated = MyToolSchema.parse(params);
// Implementation
return JSON.stringify({ success: true });
}- Register in Server
// src/index.ts
import { myTool } from './tools/my-tool.js';
// Add to tools list in ListToolsRequestSchema handler
// Add to CallToolRequestSchema handler- Add Tests
// test/my-tool.test.ts
describe('My Tool', () => {
it('should work correctly', async () => {
// Test implementation
});
});- Keep PRs focused and small
- Respond to feedback promptly
- Update based on review comments
- Be constructive and respectful
- Focus on code quality and maintainability
- Suggest improvements, don't demand perfection
- Approve when code meets standards
- Update version in
package.json - Update
CHANGELOG.md - Create git tag
- Publish to npm
- Open an issue for bugs
- Start a discussion for questions
- Reach out to maintainers
Thank you for contributing!