Thank you for your interest in contributing! This document provides guidelines and instructions for contributing to this project.
- Node.js ≥ 18
- npm ≥ 9
- Git
-
Fork and clone the repository:
git clone https://github.com/Saml1211/D-Tools-MCP-Server.git cd D-Tools-MCP-Server -
Install dependencies:
npm install
-
Create a
.envfile:cp .env.example .env # Edit .env with your D-Tools API credentials -
Run tests:
npm test -
Build the project:
npm run build
-
Create a feature branch:
git checkout -b feature/my-new-feature
-
Make your changes with appropriate tests
-
Ensure all tests pass:
npm test npm run build -
Run linting:
npm run lint
-
Format code:
npm run format
- Write tests for all new functionality
- Maintain or improve code coverage
- Tests should be in
src/__tests__/directory - Name test files with
.test.tssuffix
Example test structure:
import { describe, it, expect } from 'vitest';
import { myFunction } from '../lib/my-module.js';
describe('My Module', () => {
it('should do something', () => {
const result = myFunction('input');
expect(result).toBe('expected output');
});
});- Use TypeScript strict mode
- Follow existing code patterns
- Add JSDoc comments for public APIs
- Use meaningful variable names
- Keep functions small and focused
Follow conventional commits format:
feat:New featurefix:Bug fixdocs:Documentation changestest:Test changesrefactor:Code refactoringchore:Build/tooling changes
Example:
feat: add project archiving tool
- Add archive_project tool to projects.ts
- Add tests for archive functionality
- Update README with new tool documentation
To add a new MCP tool:
-
Identify the appropriate tool file in
src/tools/ -
Add the tool using
server.tool()— pass a raw-shape object (notz.object()):server.tool( 'my_tool_name', 'One-sentence description shown to LLM clients.', { id: z.string().min(1) }, // raw shape, not z.object({...}) // @ts-ignore -- SDK v1.27 + TS 5.9 overload resolution; runtime is correct async ({ id }) => { try { const result = await client.myApiMethod(id); return { content: [{ type: 'text', text: JSON.stringify(result) }], }; } catch (err: any) { logger.error({ err }, 'Tool execution failed'); return { content: [{ type: 'text', text: `Error: ${err.message || String(err)}` }], }; } } );
-
Add tests in
src/__tests__/ -
Update README.md documentation
-
Update CHANGELOG.md
When reporting issues, please include:
- Node.js version
- npm version
- Error message or stack trace
- Steps to reproduce
- Expected vs actual behavior
For security vulnerabilities, please email directly rather than opening a public issue.
By contributing, you agree that your contributions will be licensed under the MIT License.