Files
israel-law-mcp/CONTRIBUTING.md
2026-02-20 20:56:34 +01:00

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

  1. Fork and clone the repository

    git clone https://github.com/YOUR_USERNAME/Israel-law-mcp.git
    cd Israel-law-mcp
    
  2. Install dependencies

    npm install
    
  3. Build the project

    npm run build
    
  4. Run tests

    npm test
    

Development Workflow

Making Changes

  1. Create a branch for your changes:

    git checkout -b feature/your-feature-name
    
  2. Make your changes

  3. Run tests:

    npm test
    
  4. Build to check for TypeScript errors:

    npm run build
    
  5. Commit your changes:

    git commit -m "Description of changes"
    
  6. 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 null for "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 @param and @returns tags
  • Add usage examples in comments

Adding a New Tool

  1. 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> { ... }
    
  2. Add tests in tests/tools/my-tool.test.ts

  3. Register the tool in src/index.ts:

    • Add to TOOLS array
    • Add case in CallToolRequestSchema handler
  4. Update README.md with tool documentation

Adding New Data

Adding a New Source

  1. Create a seed file in data/seed/:

    {
      "id": "SOURCE_ID",
      "full_name": "Full Name",
      "items": [ ... ],
      "definitions": [ ... ]
    }
    
  2. Rebuild the database:

    npm run build:db
    
  3. Add tests for the new data

  4. Update COVERAGE.md

Updating Existing Data

  1. Run the ingestion script:

    npm run ingest -- <identifier> data/seed/source.json
    
  2. Rebuild the database:

    npm run build:db
    
  3. 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

  1. Automated checks must pass
  2. At least one maintainer review required
  3. 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!