@ansvar/ch-organic-regen-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 (108) hide show
  1. package/.github/workflows/check-freshness.yml +49 -0
  2. package/.github/workflows/ci.yml +21 -0
  3. package/.github/workflows/codeql.yml +25 -0
  4. package/.github/workflows/ghcr-build.yml +45 -0
  5. package/.github/workflows/gitleaks.yml +18 -0
  6. package/.github/workflows/ingest.yml +59 -0
  7. package/.github/workflows/publish.yml +24 -0
  8. package/CHANGELOG.md +15 -0
  9. package/CODEOWNERS +1 -0
  10. package/COVERAGE.md +47 -0
  11. package/DISCLAIMER.md +67 -0
  12. package/Dockerfile +26 -0
  13. package/LICENSE +17 -0
  14. package/PRIVACY.md +23 -0
  15. package/README.md +117 -0
  16. package/SECURITY.md +25 -0
  17. package/TOOLS.md +141 -0
  18. package/data/coverage.json +22 -0
  19. package/data/database.db +0 -0
  20. package/data/sources.yml +36 -0
  21. package/dist/db.d.ts +25 -0
  22. package/dist/db.d.ts.map +1 -0
  23. package/dist/db.js +184 -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 +263 -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 +11 -0
  34. package/dist/metadata.d.ts.map +1 -0
  35. package/dist/metadata.js +31 -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 +209 -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-approved-inputs.d.ts +26 -0
  50. package/dist/tools/get-approved-inputs.d.ts.map +1 -0
  51. package/dist/tools/get-approved-inputs.js +28 -0
  52. package/dist/tools/get-approved-inputs.js.map +1 -0
  53. package/dist/tools/get-conversion-requirements.d.ts +28 -0
  54. package/dist/tools/get-conversion-requirements.d.ts.map +1 -0
  55. package/dist/tools/get-conversion-requirements.js +32 -0
  56. package/dist/tools/get-conversion-requirements.js.map +1 -0
  57. package/dist/tools/get-organic-standards.d.ts +27 -0
  58. package/dist/tools/get-organic-standards.d.ts.map +1 -0
  59. package/dist/tools/get-organic-standards.js +31 -0
  60. package/dist/tools/get-organic-standards.js.map +1 -0
  61. package/dist/tools/get-organic-subsidies.d.ts +28 -0
  62. package/dist/tools/get-organic-subsidies.d.ts.map +1 -0
  63. package/dist/tools/get-organic-subsidies.js +32 -0
  64. package/dist/tools/get-organic-subsidies.js.map +1 -0
  65. package/dist/tools/get-soil-health-guidance.d.ts +25 -0
  66. package/dist/tools/get-soil-health-guidance.d.ts.map +1 -0
  67. package/dist/tools/get-soil-health-guidance.js +27 -0
  68. package/dist/tools/get-soil-health-guidance.js.map +1 -0
  69. package/dist/tools/list-sources.d.ts +18 -0
  70. package/dist/tools/list-sources.d.ts.map +1 -0
  71. package/dist/tools/list-sources.js +61 -0
  72. package/dist/tools/list-sources.js.map +1 -0
  73. package/dist/tools/search-certification-guidance.d.ts +24 -0
  74. package/dist/tools/search-certification-guidance.d.ts.map +1 -0
  75. package/dist/tools/search-certification-guidance.js +24 -0
  76. package/dist/tools/search-certification-guidance.js.map +1 -0
  77. package/dist/tools/search-organic-rules.d.ts +25 -0
  78. package/dist/tools/search-organic-rules.d.ts.map +1 -0
  79. package/dist/tools/search-organic-rules.js +26 -0
  80. package/dist/tools/search-organic-rules.js.map +1 -0
  81. package/docker-compose.yml +12 -0
  82. package/eslint.config.js +26 -0
  83. package/package.json +54 -0
  84. package/scripts/ingest.ts +963 -0
  85. package/server.json +16 -0
  86. package/src/db.ts +225 -0
  87. package/src/http-server.ts +302 -0
  88. package/src/jurisdiction.ts +30 -0
  89. package/src/metadata.ts +45 -0
  90. package/src/server.ts +239 -0
  91. package/src/tools/about.ts +28 -0
  92. package/src/tools/check-freshness.ts +42 -0
  93. package/src/tools/get-approved-inputs.ts +44 -0
  94. package/src/tools/get-conversion-requirements.ts +50 -0
  95. package/src/tools/get-organic-standards.ts +48 -0
  96. package/src/tools/get-organic-subsidies.ts +50 -0
  97. package/src/tools/get-soil-health-guidance.ts +42 -0
  98. package/src/tools/list-sources.ts +75 -0
  99. package/src/tools/search-certification-guidance.ts +41 -0
  100. package/src/tools/search-organic-rules.ts +35 -0
  101. package/tests/db.test.ts +96 -0
  102. package/tests/helpers/seed-db.ts +145 -0
  103. package/tests/jurisdiction.test.ts +35 -0
  104. package/tests/tools/about.test.ts +22 -0
  105. package/tests/tools/check-freshness.test.ts +57 -0
  106. package/tests/tools/list-sources.test.ts +55 -0
  107. package/tests/tools/search-organic-rules.test.ts +56 -0
  108. package/tsconfig.json +19 -0
@@ -0,0 +1,49 @@
1
+ name: Check Data Freshness
2
+
3
+ on:
4
+ schedule:
5
+ - cron: "0 8 * * *"
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
+ - name: Check freshness
23
+ id: check
24
+ run: |
25
+ if npm run freshness:check 2>&1; then
26
+ echo "stale=false" >> "$GITHUB_OUTPUT"
27
+ else
28
+ echo "stale=true" >> "$GITHUB_OUTPUT"
29
+ fi
30
+ - name: Create issue if stale
31
+ if: steps.check.outputs.stale == 'true'
32
+ uses: actions/github-script@v7
33
+ with:
34
+ script: |
35
+ const existing = await github.rest.issues.listForRepo({
36
+ owner: context.repo.owner,
37
+ repo: context.repo.repo,
38
+ labels: 'data-stale',
39
+ state: 'open'
40
+ });
41
+ if (existing.data.length === 0) {
42
+ await github.rest.issues.create({
43
+ owner: context.repo.owner,
44
+ repo: context.repo.repo,
45
+ title: 'Data is stale — re-ingestion needed',
46
+ body: 'The daily freshness check detected stale data. Run the ingestion workflow to update.\n\n`gh workflow run ingest.yml`',
47
+ labels: ['data-stale']
48
+ });
49
+ }
@@ -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,25 @@
1
+ name: CodeQL
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
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
+ steps:
20
+ - uses: actions/checkout@v4
21
+ - uses: github/codeql-action/init@v3
22
+ with:
23
+ languages: javascript-typescript
24
+ - uses: github/codeql-action/autobuild@v3
25
+ - uses: github/codeql-action/analyze@v3
@@ -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-organic-regen-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,18 @@
1
+ name: Gitleaks
2
+
3
+ on:
4
+ push:
5
+ branches: [main, dev]
6
+ pull_request:
7
+ branches: [main]
8
+
9
+ jobs:
10
+ scan:
11
+ runs-on: ubuntu-latest
12
+ steps:
13
+ - uses: actions/checkout@v4
14
+ with:
15
+ fetch-depth: 0
16
+ - uses: gitleaks/gitleaks-action@v2
17
+ env:
18
+ GITLEAKS_LICENSE: ${{ secrets.GITLEAKS_LICENSE }}
@@ -0,0 +1,59 @@
1
+ name: Re-ingest Data
2
+
3
+ on:
4
+ schedule:
5
+ - cron: "0 4 1 * *"
6
+ workflow_dispatch:
7
+ inputs:
8
+ force:
9
+ description: "Force full rebuild even if no changes detected"
10
+ type: boolean
11
+ default: false
12
+
13
+ permissions:
14
+ contents: write
15
+
16
+ jobs:
17
+ ingest:
18
+ runs-on: ubuntu-latest
19
+ steps:
20
+ - uses: actions/checkout@v4
21
+ - uses: actions/setup-node@v4
22
+ with:
23
+ node-version: "20"
24
+ cache: npm
25
+ - run: npm ci
26
+
27
+ - name: Fetch upstream data
28
+ run: npm run ingest:fetch
29
+
30
+ - name: Check for changes
31
+ id: diff
32
+ run: |
33
+ if [ "${{ inputs.force }}" = "true" ] || npm run ingest:diff 2>&1 | grep -q "changes detected"; then
34
+ echo "changed=true" >> "$GITHUB_OUTPUT"
35
+ else
36
+ echo "changed=false" >> "$GITHUB_OUTPUT"
37
+ echo "No upstream changes detected. Skipping rebuild."
38
+ fi
39
+
40
+ - name: Rebuild database
41
+ if: steps.diff.outputs.changed == 'true'
42
+ run: npm run ingest:full
43
+
44
+ - name: Run tests
45
+ if: steps.diff.outputs.changed == 'true'
46
+ run: npm test
47
+
48
+ - name: Update coverage
49
+ if: steps.diff.outputs.changed == 'true'
50
+ run: npm run coverage:update
51
+
52
+ - name: Commit updated database
53
+ if: steps.diff.outputs.changed == 'true'
54
+ run: |
55
+ git config user.name "github-actions[bot]"
56
+ git config user.email "github-actions[bot]@users.noreply.github.com"
57
+ git add data/database.db data/coverage.json data/.source-hashes.json
58
+ git diff --staged --quiet || git commit -m "chore: re-ingest data $(date +%Y-%m-%d)"
59
+ 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,15 @@
1
+ # Changelog
2
+
3
+ ## [0.1.0] - 2026-04-05
4
+
5
+ ### Added
6
+
7
+ - Initial release with 10 MCP tools (3 meta + 7 domain)
8
+ - SQLite + FTS5 database with schema for organic standards, conversion requirements, approved inputs, subsidies, soil health, certification guidance
9
+ - Dual transport: stdio (npm) and Streamable HTTP (Docker)
10
+ - Jurisdiction validation (CH supported)
11
+ - Data freshness monitoring with 90-day staleness threshold
12
+ - Docker image with non-root user, health check
13
+ - CI/CD: TypeScript build, lint, test, CodeQL, Gitleaks, GHCR image build, npm publish
14
+ - Bilingual disclaimer (DE/EN) and privacy statement
15
+ - Ingestion pipeline for Bio Suisse, Bio-Verordnung, FiBL, Demeter, DZV data
package/CODEOWNERS ADDED
@@ -0,0 +1 @@
1
+ * @ansvar-systems/engineering
package/COVERAGE.md ADDED
@@ -0,0 +1,47 @@
1
+ # Coverage
2
+
3
+ ## What Is Included
4
+
5
+ - **Organic standards comparison** -- Bio Suisse Knospe, federal Bio-Verordnung (SR 910.18), and Demeter biodynamic rules across production types (18 rules)
6
+ - **Conversion requirements** -- Timelines, prerequisites, and support measures for switching to organic by farm type (7 farm types)
7
+ - **Approved inputs** -- FiBL Betriebsmittelliste entries for fertilisers, plant protection, and feed (15 products)
8
+ - **Organic subsidies** -- Bio-Beitrag and Direktzahlungen rates per land use type and altitude zone (14 entries)
9
+ - **Soil health guidance** -- Regenerative agriculture methods: composting, cover crops, crop rotation, agroforestry, direct seeding (10 topics)
10
+ - **Certification guidance** -- Knospe certification process via bio.inspecta and Bio Test Agro (8 steps)
11
+
12
+ ## Jurisdictions
13
+
14
+ | Code | Country | Status |
15
+ |------|---------|--------|
16
+ | CH | Switzerland | Supported |
17
+
18
+ ## Data Sources
19
+
20
+ | Source | Authority | Type |
21
+ |--------|-----------|------|
22
+ | Bio Suisse Richtlinien (Knospe) | Bio Suisse | Private-label standard |
23
+ | Bio-Verordnung SR 910.18 | Bundesamt fuer Landwirtschaft (BLW) | Federal regulation |
24
+ | FiBL Betriebsmittelliste | Forschungsinstitut fuer biologischen Landbau (FiBL) | Approved input register |
25
+ | Demeter Schweiz Richtlinien | Demeter Schweiz | Private-label standard |
26
+ | DZV Bio-Beitrag | Bundesamt fuer Landwirtschaft (BLW) | Subsidy regulation |
27
+
28
+ ## What Is NOT Included
29
+
30
+ - **Cantonal-specific organic rules** -- Cantons may have additional requirements not yet ingested
31
+ - **Detailed FiBL product database** -- Only representative entries from the Betriebsmittelliste, not the full product catalogue
32
+ - **Real-time subsidy calculations** -- Rates are from the last DZV update; individual farm calculations require a cantonal advisor
33
+ - **Biodynamic preparations in detail** -- Demeter preparations 500-508 are referenced but not individually documented
34
+ - **Market price data** -- No commodity or organic premium pricing is included
35
+ - **Liechtenstein** -- Uses Swiss organic framework but has separate administrative processes
36
+ - **Import/export certification** -- Bio Suisse import rules are not yet covered
37
+
38
+ ## Known Gaps
39
+
40
+ 1. FiBL Betriebsmittelliste is updated annually; entries may lag behind the published list
41
+ 2. Subsidy rates change with each DZV revision (typically annual)
42
+ 3. FTS5 search works best with German terms; English queries fall back through tiered matching
43
+ 4. Cantonal advisory bodies (LBB, Strickhof, Inforama, etc.) publish supplementary guidance not yet ingested
44
+
45
+ ## Data Freshness
46
+
47
+ Run `check_data_freshness` to see when data was last updated. The ingestion pipeline runs on a monthly schedule; manual triggers available via `gh workflow run ingest.yml`.
package/DISCLAIMER.md ADDED
@@ -0,0 +1,67 @@
1
+ # Haftungsausschluss / Disclaimer
2
+
3
+ ## Deutsch
4
+
5
+ Dieser MCP-Server stellt landwirtschaftliche Daten ausschliesslich zu Informationszwecken bereit.
6
+
7
+ ### Keine Fachberatung
8
+
9
+ Die bereitgestellten Daten stellen keine professionelle landwirtschaftliche, agronomische oder finanzielle Beratung dar. Vor der Umstellung auf biologische Landwirtschaft, der Anwendung regenerativer Methoden oder der Beantragung von Zertifizierungen ist stets eine qualifizierte Fachberatung hinzuzuziehen:
10
+
11
+ - **FiBL** (Forschungsinstitut fuer biologischen Landbau)
12
+ - **Bio Suisse** Beratungsdienst
13
+ - **Kantonale Fachstellen** fuer Biolandbau
14
+ - **AGRIDEA** Beratungszentrale
15
+ - **Akkreditierter Bio-Berater**
16
+
17
+ ### Datenquellen
18
+
19
+ - **Bio Suisse Richtlinien (Knospe)** -- Bio Suisse, oeffentliches Richtliniendokument
20
+ - **Bio-Verordnung (SR 910.18)** -- Bundesamt fuer Landwirtschaft (BLW), frei verwendbar
21
+ - **FiBL Betriebsmittelliste** -- Forschungsinstitut fuer biologischen Landbau, oeffentliche Referenzliste
22
+ - **Demeter Schweiz Richtlinien** -- Demeter Schweiz, oeffentliches Richtliniendokument
23
+ - **Direktzahlungsverordnung (DZV)** -- Bundesamt fuer Landwirtschaft (BLW), frei verwendbar
24
+
25
+ ### Aktualitaet
26
+
27
+ Landwirtschaftliche Daten aendern sich. Bio Suisse Richtlinien werden jaehrlich an der Delegiertenversammlung angepasst. Die DZV wird periodisch revidiert. Dieser Server zeigt die Daten zum Zeitpunkt der letzten Datenaktualisierung. Verwenden Sie `check_data_freshness` fuer das Alter der Daten.
28
+
29
+ ### Kantonale Abweichungen
30
+
31
+ Kantonale Vorschriften und betriebsspezifische Anpassungen sind eigenstaendig zu pruefen. Dieser Server deckt die Bundesgesetzgebung und private Label-Standards (Knospe, Demeter) ab, nicht kantonale Sonderregelungen.
32
+
33
+ ---
34
+
35
+ ## English
36
+
37
+ This MCP server provides agricultural data for informational purposes only.
38
+
39
+ ### Not Professional Advice
40
+
41
+ The data served by this tool does not constitute professional agricultural, agronomic, or financial advice. Before converting to organic farming, applying regenerative methods, or applying for certifications, always consult a qualified advisor:
42
+
43
+ - **FiBL** (Research Institute of Organic Agriculture)
44
+ - **Bio Suisse** advisory services
45
+ - **Cantonal organic farming authorities**
46
+ - **AGRIDEA** advisory centre
47
+ - **Accredited organic farming consultant**
48
+
49
+ ### Data Sources
50
+
51
+ - **Bio Suisse Richtlinien (Knospe)** -- Bio Suisse, public standards document
52
+ - **Bio-Verordnung (SR 910.18)** -- Federal Office for Agriculture (BLW), free reuse
53
+ - **FiBL Betriebsmittelliste** -- Research Institute of Organic Agriculture, public reference list
54
+ - **Demeter Schweiz Richtlinien** -- Demeter Switzerland, public standards document
55
+ - **Direktzahlungsverordnung (DZV)** -- Federal Office for Agriculture (BLW), free reuse
56
+
57
+ ### Currency
58
+
59
+ Agricultural data changes. Bio Suisse standards are updated annually at the delegate assembly. The DZV is revised periodically. This tool shows data available at the time of its last ingestion run. Check `check_data_freshness` for data age.
60
+
61
+ ### Cantonal Variations
62
+
63
+ Cantonal regulations and farm-specific adjustments must be verified independently. This server covers federal legislation and private label standards (Knospe, Demeter), not cantonal special provisions.
64
+
65
+ ### No Warranty
66
+
67
+ This software is provided "as is" without warranty of any kind. See the Apache-2.0 license for details.
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,23 @@
1
+ # Privacy Statement
2
+
3
+ ## No Data Collection
4
+
5
+ This MCP server:
6
+
7
+ - Does **not** collect, store, or transmit any user data
8
+ - Does **not** use cookies, analytics, or telemetry
9
+ - Does **not** require user accounts or authentication
10
+ - Does **not** log queries or usage patterns
11
+ - Does **not** store any client-side state
12
+
13
+ ## Data Served
14
+
15
+ All data returned by this server is sourced from publicly available Swiss organic farming standards, federal regulations, and research institute publications. No personal data, proprietary data, or confidential information is included.
16
+
17
+ ## Self-Hosting
18
+
19
+ This server can be self-hosted. When you run it locally via npm or Docker, all processing happens on your machine. No external network calls are made at query time -- all data is embedded in the SQLite database.
20
+
21
+ ## Contact
22
+
23
+ For privacy questions: privacy@ansvar.eu
package/README.md ADDED
@@ -0,0 +1,117 @@
1
+ # Switzerland Organic & Regenerative Farming MCP
2
+
3
+ [![CI](https://github.com/ansvar-systems/ch-organic-regen-mcp/actions/workflows/ci.yml/badge.svg)](https://github.com/ansvar-systems/ch-organic-regen-mcp/actions/workflows/ci.yml)
4
+ [![GHCR](https://github.com/ansvar-systems/ch-organic-regen-mcp/actions/workflows/ghcr-build.yml/badge.svg)](https://github.com/ansvar-systems/ch-organic-regen-mcp/actions/workflows/ghcr-build.yml)
5
+ [![License: Apache-2.0](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)
6
+
7
+ Swiss organic and regenerative agriculture data via the [Model Context Protocol](https://modelcontextprotocol.io). Query Bio Suisse Knospe standards, Bio-Verordnung, FiBL Betriebsmittelliste, Demeter rules, conversion requirements, organic subsidies, soil health guidance, and certification processes -- all from your AI assistant.
8
+
9
+ Part of [Ansvar Open Agriculture](https://ansvar.eu/open-agriculture).
10
+
11
+ ## Why This Exists
12
+
13
+ Swiss organic farmers, advisors, and certification bodies need fast access to Bio Suisse Knospe rules, federal Bio-Verordnung requirements, FiBL approved input lists, Demeter biodynamic standards, conversion timelines, and subsidy rates. This information is published across multiple organisations (Bio Suisse, BLW, FiBL, Demeter Schweiz, AGRIDEA) in PDFs and web portals that AI assistants cannot query directly. This MCP server makes it all searchable.
14
+
15
+ ## Quick Start
16
+
17
+ ### Claude Desktop
18
+
19
+ Add to `claude_desktop_config.json`:
20
+
21
+ ```json
22
+ {
23
+ "mcpServers": {
24
+ "ch-organic-regen": {
25
+ "command": "npx",
26
+ "args": ["-y", "@ansvar/ch-organic-regen-mcp"]
27
+ }
28
+ }
29
+ }
30
+ ```
31
+
32
+ ### Claude Code
33
+
34
+ ```bash
35
+ claude mcp add ch-organic-regen npx @ansvar/ch-organic-regen-mcp
36
+ ```
37
+
38
+ ### Streamable HTTP (remote)
39
+
40
+ ```
41
+ https://mcp.ansvar.eu/ch-organic-regen/mcp
42
+ ```
43
+
44
+ ### Docker (self-hosted)
45
+
46
+ ```bash
47
+ docker run -p 3000:3000 ghcr.io/ansvar-systems/ch-organic-regen-mcp:latest
48
+ ```
49
+
50
+ ### npm (stdio)
51
+
52
+ ```bash
53
+ npx @ansvar/ch-organic-regen-mcp
54
+ ```
55
+
56
+ ## Example Queries
57
+
58
+ Ask your AI assistant:
59
+
60
+ - "Was sind die Knospe-Anforderungen fuer Futtermittel?"
61
+ - "What are the conversion requirements for a dairy farm switching to organic?"
62
+ - "Welche Pflanzenschutzmittel sind auf der FiBL-Betriebsmittelliste zugelassen?"
63
+ - "What Bio-Beitrag subsidies are available in Bergzone II?"
64
+ - "How does Demeter differ from Knospe for animal husbandry?"
65
+ - "What composting methods are recommended for soil health?"
66
+ - "How do I apply for Knospe certification through bio.inspecta?"
67
+
68
+ ## Stats
69
+
70
+ | Metric | Value |
71
+ |--------|-------|
72
+ | Tools | 10 (3 meta + 7 domain) |
73
+ | Jurisdiction | CH (Switzerland) |
74
+ | Data sources | Bio Suisse Knospe, Bio-Verordnung SR 910.18, FiBL Betriebsmittelliste, Demeter Schweiz, DZV Bio-Beitrag |
75
+ | License (data) | Public standards / Swiss federal free reuse |
76
+ | License (code) | Apache-2.0 |
77
+ | Transport | stdio + Streamable HTTP |
78
+
79
+ ## Tools
80
+
81
+ | Tool | Description |
82
+ |------|-------------|
83
+ | `about` | Server metadata and links |
84
+ | `list_sources` | Data sources with freshness info |
85
+ | `check_data_freshness` | Staleness status and refresh command |
86
+ | `search_organic_rules` | FTS5 search across organic rules, conversion, and soil health data |
87
+ | `get_conversion_requirements` | Conversion timeline and requirements by farm type |
88
+ | `get_organic_standards` | Production rules comparing Knospe, Bio-Verordnung, and Demeter |
89
+ | `get_approved_inputs` | FiBL Betriebsmittelliste: approved fertilisers, plant protection, feed |
90
+ | `get_organic_subsidies` | Bio-Beitrag and Direktzahlungen rates by zone |
91
+ | `get_soil_health_guidance` | Regenerative methods: composting, cover crops, agroforestry |
92
+ | `search_certification_guidance` | Knospe certification process: bio.inspecta, Bio Test Agro |
93
+
94
+ See [TOOLS.md](TOOLS.md) for full parameter documentation.
95
+
96
+ ## Security Scanning
97
+
98
+ This repository runs security checks on every push:
99
+
100
+ - **CodeQL** -- static analysis for JavaScript/TypeScript
101
+ - **Gitleaks** -- secret detection across full history
102
+ - **Dependency review** -- via Dependabot
103
+ - **Container scanning** -- via GHCR build pipeline
104
+
105
+ See [SECURITY.md](SECURITY.md) for reporting policy.
106
+
107
+ ## Disclaimer
108
+
109
+ This tool provides reference data for informational purposes only. It is not professional agricultural advice. Always consult a qualified organic farming advisor (FiBL, Bio Suisse, cantonal authority, AGRIDEA) before making conversion or management decisions. See [DISCLAIMER.md](DISCLAIMER.md).
110
+
111
+ ## Contributing
112
+
113
+ Issues and pull requests welcome. For security vulnerabilities, email security@ansvar.eu (do not open a public issue).
114
+
115
+ ## License
116
+
117
+ Apache-2.0. Data sourced from Bio Suisse, FiBL, BLW, and Demeter Schweiz under public standards and Swiss federal free-reuse terms.
package/SECURITY.md ADDED
@@ -0,0 +1,25 @@
1
+ # Security Policy
2
+
3
+ ## Reporting a Vulnerability
4
+
5
+ If you discover a security vulnerability, please report it responsibly:
6
+
7
+ 1. **Do NOT open a public issue**
8
+ 2. Email security@ansvar.eu with:
9
+ - Description of the vulnerability
10
+ - Steps to reproduce
11
+ - Potential impact
12
+ 3. We will acknowledge within 48 hours and provide a timeline for fix
13
+
14
+ ## Supported Versions
15
+
16
+ | Version | Supported |
17
+ |---------|-----------|
18
+ | Latest | Yes |
19
+
20
+ ## Security Measures
21
+
22
+ - All dependencies scanned via CodeQL, Semgrep, Trivy, Gitleaks, Socket, and OpenSSF Scorecard
23
+ - No secrets stored in code -- all data is public domain
24
+ - SQLite database is read-only at runtime
25
+ - Container runs as non-root with no-new-privileges and cap_drop ALL