odoo-preview-mcp 0.1.0__tar.gz
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.
- odoo_preview_mcp-0.1.0/.dockerignore +11 -0
- odoo_preview_mcp-0.1.0/.env.example +84 -0
- odoo_preview_mcp-0.1.0/.github/ISSUE_TEMPLATE/bug_report.md +28 -0
- odoo_preview_mcp-0.1.0/.github/ISSUE_TEMPLATE/config.yml +5 -0
- odoo_preview_mcp-0.1.0/.github/ISSUE_TEMPLATE/feature_request.md +18 -0
- odoo_preview_mcp-0.1.0/.github/workflows/publish.yml +34 -0
- odoo_preview_mcp-0.1.0/.github/workflows/tests.yml +26 -0
- odoo_preview_mcp-0.1.0/.gitignore +16 -0
- odoo_preview_mcp-0.1.0/.python-version +1 -0
- odoo_preview_mcp-0.1.0/.vercelignore +15 -0
- odoo_preview_mcp-0.1.0/CHANGELOG.md +51 -0
- odoo_preview_mcp-0.1.0/CONTRIBUTING.md +46 -0
- odoo_preview_mcp-0.1.0/Dockerfile +21 -0
- odoo_preview_mcp-0.1.0/LICENSE +190 -0
- odoo_preview_mcp-0.1.0/PKG-INFO +247 -0
- odoo_preview_mcp-0.1.0/README.md +206 -0
- odoo_preview_mcp-0.1.0/SECURITY.md +34 -0
- odoo_preview_mcp-0.1.0/app.py +20 -0
- odoo_preview_mcp-0.1.0/docker-compose.yml +35 -0
- odoo_preview_mcp-0.1.0/docs/DEPLOY.md +105 -0
- odoo_preview_mcp-0.1.0/docs/DEPLOY_VERCEL.md +66 -0
- odoo_preview_mcp-0.1.0/docs/ODOO_SETUP.md +66 -0
- odoo_preview_mcp-0.1.0/docs/SECURITY.md +199 -0
- odoo_preview_mcp-0.1.0/pyproject.toml +59 -0
- odoo_preview_mcp-0.1.0/scripts/deploy.sh +35 -0
- odoo_preview_mcp-0.1.0/src/odoo_preview_mcp/__init__.py +3 -0
- odoo_preview_mcp-0.1.0/src/odoo_preview_mcp/__main__.py +117 -0
- odoo_preview_mcp-0.1.0/src/odoo_preview_mcp/accounting.py +1382 -0
- odoo_preview_mcp-0.1.0/src/odoo_preview_mcp/audit.py +65 -0
- odoo_preview_mcp-0.1.0/src/odoo_preview_mcp/compact.py +108 -0
- odoo_preview_mcp-0.1.0/src/odoo_preview_mcp/config.py +190 -0
- odoo_preview_mcp-0.1.0/src/odoo_preview_mcp/confirm.py +83 -0
- odoo_preview_mcp-0.1.0/src/odoo_preview_mcp/customfields.py +390 -0
- odoo_preview_mcp-0.1.0/src/odoo_preview_mcp/deadline.py +31 -0
- odoo_preview_mcp-0.1.0/src/odoo_preview_mcp/errors.py +119 -0
- odoo_preview_mcp-0.1.0/src/odoo_preview_mcp/formatting.py +104 -0
- odoo_preview_mcp-0.1.0/src/odoo_preview_mcp/guide.py +1336 -0
- odoo_preview_mcp-0.1.0/src/odoo_preview_mcp/oauth/__init__.py +127 -0
- odoo_preview_mcp-0.1.0/src/odoo_preview_mcp/oauth/admin.py +110 -0
- odoo_preview_mcp-0.1.0/src/odoo_preview_mcp/oauth/cimd.py +183 -0
- odoo_preview_mcp-0.1.0/src/odoo_preview_mcp/oauth/clients.py +156 -0
- odoo_preview_mcp-0.1.0/src/odoo_preview_mcp/oauth/crypto.py +84 -0
- odoo_preview_mcp-0.1.0/src/odoo_preview_mcp/oauth/limits.py +65 -0
- odoo_preview_mcp-0.1.0/src/odoo_preview_mcp/oauth/login_page.py +389 -0
- odoo_preview_mcp-0.1.0/src/odoo_preview_mcp/oauth/provider.py +548 -0
- odoo_preview_mcp-0.1.0/src/odoo_preview_mcp/oauth/redis_store.py +444 -0
- odoo_preview_mcp-0.1.0/src/odoo_preview_mcp/oauth/routes.py +249 -0
- odoo_preview_mcp-0.1.0/src/odoo_preview_mcp/oauth/store.py +577 -0
- odoo_preview_mcp-0.1.0/src/odoo_preview_mcp/odoo_client.py +571 -0
- odoo_preview_mcp-0.1.0/src/odoo_preview_mcp/policy.py +1190 -0
- odoo_preview_mcp-0.1.0/src/odoo_preview_mcp/ratelimit.py +20 -0
- odoo_preview_mcp-0.1.0/src/odoo_preview_mcp/reports.py +201 -0
- odoo_preview_mcp-0.1.0/src/odoo_preview_mcp/schema.py +89 -0
- odoo_preview_mcp-0.1.0/src/odoo_preview_mcp/server.py +305 -0
- odoo_preview_mcp-0.1.0/src/odoo_preview_mcp/service.py +3302 -0
- odoo_preview_mcp-0.1.0/src/odoo_preview_mcp/state.py +233 -0
- odoo_preview_mcp-0.1.0/src/odoo_preview_mcp/tools.py +694 -0
- odoo_preview_mcp-0.1.0/src/odoo_preview_mcp/uploads.py +303 -0
- odoo_preview_mcp-0.1.0/src/odoo_preview_mcp/usage.py +155 -0
- odoo_preview_mcp-0.1.0/src/odoo_preview_mcp/validation.py +919 -0
- odoo_preview_mcp-0.1.0/tests/conftest.py +821 -0
- odoo_preview_mcp-0.1.0/tests/e2e_http_connector.py +109 -0
- odoo_preview_mcp-0.1.0/tests/test_bad_day.py +1281 -0
- odoo_preview_mcp-0.1.0/tests/test_bank_and_locks.py +716 -0
- odoo_preview_mcp-0.1.0/tests/test_bank_foreign.py +182 -0
- odoo_preview_mcp-0.1.0/tests/test_change_outcomes.py +549 -0
- odoo_preview_mcp-0.1.0/tests/test_compact.py +123 -0
- odoo_preview_mcp-0.1.0/tests/test_confirm.py +190 -0
- odoo_preview_mcp-0.1.0/tests/test_custom_fields.py +320 -0
- odoo_preview_mcp-0.1.0/tests/test_deleting.py +372 -0
- odoo_preview_mcp-0.1.0/tests/test_file_moves.py +113 -0
- odoo_preview_mcp-0.1.0/tests/test_files_in_odoo.py +369 -0
- odoo_preview_mcp-0.1.0/tests/test_followers.py +189 -0
- odoo_preview_mcp-0.1.0/tests/test_formatting.py +211 -0
- odoo_preview_mcp-0.1.0/tests/test_guide.py +508 -0
- odoo_preview_mcp-0.1.0/tests/test_limits_and_approval_time.py +171 -0
- odoo_preview_mcp-0.1.0/tests/test_live_odoo.py +264 -0
- odoo_preview_mcp-0.1.0/tests/test_oauth.py +1070 -0
- odoo_preview_mcp-0.1.0/tests/test_oauth_units.py +364 -0
- odoo_preview_mcp-0.1.0/tests/test_odoo_client.py +1017 -0
- odoo_preview_mcp-0.1.0/tests/test_performance_paths.py +869 -0
- odoo_preview_mcp-0.1.0/tests/test_policy.py +1253 -0
- odoo_preview_mcp-0.1.0/tests/test_quotation_send.py +221 -0
- odoo_preview_mcp-0.1.0/tests/test_redis_backend.py +242 -0
- odoo_preview_mcp-0.1.0/tests/test_redis_budget.py +93 -0
- odoo_preview_mcp-0.1.0/tests/test_reports.py +186 -0
- odoo_preview_mcp-0.1.0/tests/test_service_offline.py +874 -0
- odoo_preview_mcp-0.1.0/tests/test_setup_edits_and_lines.py +369 -0
- odoo_preview_mcp-0.1.0/tests/test_signout_paths.py +141 -0
- odoo_preview_mcp-0.1.0/tests/test_uploads.py +158 -0
- odoo_preview_mcp-0.1.0/tests/test_usage.py +148 -0
- odoo_preview_mcp-0.1.0/tests/test_ux_flows.py +598 -0
- odoo_preview_mcp-0.1.0/tests/test_validation.py +1430 -0
- odoo_preview_mcp-0.1.0/tests/test_wiring.py +95 -0
- odoo_preview_mcp-0.1.0/uv.lock +1086 -0
- odoo_preview_mcp-0.1.0/vercel.json +16 -0
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
# ---------------------------------------------------------------------------
|
|
2
|
+
# odoo-preview-mcp: configuration. Copy to .env and fill in.
|
|
3
|
+
# Every safety switch defaults to the safest value; change only what you need.
|
|
4
|
+
# ---------------------------------------------------------------------------
|
|
5
|
+
|
|
6
|
+
# --- Odoo -----------------------------------------------------------------------
|
|
7
|
+
ODOO_URL=https://mycompany.odoo.com
|
|
8
|
+
# Database name (on odoo.com this is usually the sub-domain). Optional for JSON-2, required for legacy JSON-RPC.
|
|
9
|
+
ODOO_DB=mycompany
|
|
10
|
+
# auto = use Odoo 19+ JSON-2 API, fall back to legacy JSON-RPC on older Odoo.
|
|
11
|
+
ODOO_PROTOCOL=auto
|
|
12
|
+
# Odoo Online asks for throttled, non-parallel API calls. Keep 1 unless you host Odoo yourself / on Odoo.sh.
|
|
13
|
+
ODOO_MAX_PARALLEL_REQUESTS=1
|
|
14
|
+
|
|
15
|
+
# --- Local (stdio) mode only: one person, their own key -------------------------------
|
|
16
|
+
# In company (http) mode leave these empty: each person signs in with their own key.
|
|
17
|
+
ODOO_LOGIN=
|
|
18
|
+
ODOO_API_KEY=
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
# --- What the AI may do ---------------------------------------------------------------
|
|
23
|
+
# read_only (default): search, read, count, reports. No change tools are even shown to Claude.
|
|
24
|
+
# read_write: also create / update / press workflow buttons / log notes, always with preview + approval.
|
|
25
|
+
MCP_ACCESS_MODE=read_only
|
|
26
|
+
# Every change must be previewed and confirmed with a signed token. Keep this true.
|
|
27
|
+
MCP_REQUIRE_PREVIEW=true
|
|
28
|
+
# Archiving hides records (reversible in Odoo). Off by default.
|
|
29
|
+
MCP_ALLOW_ARCHIVE=false
|
|
30
|
+
# Cancel / reset-to-draft / mark-lost type buttons. Off by default.
|
|
31
|
+
MCP_ALLOW_CANCEL_ACTIONS=false
|
|
32
|
+
# Anything that e-mails/SMSes/messages people (send quotation, chatter messages to followers). Off by default.
|
|
33
|
+
MCP_ALLOW_OUTBOUND_MESSAGES=false
|
|
34
|
+
|
|
35
|
+
# Time zone used when the Odoo user's profile has none (e.g. Europe/Brussels). Default: UTC.
|
|
36
|
+
# MCP_DEFAULT_TIMEZONE=Europe/Brussels
|
|
37
|
+
|
|
38
|
+
# Who people should ask to switch something on for Claude (named in refusals). Default: your administrator.
|
|
39
|
+
# MCP_ADMIN_CONTACT=the IT team
|
|
40
|
+
|
|
41
|
+
# Name shown on the sign-in and upload pages and in Claude. Default: Odoo.
|
|
42
|
+
# MCP_DISPLAY_NAME=Acme Odoo
|
|
43
|
+
|
|
44
|
+
# Limits
|
|
45
|
+
MCP_DEFAULT_READ_LIMIT=50
|
|
46
|
+
MCP_MAX_READ_RECORDS=200
|
|
47
|
+
# Records one create or edit may touch (also moving files). Hard cap 100.
|
|
48
|
+
MCP_MAX_WRITE_RECORDS=100
|
|
49
|
+
# Records one button, dialog, message, follower change or delete may touch. Hard cap 100.
|
|
50
|
+
MCP_MAX_ACTION_RECORDS=20
|
|
51
|
+
# How long an approved preview stays usable, in seconds (a change to the records since the preview still voids it).
|
|
52
|
+
MCP_CONFIRM_TTL_SECONDS=3600
|
|
53
|
+
MCP_READS_PER_MINUTE=120
|
|
54
|
+
MCP_WRITES_PER_MINUTE=30
|
|
55
|
+
|
|
56
|
+
# Optional extra restrictions (comma-separated, globs allowed, e.g. hr.*)
|
|
57
|
+
# MCP_BLOCKED_MODELS=hr.payslip,hr.employee
|
|
58
|
+
# MCP_READONLY_MODELS=account.*
|
|
59
|
+
# If set, ONLY these models can be changed:
|
|
60
|
+
# MCP_WRITABLE_MODELS=crm.lead,res.partner,project.task,sale.order,sale.order.line,mail.activity
|
|
61
|
+
# MCP_BLOCKED_METHODS=action_confirm
|
|
62
|
+
# Methods callable even though they are not a button in Odoo's screens ("model:method"):
|
|
63
|
+
# MCP_EXTRA_ALLOWED_METHODS=
|
|
64
|
+
|
|
65
|
+
# Append-only audit log file (JSON lines; field names and ids only, never values or keys)
|
|
66
|
+
# MCP_AUDIT_LOG_FILE=/data/audit.log
|
|
67
|
+
|
|
68
|
+
# --- Company connector (http) mode -------------------------------------------------------
|
|
69
|
+
# The public https address of THIS server (what you paste into Claude, minus /mcp).
|
|
70
|
+
MCP_PUBLIC_URL=https://odoo-mcp.example.com
|
|
71
|
+
# 32+ random characters. Generate with: python3 -c "import secrets; print(secrets.token_urlsafe(48))"
|
|
72
|
+
# Encrypts stored Odoo keys and signs tokens. Keep it secret; changing it signs everybody out.
|
|
73
|
+
MCP_SECRET=
|
|
74
|
+
MCP_DATA_DIR=/data
|
|
75
|
+
# Only these exact Odoo logins may connect (recommended):
|
|
76
|
+
# MCP_ALLOWED_LOGINS=person@example.com
|
|
77
|
+
# ...or only logins on your company e-mail domain:
|
|
78
|
+
# MCP_ALLOWED_LOGIN_DOMAINS=example.com
|
|
79
|
+
# Set true only when running behind a reverse proxy that sets X-Forwarded-For (Caddy, nginx, Cloud Run...)
|
|
80
|
+
MCP_TRUST_PROXY_HEADERS=true
|
|
81
|
+
|
|
82
|
+
# Usage report (GET /admin/usage, `odoo-preview-mcp usage`): any long random value; unset = report disabled.
|
|
83
|
+
# Needs Redis (the report reads the 30-day usage history stored there).
|
|
84
|
+
MCP_ADMIN_TOKEN=
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: Bug report
|
|
3
|
+
about: Something does not work as described
|
|
4
|
+
title: ""
|
|
5
|
+
labels: bug
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
**What happened**
|
|
9
|
+
A short description of the problem.
|
|
10
|
+
|
|
11
|
+
**What you expected**
|
|
12
|
+
What should have happened instead.
|
|
13
|
+
|
|
14
|
+
**Steps to repeat it**
|
|
15
|
+
1. What you asked Claude, or the tool call and its arguments
|
|
16
|
+
2. What Claude or the server answered
|
|
17
|
+
3. ...
|
|
18
|
+
|
|
19
|
+
**Your setup**
|
|
20
|
+
- odoo-preview-mcp version (`odoo-preview-mcp --version`):
|
|
21
|
+
- Odoo version and edition (for example 19.0 Enterprise on Odoo Online):
|
|
22
|
+
- Mode: local (stdio) or company (http)
|
|
23
|
+
- Claude app (Desktop, Code, web) or other MCP client:
|
|
24
|
+
|
|
25
|
+
**Error text or logs**
|
|
26
|
+
Paste them here. Remove API keys, e-mail addresses, customer names and amounts first.
|
|
27
|
+
|
|
28
|
+
Security problem? Do not open an issue. Follow SECURITY.md instead.
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: Feature request
|
|
3
|
+
about: Ask for something Claude cannot do yet
|
|
4
|
+
title: ""
|
|
5
|
+
labels: enhancement
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
**The problem**
|
|
9
|
+
What are you trying to do in Odoo, and why can you not do it now?
|
|
10
|
+
|
|
11
|
+
**What you would like**
|
|
12
|
+
How should it work? What should the person see in the preview before they approve?
|
|
13
|
+
|
|
14
|
+
**Other options you tried**
|
|
15
|
+
For example, doing it by hand in Odoo, or another tool.
|
|
16
|
+
|
|
17
|
+
**Anything else**
|
|
18
|
+
Odoo version, the Odoo app (Sales, Invoicing, ...), screenshots with made-up data.
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
name: publish
|
|
2
|
+
|
|
3
|
+
# Publishes to PyPI when a GitHub release is published. Uses PyPI trusted publishing: no token is stored.
|
|
4
|
+
on:
|
|
5
|
+
release:
|
|
6
|
+
types: [published]
|
|
7
|
+
workflow_dispatch:
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
build:
|
|
11
|
+
runs-on: ubuntu-latest
|
|
12
|
+
permissions:
|
|
13
|
+
contents: read
|
|
14
|
+
steps:
|
|
15
|
+
- uses: actions/checkout@v4
|
|
16
|
+
- uses: astral-sh/setup-uv@v6
|
|
17
|
+
- run: uv build
|
|
18
|
+
- uses: actions/upload-artifact@v4
|
|
19
|
+
with:
|
|
20
|
+
name: dist
|
|
21
|
+
path: dist/
|
|
22
|
+
|
|
23
|
+
pypi:
|
|
24
|
+
needs: build
|
|
25
|
+
runs-on: ubuntu-latest
|
|
26
|
+
environment: pypi
|
|
27
|
+
permissions:
|
|
28
|
+
id-token: write
|
|
29
|
+
steps:
|
|
30
|
+
- uses: actions/download-artifact@v4
|
|
31
|
+
with:
|
|
32
|
+
name: dist
|
|
33
|
+
path: dist/
|
|
34
|
+
- uses: pypa/gh-action-pypi-publish@release/v1
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
name: tests
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
pull_request:
|
|
6
|
+
|
|
7
|
+
permissions:
|
|
8
|
+
contents: read
|
|
9
|
+
|
|
10
|
+
jobs:
|
|
11
|
+
offline:
|
|
12
|
+
runs-on: ubuntu-latest
|
|
13
|
+
timeout-minutes: 15
|
|
14
|
+
strategy:
|
|
15
|
+
fail-fast: false
|
|
16
|
+
matrix:
|
|
17
|
+
python-version: ["3.11", "3.12", "3.13"]
|
|
18
|
+
steps:
|
|
19
|
+
- uses: actions/checkout@v4
|
|
20
|
+
- uses: actions/setup-python@v5
|
|
21
|
+
with:
|
|
22
|
+
python-version: ${{ matrix.python-version }}
|
|
23
|
+
cache: pip
|
|
24
|
+
- run: pip install -e ".[dev]"
|
|
25
|
+
# The live-Odoo tests skip themselves here: they need a throwaway Odoo (see tests/test_live_odoo.py).
|
|
26
|
+
- run: python -m pytest -q
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
3.12
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project are listed here. The format follows
|
|
4
|
+
[Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and the project uses
|
|
5
|
+
[Semantic Versioning](https://semver.org/).
|
|
6
|
+
|
|
7
|
+
## [0.1.0] - 2026-12-05
|
|
8
|
+
|
|
9
|
+
The first public release. The server was first built for one company's own Odoo and used there every day
|
|
10
|
+
before it was made general for any company.
|
|
11
|
+
|
|
12
|
+
### Safety model
|
|
13
|
+
|
|
14
|
+
- Claude acts as the signed-in person, with that person's own Odoo API key, access rights and record rules.
|
|
15
|
+
- Read-only by default. Change tools appear only with `MCP_ACCESS_MODE=read_write`.
|
|
16
|
+
- Every change has a preview and an approval. The approval is a signed token for that exact change. It works
|
|
17
|
+
once, expires, and stops working if the records changed after the preview.
|
|
18
|
+
- Every model, field, choice value and record id is checked against the live Odoo database before anything is
|
|
19
|
+
sent, with "did you mean…?" hints.
|
|
20
|
+
- Almost nothing can be deleted: only never-numbered draft invoices and bills, cancelled quotations and archived
|
|
21
|
+
leads, checked with Odoo twice.
|
|
22
|
+
- Status fields cannot be written directly. Only real Odoo buttons can be pressed. Cancel, reset, archive and
|
|
23
|
+
e-mail buttons are off by default.
|
|
24
|
+
- Passwords, API keys, tokens and system settings are never readable. Protected areas (`ir.*`, security
|
|
25
|
+
settings, module installation) are blocked in code.
|
|
26
|
+
- Limits per approval, rate limits per person, and one Odoo request at a time for Odoo Online's fair-use policy.
|
|
27
|
+
|
|
28
|
+
### Features
|
|
29
|
+
|
|
30
|
+
- Search, read, count, look up by name and totals computed by Odoo, on every installed app.
|
|
31
|
+
- Odoo's official accounting reports: P&L, balance sheet, trial balance, ledgers, ageing and the tax report.
|
|
32
|
+
- Create and update records (with order lines), press workflow buttons, fill in Odoo dialogs, log notes, change
|
|
33
|
+
followers, and send chatter messages and quotation e-mails (when switched on).
|
|
34
|
+
- Bank matching like Odoo's bank screen: in the company currency or another currency, all or part of an item,
|
|
35
|
+
adding to a partly matched line, and undoing a match.
|
|
36
|
+
- Move the tax return lock date forward, and correct a posted vendor bill step by step.
|
|
37
|
+
- Read files that are already in Odoo (PDF text included), and move files onto the right record.
|
|
38
|
+
- Upload links: a private one-hour page where a person uploads files from their computer into Odoo.
|
|
39
|
+
- Custom fields: add a field (named `x_mcp_…`), place it on a form with a "show only when" rule, and remove both.
|
|
40
|
+
- `odoo_help`: per area of Odoo, what Claude can and cannot do, and the steps a person can take themselves.
|
|
41
|
+
- Compact answers (tables, record links) to keep Claude's context small.
|
|
42
|
+
|
|
43
|
+
### Running it
|
|
44
|
+
|
|
45
|
+
- Local mode for one person over stdio: `uvx odoo-preview-mcp`.
|
|
46
|
+
- Company mode over HTTP with OAuth sign-in per person, on Docker or on Vercel with Redis.
|
|
47
|
+
- `odoo-preview-mcp check` tests the connection; `odoo-preview-mcp usage` shows a 30-day usage report.
|
|
48
|
+
- Odoo 19+ through JSON-2, older Odoo through the legacy JSON-RPC API, detected on its own.
|
|
49
|
+
- About 2,300 offline tests, plus live tests against a throwaway Odoo.
|
|
50
|
+
|
|
51
|
+
[0.1.0]: https://github.com/Sahajta-AI/odoo-preview-mcp/releases/tag/v0.1.0
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
# Contributing
|
|
2
|
+
|
|
3
|
+
Thank you for helping. This project connects an AI to a company's real accounting and sales data, so safety
|
|
4
|
+
comes first in every change.
|
|
5
|
+
|
|
6
|
+
## Before you start
|
|
7
|
+
|
|
8
|
+
- For a bug, open an issue with the steps to repeat it.
|
|
9
|
+
- For a new feature or a large change, open an issue first. Explain the problem it solves. We agree on the
|
|
10
|
+
approach before you write the code.
|
|
11
|
+
- For a security problem, do not open an issue. Follow [SECURITY.md](SECURITY.md).
|
|
12
|
+
|
|
13
|
+
## Set up
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
git clone https://github.com/Sahajta-AI/odoo-preview-mcp && cd odoo-preview-mcp
|
|
17
|
+
uv venv && uv pip install -e ".[dev]"
|
|
18
|
+
.venv/bin/pytest
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
The offline tests need no Odoo. The live tests (`pytest -m integration`) need a throwaway Odoo with demo data.
|
|
22
|
+
See the top of `tests/test_live_odoo.py`. Never run them against a production database.
|
|
23
|
+
|
|
24
|
+
## Rules for a change
|
|
25
|
+
|
|
26
|
+
1. **Keep the safety guarantees.** Every change must keep a preview and an approval. Do not add a generic
|
|
27
|
+
delete, a way to write status fields directly, or a way to read secrets. A change that weakens a guarantee
|
|
28
|
+
in the README will not be merged.
|
|
29
|
+
2. **Add tests.** New behaviour needs a test. A bug fix needs a test that fails before the fix.
|
|
30
|
+
3. **Run the full test suite** before you open a pull request: `.venv/bin/pytest`. It must pass.
|
|
31
|
+
4. **Use made-up data.** Do not put real customer names, amounts, record ids, e-mail addresses, API keys or
|
|
32
|
+
company names in code, tests, docs or issues. Use `example.com` addresses and invented names.
|
|
33
|
+
5. **Write plain messages.** Text that people see (refusals, previews, the guide) must be short and clear for a
|
|
34
|
+
non-technical person. Say what happened and what they can do next.
|
|
35
|
+
6. **Keep the change small.** One problem per pull request. Do not add options or layers that nobody asked for.
|
|
36
|
+
|
|
37
|
+
## Pull requests
|
|
38
|
+
|
|
39
|
+
- Describe the problem, the change, and how you tested it.
|
|
40
|
+
- Update `CHANGELOG.md` under an "Unreleased" heading.
|
|
41
|
+
- The CI workflow runs the tests on every push and pull request. It must be green before a merge.
|
|
42
|
+
|
|
43
|
+
## Licence
|
|
44
|
+
|
|
45
|
+
By contributing, you agree that your contribution is licensed under the
|
|
46
|
+
[Apache License 2.0](LICENSE), the licence of this project.
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# odoo-preview-mcp: company-wide Claude connector for Odoo.
|
|
2
|
+
FROM python:3.13-slim AS build
|
|
3
|
+
WORKDIR /src
|
|
4
|
+
COPY pyproject.toml README.md LICENSE ./
|
|
5
|
+
COPY src ./src
|
|
6
|
+
RUN pip install --no-cache-dir --upgrade pip \
|
|
7
|
+
&& pip wheel --no-cache-dir --wheel-dir /wheels .
|
|
8
|
+
|
|
9
|
+
FROM python:3.13-slim
|
|
10
|
+
ENV PYTHONDONTWRITEBYTECODE=1 PYTHONUNBUFFERED=1 \
|
|
11
|
+
MCP_HOST=0.0.0.0 MCP_PORT=8000 MCP_DATA_DIR=/data
|
|
12
|
+
RUN useradd --system --uid 10001 --home /nonexistent --shell /usr/sbin/nologin mcp \
|
|
13
|
+
&& mkdir -p /data && chown mcp /data && chmod 700 /data
|
|
14
|
+
COPY --from=build /wheels /wheels
|
|
15
|
+
RUN pip install --no-cache-dir /wheels/* && rm -rf /wheels
|
|
16
|
+
USER mcp
|
|
17
|
+
VOLUME ["/data"]
|
|
18
|
+
EXPOSE 8000
|
|
19
|
+
HEALTHCHECK --interval=30s --timeout=5s --start-period=10s \
|
|
20
|
+
CMD python -c "import urllib.request,sys; sys.exit(0 if urllib.request.urlopen('http://127.0.0.1:8000/healthz', timeout=4).status == 200 else 1)"
|
|
21
|
+
CMD ["odoo-preview-mcp", "http"]
|
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
Copyright 2026 Sahajta AI Solution Private Limited
|
|
179
|
+
|
|
180
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
181
|
+
you may not use this file except in compliance with the License.
|
|
182
|
+
You may obtain a copy of the License at
|
|
183
|
+
|
|
184
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
185
|
+
|
|
186
|
+
Unless required by applicable law or agreed to in writing, software
|
|
187
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
188
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
189
|
+
See the License for the specific language governing permissions and
|
|
190
|
+
limitations under the License.
|