@ansvar/ch-livestock-mcp 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (113) hide show
  1. package/.github/workflows/check-freshness.yml +52 -0
  2. package/.github/workflows/ci.yml +21 -0
  3. package/.github/workflows/codeql.yml +31 -0
  4. package/.github/workflows/ghcr-build.yml +45 -0
  5. package/.github/workflows/gitleaks.yml +23 -0
  6. package/.github/workflows/ingest.yml +58 -0
  7. package/.github/workflows/publish.yml +24 -0
  8. package/CHANGELOG.md +24 -0
  9. package/CODEOWNERS +1 -0
  10. package/COVERAGE.md +62 -0
  11. package/DISCLAIMER.md +41 -0
  12. package/Dockerfile +26 -0
  13. package/LICENSE +17 -0
  14. package/PRIVACY.md +28 -0
  15. package/README.md +145 -0
  16. package/SECURITY.md +33 -0
  17. package/TOOLS.md +261 -0
  18. package/data/coverage.json +23 -0
  19. package/data/database.db +0 -0
  20. package/data/sources.yml +29 -0
  21. package/dist/db.d.ts +26 -0
  22. package/dist/db.d.ts.map +1 -0
  23. package/dist/db.js +220 -0
  24. package/dist/db.js.map +1 -0
  25. package/dist/http-server.d.ts +2 -0
  26. package/dist/http-server.d.ts.map +1 -0
  27. package/dist/http-server.js +294 -0
  28. package/dist/http-server.js.map +1 -0
  29. package/dist/jurisdiction.d.ts +18 -0
  30. package/dist/jurisdiction.d.ts.map +1 -0
  31. package/dist/jurisdiction.js +16 -0
  32. package/dist/jurisdiction.js.map +1 -0
  33. package/dist/metadata.d.ts +10 -0
  34. package/dist/metadata.d.ts.map +1 -0
  35. package/dist/metadata.js +21 -0
  36. package/dist/metadata.js.map +1 -0
  37. package/dist/server.d.ts +3 -0
  38. package/dist/server.d.ts.map +1 -0
  39. package/dist/server.js +240 -0
  40. package/dist/server.js.map +1 -0
  41. package/dist/tools/about.d.ts +15 -0
  42. package/dist/tools/about.d.ts.map +1 -0
  43. package/dist/tools/about.js +27 -0
  44. package/dist/tools/about.js.map +1 -0
  45. package/dist/tools/check-freshness.d.ts +15 -0
  46. package/dist/tools/check-freshness.d.ts.map +1 -0
  47. package/dist/tools/check-freshness.js +26 -0
  48. package/dist/tools/check-freshness.js.map +1 -0
  49. package/dist/tools/get-breeding-guidance.d.ts +37 -0
  50. package/dist/tools/get-breeding-guidance.d.ts.map +1 -0
  51. package/dist/tools/get-breeding-guidance.js +39 -0
  52. package/dist/tools/get-breeding-guidance.js.map +1 -0
  53. package/dist/tools/get-feed-requirements.d.ts +40 -0
  54. package/dist/tools/get-feed-requirements.d.ts.map +1 -0
  55. package/dist/tools/get-feed-requirements.js +35 -0
  56. package/dist/tools/get-feed-requirements.js.map +1 -0
  57. package/dist/tools/get-housing-requirements.d.ts +39 -0
  58. package/dist/tools/get-housing-requirements.d.ts.map +1 -0
  59. package/dist/tools/get-housing-requirements.js +35 -0
  60. package/dist/tools/get-housing-requirements.js.map +1 -0
  61. package/dist/tools/get-movement-rules.d.ts +36 -0
  62. package/dist/tools/get-movement-rules.d.ts.map +1 -0
  63. package/dist/tools/get-movement-rules.js +31 -0
  64. package/dist/tools/get-movement-rules.js.map +1 -0
  65. package/dist/tools/get-stocking-density.d.ts +37 -0
  66. package/dist/tools/get-stocking-density.d.ts.map +1 -0
  67. package/dist/tools/get-stocking-density.js +35 -0
  68. package/dist/tools/get-stocking-density.js.map +1 -0
  69. package/dist/tools/get-welfare-standards.d.ts +38 -0
  70. package/dist/tools/get-welfare-standards.d.ts.map +1 -0
  71. package/dist/tools/get-welfare-standards.js +32 -0
  72. package/dist/tools/get-welfare-standards.js.map +1 -0
  73. package/dist/tools/list-sources.d.ts +18 -0
  74. package/dist/tools/list-sources.d.ts.map +1 -0
  75. package/dist/tools/list-sources.js +51 -0
  76. package/dist/tools/list-sources.js.map +1 -0
  77. package/dist/tools/search-animal-health.d.ts +28 -0
  78. package/dist/tools/search-animal-health.d.ts.map +1 -0
  79. package/dist/tools/search-animal-health.js +33 -0
  80. package/dist/tools/search-animal-health.js.map +1 -0
  81. package/dist/tools/search-livestock-guidance.d.ts +27 -0
  82. package/dist/tools/search-livestock-guidance.d.ts.map +1 -0
  83. package/dist/tools/search-livestock-guidance.js +25 -0
  84. package/dist/tools/search-livestock-guidance.js.map +1 -0
  85. package/docker-compose.yml +12 -0
  86. package/eslint.config.js +27 -0
  87. package/package.json +54 -0
  88. package/scripts/ingest.ts +553 -0
  89. package/server.json +10 -0
  90. package/src/db.ts +268 -0
  91. package/src/http-server.ts +327 -0
  92. package/src/jurisdiction.ts +30 -0
  93. package/src/metadata.ts +31 -0
  94. package/src/server.ts +264 -0
  95. package/src/tools/about.ts +28 -0
  96. package/src/tools/check-freshness.ts +42 -0
  97. package/src/tools/get-breeding-guidance.ts +53 -0
  98. package/src/tools/get-feed-requirements.ts +53 -0
  99. package/src/tools/get-housing-requirements.ts +52 -0
  100. package/src/tools/get-movement-rules.ts +45 -0
  101. package/src/tools/get-stocking-density.ts +52 -0
  102. package/src/tools/get-welfare-standards.ts +47 -0
  103. package/src/tools/list-sources.ts +65 -0
  104. package/src/tools/search-animal-health.ts +48 -0
  105. package/src/tools/search-livestock-guidance.ts +33 -0
  106. package/tests/db.test.ts +96 -0
  107. package/tests/helpers/seed-db.ts +97 -0
  108. package/tests/jurisdiction.test.ts +41 -0
  109. package/tests/tools/about.test.ts +32 -0
  110. package/tests/tools/check-freshness.test.ts +55 -0
  111. package/tests/tools/list-sources.test.ts +56 -0
  112. package/tests/tools/search-livestock-guidance.test.ts +63 -0
  113. package/tsconfig.json +19 -0
@@ -0,0 +1,52 @@
1
+ name: Check Data Freshness
2
+
3
+ on:
4
+ schedule:
5
+ - cron: '0 8 * * *' # Daily at 08:00 UTC
6
+ workflow_dispatch:
7
+
8
+ permissions:
9
+ contents: read
10
+ issues: write
11
+
12
+ jobs:
13
+ freshness:
14
+ runs-on: ubuntu-latest
15
+ steps:
16
+ - uses: actions/checkout@v4
17
+ - uses: actions/setup-node@v4
18
+ with:
19
+ node-version: '20'
20
+ cache: npm
21
+ - run: npm ci
22
+
23
+ - name: Check freshness
24
+ id: freshness
25
+ run: |
26
+ npm run freshness:check 2>&1 | tee freshness-output.txt
27
+ if grep -q '"status":"stale"' freshness-output.txt 2>/dev/null || grep -q '"status": "stale"' freshness-output.txt 2>/dev/null; then
28
+ echo "stale=true" >> "$GITHUB_OUTPUT"
29
+ else
30
+ echo "stale=false" >> "$GITHUB_OUTPUT"
31
+ fi
32
+
33
+ - name: Create staleness issue
34
+ if: steps.freshness.outputs.stale == 'true'
35
+ uses: actions/github-script@v7
36
+ with:
37
+ script: |
38
+ const existing = await github.rest.issues.listForRepo({
39
+ owner: context.repo.owner,
40
+ repo: context.repo.repo,
41
+ labels: 'data-stale',
42
+ state: 'open',
43
+ });
44
+ if (existing.data.length === 0) {
45
+ await github.rest.issues.create({
46
+ owner: context.repo.owner,
47
+ repo: context.repo.repo,
48
+ title: 'Data staleness detected -- ch-livestock-mcp',
49
+ body: 'The data freshness check detected stale data (>90 days since last ingest).\n\nRun `gh workflow run ingest.yml` to refresh.',
50
+ labels: ['data-stale'],
51
+ });
52
+ }
@@ -0,0 +1,21 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches: [main, dev]
6
+ pull_request:
7
+ branches: [main]
8
+
9
+ jobs:
10
+ build:
11
+ runs-on: ubuntu-latest
12
+ steps:
13
+ - uses: actions/checkout@v4
14
+ - uses: actions/setup-node@v4
15
+ with:
16
+ node-version: "20"
17
+ cache: npm
18
+ - run: npm ci
19
+ - run: npm run typecheck
20
+ - run: npm run lint
21
+ - run: npm test
@@ -0,0 +1,31 @@
1
+ name: CodeQL
2
+
3
+ on:
4
+ push:
5
+ branches: [main, dev]
6
+ pull_request:
7
+ branches: [main]
8
+ schedule:
9
+ - cron: '0 6 * * 1'
10
+
11
+ permissions:
12
+ actions: read
13
+ contents: read
14
+ security-events: write
15
+
16
+ jobs:
17
+ analyze:
18
+ runs-on: ubuntu-latest
19
+ strategy:
20
+ fail-fast: false
21
+ matrix:
22
+ language: [javascript-typescript]
23
+ steps:
24
+ - uses: actions/checkout@v4
25
+ - uses: github/codeql-action/init@v3
26
+ with:
27
+ languages: ${{ matrix.language }}
28
+ - uses: github/codeql-action/autobuild@v3
29
+ - uses: github/codeql-action/analyze@v3
30
+ with:
31
+ category: /language:${{ matrix.language }}
@@ -0,0 +1,45 @@
1
+ name: Build and Push to GHCR
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+ workflow_dispatch:
7
+
8
+ concurrency:
9
+ group: build-${{ github.ref }}
10
+ cancel-in-progress: true
11
+
12
+ env:
13
+ REGISTRY: ghcr.io
14
+ IMAGE_NAME: ch-livestock-mcp
15
+
16
+ permissions:
17
+ contents: read
18
+ packages: write
19
+
20
+ jobs:
21
+ build-and-push:
22
+ runs-on: ubuntu-latest
23
+ steps:
24
+ - uses: actions/checkout@v4
25
+ - uses: docker/setup-buildx-action@v3
26
+ - uses: docker/login-action@v3
27
+ with:
28
+ registry: ghcr.io
29
+ username: ${{ github.actor }}
30
+ password: ${{ secrets.GITHUB_TOKEN }}
31
+ - uses: docker/metadata-action@v5
32
+ id: meta
33
+ with:
34
+ images: ${{ env.REGISTRY }}/ansvar-systems/${{ env.IMAGE_NAME }}
35
+ tags: |
36
+ type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', 'main') }}
37
+ type=sha,prefix=sha-,format=short
38
+ - uses: docker/build-push-action@v5
39
+ with:
40
+ context: .
41
+ push: true
42
+ tags: ${{ steps.meta.outputs.tags }}
43
+ platforms: linux/amd64
44
+ cache-from: type=gha
45
+ cache-to: type=gha,mode=max
@@ -0,0 +1,23 @@
1
+ name: Gitleaks
2
+
3
+ on:
4
+ push:
5
+ branches: [main, dev]
6
+ pull_request:
7
+ branches: [main]
8
+
9
+ permissions:
10
+ contents: read
11
+
12
+ jobs:
13
+ scan:
14
+ runs-on: ubuntu-latest
15
+ steps:
16
+ - uses: actions/checkout@v4
17
+ with:
18
+ fetch-depth: 0
19
+ - uses: gitleaks/gitleaks-action@v2
20
+ with:
21
+ args: detect --source . --verbose
22
+ env:
23
+ GITLEAKS_LICENSE: ${{ secrets.GITLEAKS_LICENSE }}
@@ -0,0 +1,58 @@
1
+ name: Ingest Data
2
+
3
+ on:
4
+ schedule:
5
+ - cron: '0 3 1 */3 *' # Quarterly: 1st day, every 3 months, 03:00 UTC
6
+ workflow_dispatch:
7
+ inputs:
8
+ mode:
9
+ description: 'Ingestion mode'
10
+ required: false
11
+ default: 'incremental'
12
+ type: choice
13
+ options:
14
+ - incremental
15
+ - full
16
+ - fetch-only
17
+ - diff-only
18
+
19
+ permissions:
20
+ contents: write
21
+
22
+ jobs:
23
+ ingest:
24
+ runs-on: ubuntu-latest
25
+ steps:
26
+ - uses: actions/checkout@v4
27
+ - uses: actions/setup-node@v4
28
+ with:
29
+ node-version: '20'
30
+ cache: npm
31
+ - run: npm ci
32
+
33
+ - name: Run ingestion
34
+ run: |
35
+ MODE="${{ inputs.mode || 'incremental' }}"
36
+ case "$MODE" in
37
+ full) npm run ingest:full ;;
38
+ fetch-only) npm run ingest:fetch ;;
39
+ diff-only) npm run ingest:diff ;;
40
+ *) npm run ingest ;;
41
+ esac
42
+
43
+ - name: Update coverage.json
44
+ run: npm run coverage:update
45
+
46
+ - name: Check for changes
47
+ id: changes
48
+ run: |
49
+ git diff --quiet data/ && echo "changed=false" >> "$GITHUB_OUTPUT" || echo "changed=true" >> "$GITHUB_OUTPUT"
50
+
51
+ - name: Commit updated data
52
+ if: steps.changes.outputs.changed == 'true'
53
+ run: |
54
+ git config user.name "github-actions[bot]"
55
+ git config user.email "github-actions[bot]@users.noreply.github.com"
56
+ git add data/
57
+ git commit -m "chore: ingest data update $(date -u +%Y-%m-%d)"
58
+ git push
@@ -0,0 +1,24 @@
1
+ name: Publish to npm
2
+
3
+ on:
4
+ release:
5
+ types: [published]
6
+
7
+ permissions:
8
+ contents: read
9
+ id-token: write
10
+
11
+ jobs:
12
+ publish:
13
+ runs-on: ubuntu-latest
14
+ steps:
15
+ - uses: actions/checkout@v4
16
+ - uses: actions/setup-node@v4
17
+ with:
18
+ node-version: "20"
19
+ registry-url: "https://registry.npmjs.org"
20
+ - run: npm ci
21
+ - run: npm run build
22
+ - run: npm publish --provenance --access public
23
+ env:
24
+ NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
package/CHANGELOG.md ADDED
@@ -0,0 +1,24 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [0.1.0] - 2026-04-05
9
+
10
+ ### Added
11
+ - Initial release with 11 tools (3 meta + 8 domain)
12
+ - Welfare standards from TSchV (minimum) and DZV (RAUS/BTS programmes)
13
+ - Stocking density data from TSchV Anhang 1
14
+ - Housing requirement specifications (space, ventilation, flooring, temperature)
15
+ - TVD movement rules (registration, transport, standstill, Soemmerung)
16
+ - Feed requirements with GMF programme data
17
+ - Animal health records (diseases, symptoms, prevention, regulatory status)
18
+ - Swiss breed data from breed associations
19
+ - Tiered FTS5 search with automatic fallback
20
+ - Streamable HTTP transport (Docker) and stdio transport (npx)
21
+ - Bilingual disclaimer (DE/EN)
22
+ - Golden standard documentation (README, TOOLS.md, COVERAGE.md, DISCLAIMER.md)
23
+ - CI/CD: CodeQL, Gitleaks, GHCR build, npm publish, ingestion, freshness checks
24
+ - Test suite with seed database
package/CODEOWNERS ADDED
@@ -0,0 +1 @@
1
+ * @Ansvar-Systems/mcp-team
package/COVERAGE.md ADDED
@@ -0,0 +1,62 @@
1
+ # Data Coverage -- Switzerland Livestock MCP
2
+
3
+ **Jurisdiction:** Switzerland (CH)
4
+ **Last ingest:** 2026-04-05
5
+ **Schema version:** 1.0
6
+
7
+ ## Summary
8
+
9
+ | Table | Records | Description |
10
+ |-------|---------|-------------|
11
+ | welfare_standards | 45 | TSchV minimum + RAUS/BTS programme standards per species |
12
+ | stocking_densities | 25 | Animals per m2 by species, age class, housing type (TSchV Anhang 1) |
13
+ | housing_requirements | 14 | Space, ventilation, flooring, temperature specs |
14
+ | movement_rules | 21 | TVD registration, transport, standstill, Soemmerung, Schlachtung |
15
+ | breeds | 25 | Swiss breed records across 5 species |
16
+ | feed_requirements | 14 | Nutritional requirements per species and production stage |
17
+ | animal_health | 13 | Diseases, symptoms, prevention, regulatory reporting |
18
+ | search_index (FTS) | 157 | Full-text search entries across all categories |
19
+
20
+ **Total:** 157 indexed records, 11 tools
21
+
22
+ ## Species Coverage
23
+
24
+ | Species (DE) | Species (EN) | Welfare | Stocking | Housing | Movement | Breeds | Feed | Health |
25
+ |-------------|-------------|---------|----------|---------|----------|--------|------|--------|
26
+ | Rinder | Cattle | Yes | Yes | Yes | Yes | Yes | Yes | Yes |
27
+ | Schweine | Pigs | Yes | Yes | Yes | Yes | Yes | Yes | Yes |
28
+ | Gefluegel | Poultry | Yes | Yes | Yes | Yes | No | Yes | Yes |
29
+ | Schafe | Sheep | Yes | Yes | Yes | Yes | Yes | Yes | Yes |
30
+ | Ziegen | Goats | Yes | Yes | Yes | Yes | Yes | Yes | Yes |
31
+ | Pferde | Horses | Yes | Yes | Yes | Yes | Yes | Yes | Yes |
32
+
33
+ ## Production Systems
34
+
35
+ - **TSchV-Minimum** -- Legal minimum welfare standards per Tierschutzverordnung
36
+ - **RAUS** -- Regelmaessiger Auslauf ins Freie (regular outdoor access), DZV direct payment programme
37
+ - **BTS** -- Besonders tierfreundliche Stallhaltungssysteme (particularly animal-friendly housing systems), DZV direct payment programme
38
+ - **GMF** -- Graslandbasierte Milch- und Fleischproduktion (grassland-based milk and meat production)
39
+
40
+ ## Data Sources
41
+
42
+ | Source | Authority | Retrieval | Update Frequency |
43
+ |--------|-----------|-----------|-----------------|
44
+ | Tierschutzverordnung (TSchV, SR 455.1) | BLV | PDF extract | Periodic (amended as needed) |
45
+ | Direktzahlungsverordnung (DZV) -- RAUS/BTS | BLW | PDF extract | Annual |
46
+ | Tierverkehrsdatenbank (TVD) | Identitas / BLV | Public docs | Continuous |
47
+ | Zuchtorganisationen | Braunvieh Schweiz, swissherdbook, Mutterkuh Schweiz, Suisseporcs | Public docs | Annual |
48
+
49
+ ## Known Gaps
50
+
51
+ - **Cantonal extensions:** TSchV sets federal minimums. Some cantons impose stricter rules (e.g. BE, ZH). Not covered.
52
+ - **Bio Suisse / IP-Suisse:** Organic and IP label standards are not included. Only TSchV + RAUS/BTS.
53
+ - **Aquaculture:** Fish farming (Fischzucht) is not covered.
54
+ - **Bees:** Apiculture (Bienenhaltung) is not covered.
55
+ - **Camelids:** Lamas, alpacas, and other Neuweltkameliden are not covered.
56
+ - **Wild animals in captivity:** Zoo and circus animal regulations are not covered.
57
+ - **Historical amendments:** Only the current consolidated version of TSchV is indexed. Amendment history is not tracked.
58
+ - **Enforcement data:** Cantonal inspection statistics and enforcement actions are not included.
59
+
60
+ ## Freshness
61
+
62
+ Data staleness threshold: 90 days. Automated freshness check runs daily via `check-freshness.yml`. Ingestion is triggered via `ingest.yml` workflow (manual or scheduled).
package/DISCLAIMER.md ADDED
@@ -0,0 +1,41 @@
1
+ # Haftungsausschluss / Disclaimer
2
+
3
+ ## Deutsch
4
+
5
+ Diese Daten dienen ausschliesslich der Information und stellen keine Rechtsberatung, veterinaermedizinische Beratung oder behördliche Auskunft dar.
6
+
7
+ **Massgebende Rechtsquellen:**
8
+ - Tierschutzverordnung (TSchV, SR 455.1)
9
+ - Tierschutzgesetz (TSchG, SR 455)
10
+ - Direktzahlungsverordnung (DZV, SR 910.13) -- RAUS/BTS-Programme
11
+ - Tierseuchenverordnung (TSV, SR 916.401)
12
+
13
+ **Zustaendige Behoerden:**
14
+ - Bundesamt fuer Lebensmittelsicherheit und Veterinaerwesen (BLV)
15
+ - Bundesamt fuer Landwirtschaft (BLW)
16
+ - Kantonale Veterinaerbehoerden
17
+
18
+ Vor Entscheidungen zur Tierhaltung, Stallbau, Transport oder Zucht ist stets die zustaendige kantonale Veterinaerbehoerde oder eine anerkannte Fachberatung zu konsultieren. Die Daten koennen unvollstaendig, veraltet oder fehlerhaft sein. Kantonale Abweichungen von der Bundesgesetzgebung sind nicht abgedeckt.
19
+
20
+ Die Nutzung erfolgt auf eigenes Risiko. Ansvar Systems uebernimmt keine Haftung fuer Schäden, die aus der Nutzung dieser Daten entstehen.
21
+
22
+ ---
23
+
24
+ ## English
25
+
26
+ This data is provided for informational purposes only and does not constitute legal advice, veterinary advice, or official regulatory guidance.
27
+
28
+ **Authoritative legal sources:**
29
+ - Swiss Animal Welfare Ordinance (TSchV, SR 455.1)
30
+ - Swiss Animal Welfare Act (TSchG, SR 455)
31
+ - Direct Payments Ordinance (DZV, SR 910.13) -- RAUS/BTS programmes
32
+ - Animal Diseases Ordinance (TSV, SR 916.401)
33
+
34
+ **Responsible authorities:**
35
+ - Federal Food Safety and Veterinary Office (BLV)
36
+ - Federal Office for Agriculture (BLW)
37
+ - Cantonal veterinary authorities
38
+
39
+ Always consult the competent cantonal veterinary authority or a qualified professional before making decisions about animal husbandry, housing construction, transport, or breeding. Data may be incomplete, outdated, or contain errors. Cantonal deviations from federal legislation are not covered.
40
+
41
+ Use at your own risk. Ansvar Systems accepts no liability for damages arising from the use of this data.
package/Dockerfile ADDED
@@ -0,0 +1,26 @@
1
+ FROM node:20-slim AS builder
2
+ RUN apt-get update && apt-get install -y python3 make g++ && rm -rf /var/lib/apt/lists/*
3
+ WORKDIR /app
4
+ COPY package*.json ./
5
+ RUN npm ci
6
+ COPY tsconfig.json ./
7
+ COPY src/ src/
8
+ RUN npm run build
9
+
10
+ FROM node:20-slim
11
+ RUN apt-get update && apt-get install -y python3 make g++ && rm -rf /var/lib/apt/lists/*
12
+ RUN addgroup --system --gid 1001 nodejs && \
13
+ adduser --system --uid 1001 nodejs
14
+ WORKDIR /app
15
+ COPY package*.json ./
16
+ RUN npm ci --omit=dev && npm cache clean --force && apt-get purge -y python3 make g++ && apt-get autoremove -y
17
+ COPY --from=builder /app/dist dist/
18
+ COPY data/ data/
19
+ RUN chown -R nodejs:nodejs /app/data
20
+ USER nodejs
21
+ ENV NODE_ENV=production
22
+ ENV PORT=3000
23
+ EXPOSE 3000
24
+ HEALTHCHECK --interval=30s --timeout=5s --start-period=10s --retries=3 \
25
+ CMD node -e "require('http').get('http://localhost:' + process.env.PORT + '/health', (r) => { process.exit(r.statusCode === 200 ? 0 : 1) })"
26
+ CMD ["node", "dist/http-server.js"]
package/LICENSE ADDED
@@ -0,0 +1,17 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ Licensed under the Apache License, Version 2.0 (the "License");
6
+ you may not use this file except in compliance with the License.
7
+ You may obtain a copy of the License at
8
+
9
+ http://www.apache.org/licenses/LICENSE-2.0
10
+
11
+ Unless required by applicable law or agreed to in writing, software
12
+ distributed under the License is distributed on an "AS IS" BASIS,
13
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ See the License for the specific language governing permissions and
15
+ limitations under the License.
16
+
17
+ Copyright 2026 Ansvar Systems
package/PRIVACY.md ADDED
@@ -0,0 +1,28 @@
1
+ # Privacy Policy
2
+
3
+ ## Data Processing
4
+
5
+ The Switzerland Livestock MCP **does not collect, store, or process any personal data**. It is a read-only data server that serves Swiss livestock regulatory information.
6
+
7
+ ## What This Server Does
8
+
9
+ - Serves pre-ingested Swiss livestock regulations (TSchV, DZV, TVD, breed data)
10
+ - Responds to MCP tool calls with structured data from a local SQLite database
11
+ - Does not log queries, IP addresses, or user identifiers
12
+ - Does not make outbound network requests
13
+ - Does not use cookies, tracking, or analytics
14
+
15
+ ## What This Server Does Not Do
16
+
17
+ - Does not store any user data
18
+ - Does not process personal data as defined by the Swiss Federal Act on Data Protection (nDSG)
19
+ - Does not profile users
20
+ - Does not share data with third parties
21
+
22
+ ## Data Sources
23
+
24
+ All data originates from public Swiss federal sources (BLV, BLW, Identitas, breed associations). Source attribution is available via the `list_sources` tool.
25
+
26
+ ## Contact
27
+
28
+ For privacy questions: privacy@ansvar.eu
package/README.md ADDED
@@ -0,0 +1,145 @@
1
+ # Switzerland Livestock MCP
2
+
3
+ Swiss livestock regulations via the Model Context Protocol. Covers welfare standards (TSchV), RAUS/BTS direct payment programmes, TVD animal movement rules, housing specifications, stocking densities, feed requirements, animal health, and breed data for cattle, pigs, poultry, sheep, goats, and horses.
4
+
5
+ **Jurisdiction:** Switzerland (CH)
6
+ **Sources:** BLV (Tierschutzverordnung), BLW (Direktzahlungsverordnung), Identitas (TVD), Swiss breed associations
7
+ **Tools:** 11 (3 meta + 8 domain)
8
+ **License:** Apache-2.0
9
+
10
+ ## Quick Start
11
+
12
+ ### npx (stdio)
13
+
14
+ ```bash
15
+ npx -y @ansvar/ch-livestock-mcp
16
+ ```
17
+
18
+ ### Docker
19
+
20
+ ```bash
21
+ docker run -p 3000:3000 ghcr.io/ansvar-systems/ch-livestock-mcp:latest
22
+ ```
23
+
24
+ ### Streamable HTTP (remote)
25
+
26
+ ```
27
+ https://mcp.ansvar.eu/ch-livestock/mcp
28
+ ```
29
+
30
+ No authentication required.
31
+
32
+ ## MCP Client Configuration
33
+
34
+ ### Claude Desktop / Cursor / Windsurf
35
+
36
+ Add to your MCP client config:
37
+
38
+ ```json
39
+ {
40
+ "mcpServers": {
41
+ "ch-livestock": {
42
+ "command": "npx",
43
+ "args": ["-y", "@ansvar/ch-livestock-mcp"]
44
+ }
45
+ }
46
+ }
47
+ ```
48
+
49
+ Or use the remote endpoint:
50
+
51
+ ```json
52
+ {
53
+ "mcpServers": {
54
+ "ch-livestock": {
55
+ "url": "https://mcp.ansvar.eu/ch-livestock/mcp"
56
+ }
57
+ }
58
+ }
59
+ ```
60
+
61
+ ## Tools
62
+
63
+ 11 tools covering Swiss livestock regulation and guidance:
64
+
65
+ | Tool | Description |
66
+ |------|-------------|
67
+ | `about` | Server metadata: name, version, coverage, data sources |
68
+ | `list_sources` | All data sources with authority, URL, license, freshness |
69
+ | `check_data_freshness` | Staleness status and refresh command |
70
+ | `search_livestock_guidance` | FTS across all livestock topics (welfare, housing, feeding, health, transport, breeds) |
71
+ | `get_welfare_standards` | TSchV minimum and RAUS/BTS programme standards per species |
72
+ | `get_stocking_density` | Animals per m2, space requirements by species, age class, housing type (TSchV Anhang 1) |
73
+ | `get_feed_requirements` | Nutritional requirements per species and production stage, including GMF programme |
74
+ | `search_animal_health` | Disease, symptom, prevention, and regulatory reporting search |
75
+ | `get_housing_requirements` | Housing specs: space, ventilation, flooring, temperature (TSchV vs. BTS) |
76
+ | `get_movement_rules` | TVD registration, transport, standstill, and Soemmerung rules |
77
+ | `get_breeding_guidance` | Swiss breed data, breeding calendars, AI (kuenstliche Besamung), genetics |
78
+
79
+ Full parameter documentation: [TOOLS.md](TOOLS.md)
80
+
81
+ ## Data Sources
82
+
83
+ | Source | Authority | Coverage |
84
+ |--------|-----------|----------|
85
+ | Tierschutzverordnung (TSchV, SR 455.1) | BLV | Minimum welfare per species, space, housing, transport, slaughter |
86
+ | Direktzahlungsverordnung (DZV) -- RAUS/BTS | BLW | Outdoor access (RAUS), housing standards (BTS), payment rates per GVE |
87
+ | Tierverkehrsdatenbank (TVD) | Identitas / BLV | Animal registration, ear tags, movement reporting |
88
+ | Zuchtorganisationen | Braunvieh Schweiz, swissherdbook, Mutterkuh Schweiz, Suisseporcs | Swiss cattle, pig, sheep, goat, horse breeds |
89
+
90
+ ## Data Coverage
91
+
92
+ - 45 welfare standards across 6 species and 3 production systems (TSchV-Minimum, RAUS, BTS)
93
+ - 25 stocking density records (TSchV Anhang 1)
94
+ - 14 housing requirement specifications
95
+ - 21 movement/transport rules (TVD, Transport, Soemmerung, Schlachtung)
96
+ - 25 breed records across 5 species
97
+ - 14 feed requirement specifications including GMF programme
98
+ - 13 animal health records (diseases, prevention, regulatory status)
99
+ - 157 FTS search index entries
100
+
101
+ Full coverage breakdown: [COVERAGE.md](COVERAGE.md)
102
+
103
+ ## Development
104
+
105
+ ```bash
106
+ npm install
107
+ npm run build
108
+ npm test
109
+ npm run lint
110
+ ```
111
+
112
+ ### Ingestion
113
+
114
+ ```bash
115
+ npm run ingest # Standard incremental ingest
116
+ npm run ingest:full # Full re-ingest (--force)
117
+ npm run ingest:fetch # Fetch sources only (--fetch-only)
118
+ npm run ingest:diff # Show what changed (--diff-only)
119
+ ```
120
+
121
+ ### Running locally
122
+
123
+ ```bash
124
+ npm run dev # stdio mode (watch)
125
+ npm run start:http # HTTP mode on port 3000
126
+ ```
127
+
128
+ ## Disclaimer
129
+
130
+ This data is provided for informational purposes only and does not constitute legal or veterinary advice. The authoritative sources are the Swiss Animal Welfare Ordinance (TSchV, SR 455.1), the Animal Welfare Act (TSchG, SR 455), and guidance from BLV and BLW. Always consult the cantonal veterinary authority before making livestock management decisions.
131
+
132
+ Full bilingual disclaimer: [DISCLAIMER.md](DISCLAIMER.md)
133
+
134
+ ## Links
135
+
136
+ - [Ansvar Open Agriculture](https://ansvar.eu/open-agriculture)
137
+ - [MCP Network](https://ansvar.ai/mcp)
138
+ - [TOOLS.md](TOOLS.md) -- Full tool documentation
139
+ - [COVERAGE.md](COVERAGE.md) -- Data coverage details
140
+ - [SECURITY.md](SECURITY.md) -- Security policy
141
+ - [PRIVACY.md](PRIVACY.md) -- Privacy policy
142
+
143
+ ## License
144
+
145
+ Apache-2.0 -- see [LICENSE](LICENSE)
package/SECURITY.md ADDED
@@ -0,0 +1,33 @@
1
+ # Security Policy
2
+
3
+ ## Supported Versions
4
+
5
+ | Version | Supported |
6
+ |---------|-----------|
7
+ | 0.1.x | Yes |
8
+
9
+ ## Reporting a Vulnerability
10
+
11
+ If you discover a security vulnerability, please report it responsibly:
12
+
13
+ **Email:** security@ansvar.eu
14
+ **Subject:** `[ch-livestock-mcp] Vulnerability Report`
15
+
16
+ Please include:
17
+ - Description of the vulnerability
18
+ - Steps to reproduce
19
+ - Potential impact
20
+
21
+ We aim to acknowledge reports within 48 hours and provide a fix within 7 days for critical issues.
22
+
23
+ Do **not** open a public GitHub issue for security vulnerabilities.
24
+
25
+ ## Security Measures
26
+
27
+ - **CodeQL** -- Static analysis on every push and PR
28
+ - **Gitleaks** -- Secret detection in commits
29
+ - **Dependency scanning** -- npm audit in CI
30
+ - **Read-only data** -- SQLite database is read-only at runtime in Docker (data volume)
31
+ - **Non-root container** -- Runs as UID 1001 (nodejs user)
32
+ - **No network egress** -- Server does not make outbound requests at runtime
33
+ - **No authentication data** -- Server stores no credentials, tokens, or user data