3.4 KiB
Contributing Guide
Thank you for your interest in contributing to this MCP server!
Getting Started
Prerequisites
- Node.js 18+
- npm 9+
- Git
Development Setup
-
Fork and clone the repository
git clone https://github.com/YOUR_USERNAME/Israel-law-mcp.git cd Israel-law-mcp -
Install dependencies
npm install -
Build the project
npm run build -
Run tests
npm test
Development Workflow
Making Changes
-
Create a branch for your changes:
git checkout -b feature/your-feature-name -
Make your changes
-
Run tests:
npm test -
Build to check for TypeScript errors:
npm run build -
Commit your changes:
git commit -m "Description of changes" -
Push and create a pull request
Testing with MCP Inspector
To test your changes interactively:
npx @anthropic/mcp-inspector node dist/index.js
This opens a web UI where you can call tools and see responses.
Code Style
TypeScript
- Use TypeScript strict mode
- Define interfaces for all function inputs/outputs
- Use async/await for all database operations
- Use
nullfor "not found", throw for invalid input
Naming
- Files:
kebab-case.ts - Interfaces:
PascalCase - Functions:
camelCase - MCP tools:
snake_case - Database tables/columns:
snake_case
Documentation
- Add JSDoc comments to all exported functions
- Include
@paramand@returnstags - Add usage examples in comments
Adding a New Tool
-
Create a new file in
src/tools/:// src/tools/my-tool.ts export interface MyToolInput { ... } export interface MyToolResult { ... } export async function myTool(db: Database, input: MyToolInput): Promise<MyToolResult> { ... } -
Add tests in
tests/tools/my-tool.test.ts -
Register the tool in
src/index.ts:- Add to
TOOLSarray - Add case in
CallToolRequestSchemahandler
- Add to
-
Update README.md with tool documentation
Adding New Data
Adding a New Source
-
Create a seed file in
data/seed/:{ "id": "SOURCE_ID", "full_name": "Full Name", "items": [ ... ], "definitions": [ ... ] } -
Rebuild the database:
npm run build:db -
Add tests for the new data
-
Update COVERAGE.md
Updating Existing Data
-
Run the ingestion script:
npm run ingest -- <identifier> data/seed/source.json -
Rebuild the database:
npm run build:db -
Run tests to verify nothing broke:
npm test
Pull Request Guidelines
Before Submitting
- Tests pass (
npm test) - Build succeeds (
npm run build) - No TypeScript errors
- Documentation updated if needed
PR Description
Include:
- What changes were made
- Why the changes were needed
- How to test the changes
Review Process
- Automated checks must pass
- At least one maintainer review required
- Address feedback promptly
Reporting Issues
Bug Reports
Include:
- Steps to reproduce
- Expected behavior
- Actual behavior
- Environment (Node version, OS)
Feature Requests
Include:
- Use case description
- Proposed solution (if any)
- Alternatives considered
Questions?
Open a discussion on GitHub or reach out to the maintainers.
Thank you for contributing!