33[ ![ codecov] ( https://codecov.io/gh/christopher-igweze/python-odoo-mcp/branch/main/graph/badge.svg )] ( https://codecov.io/gh/christopher-igweze/python-odoo-mcp )
44[ ![ Tests] ( https://github.com/christopher-igweze/python-odoo-mcp/workflows/Tests/badge.svg )] ( https://github.com/christopher-igweze/python-odoo-mcp/actions )
55
6- Multi-tenant Odoo XML-RPC MCP server with scope-based access control, connection pooling, and HTTP Stream transport .
6+ HTTP REST API for Odoo automation with encrypted API keys, multi-tenant scope isolation, and connection pooling. Built for n8n, webhooks, and custom integrations .
77
88** Repository:** https://github.com/christopher-igweze/python-odoo-mcp
99
10+ ## Features
11+
12+ ✅ ** Multi-tenant** - Different users, different Odoo instances, same server
13+ ✅ ** Scope-based access control** - Fine-grained R/W/D permissions per model
14+ ✅ ** Encrypted API keys** - Fernet encryption for secure key storage
15+ ✅ ** Connection pooling** - Caches authenticated sessions with TTL
16+ ✅ ** n8n ready** - Drop-in HTTP integration for automation workflows
17+ ✅ ** Complete CRUD** - Search, read, create, write, delete any Odoo model
18+ ✅ ** Error handling** - Clear permission, auth, and connection errors
19+ ✅ ** Async support** - Full async/await for high concurrency
20+
1021## Quick Start
1122
1223### Local Development
@@ -129,38 +140,26 @@ Permissions:
129140
130141## Architecture
131142
143+ ** Request Flow:**
144+
132145```
133- ┌─ n8n ─────────────────────────────────┐
134- │ HTTP Request with X-Auth-Credentials │
135- └────────────┬────────────────────────────┘
136- │ (base64 JSON with credentials + scope)
137- ▼
138- ┌─ Python Odoo MCP ─────────────────────┐
139- │ ┌──────────────────────────────────┐ │
140- │ │ Authentication & Scope Validator │ │
141- │ └──────────┬───────────────────────┘ │
142- │ │ │
143- │ ┌──────────▼───────────────────────┐ │
144- │ │ Connection Pool (Scope-Aware) │ │
145- │ │ Caches connections per user+scope│ │
146- │ └──────────┬───────────────────────┘ │
147- │ │ │
148- │ ┌──────────▼───────────────────────┐ │
149- │ │ Odoo Client │ │
150- │ │ - Validates scope before every op│ │
151- │ │ - Uses pooled connections │ │
152- │ └──────────┬───────────────────────┘ │
153- │ │ │
154- │ ┌──────────▼───────────────────────┐ │
155- │ │ Tools (search, read, write, etc) │ │
156- │ │ Execute on Odoo via XML-RPC │ │
157- │ └──────────────────────────────────┘ │
158- └─────────────────────────────────────────┘
159- │
160- ▼ (XML-RPC)
161- Odoo Instance
146+ HTTP Request (X-API-Key header)
147+ ↓
148+ Authentication & Scope Validation
149+ ↓
150+ Connection Pool (scope-aware caching)
151+ ↓
152+ Odoo Client (validates permissions, executes operations)
153+ ↓
154+ Odoo Instance (XML-RPC)
162155```
163156
157+ ** Key Components:**
158+ - ** HTTP Server** - FastAPI REST API on port 3000
159+ - ** Connection Pool** - Caches authenticated Odoo sessions with TTL and scope isolation
160+ - ** Scope Validator** - Enforces R/W/D permissions per model
161+ - ** Odoo Client** - XML-RPC wrapper with automatic connection pooling
162+
164163## Environment Variables
165164
166165``` bash
@@ -191,134 +190,12 @@ PORT=3000
1911906 . Get public URL from Coolify
1921917 . Use in n8n: ` https://your-mcp-xxx.coolify.io/tools/call `
193192
194- ## Testing
195-
196- ### Unit and Integration Tests
193+ ## Testing & Development
197194
198- The project includes comprehensive unit and integration tests using pytest:
199-
200- ``` bash
201- # Run all tests
202- pytest tests/
203-
204- # Run with coverage report
205- pytest tests/ --cov=src --cov-report=html --cov-report=term-missing
206-
207- # Run specific test file
208- pytest tests/unit/test_encryption.py -v
209-
210- # Run tests matching pattern
211- pytest -k " scope_validator" -v
212-
213- # Run with markers
214- pytest -m unit # Unit tests only
215- pytest -m integration # Integration tests only
216- pytest -m slow # Slow/e2e tests
217- ```
218-
219- ### Test Structure
220-
221- ```
222- tests/
223- ├── unit/ # Unit tests (no external dependencies)
224- │ ├── test_config.py # Config management & encryption key validation
225- │ ├── test_encryption.py # Credential encryption/decryption
226- │ └── test_scope_validator.py # Scope parsing and permission checking
227- ├── integration/ # Integration tests (with app instance)
228- │ ├── test_auth_endpoints.py # /auth/generate and /auth/validate
229- │ ├── test_health.py # Health check endpoints
230- │ └── test_tools_endpoints.py # /tools/list and /tools/call
231- └── conftest.py # Shared pytest fixtures
232- ```
233-
234- ### Health Check
235-
236- ``` bash
237- curl http://localhost:3000/health
238- ```
239-
240- ### List Tools
241-
242- ``` bash
243- curl -X POST http://localhost:3000/tools/list
244- ```
245-
246- ### Test with Script
247-
248- ``` bash
249- ./test_server.sh
250- ```
251-
252- ### Test in n8n
253-
254- Import ` test_n8n.json ` workflow for examples.
255-
256- ### Coverage Goals
257-
258- Current coverage: 46% (61 tests passing)
259- - ** High coverage:** Authentication, encryption, scope validation (89%), connection pool management
260- - ** Low coverage:** Tool implementations, Odoo client methods (require live Odoo instance)
261-
262- To improve coverage:
263- 1 . Run tests against real Odoo instance (see Phase 8 in development history)
264- 2 . Mock Odoo responses in unit tests
265- 3 . Use testcontainers for Odoo in CI/CD
266-
267- ### Coverage Monitoring with Codecov
268-
269- This project uses [ Codecov] ( https://codecov.io/ ) for continuous coverage tracking and reporting.
270-
271- ** Coverage Tracking:**
272- - View detailed coverage dashboard: https://codecov.io/gh/christopher-igweze/python-odoo-mcp
273- - Coverage reports generated automatically on every push via GitHub Actions
274- - Pull requests show coverage impact (lines added/removed/changed)
275- - Coverage history graphs track improvements over time
276-
277- ** Current Status:**
278- - Overall coverage: 46% (target: 75%+)
279- - Authentication & encryption: 89% ✅
280- - Scope validation: 89% ✅
281- - Tools & Odoo client: 15-29% (improving with mocked tests)
282-
283- ** Understanding Coverage Reports:**
284- 1 . ** Line Coverage** - Percentage of source code lines executed during tests
285- 2 . ** Branch Coverage** - All code paths (if/else) tested
286- 3 . ** Uncovered Lines** - Listed with file paths for targeting improvement
287- 4 . ** Trending** - See if coverage increases or decreases with each commit
288-
289- ** Local Coverage Reports:**
290-
291- Generate and view HTML coverage reports locally:
292-
293- ``` bash
294- # Run tests with coverage
295- pytest tests/ --cov=src --cov-report=html --cov-report=term-missing
296-
297- # View in browser
298- open htmlcov/index.html # macOS
299- # or
300- xdg-open htmlcov/index.html # Linux
301- ```
302-
303- ** For Contributors:**
304-
305- When implementing new features:
306- 1 . Write tests alongside implementation
307- 2 . Aim for 80%+ coverage on new code
308- 3 . Run ` pytest ` to see coverage before pushing
309- 4 . Codecov will comment on PRs showing impact
310- 5 . Target overall coverage of 75%+
311-
312- ## Features
313-
314- ✅ ** Multi-tenant** - Different users, different Odoo instances, same server
315- ✅ ** Scope-based access control** - Fine-grained R/W/D permissions per model
316- ✅ ** Connection pooling** - Caches authenticated sessions, scope-aware
317- ✅ ** HTTP Stream MCP** - Works with n8n's official MCP node
318- ✅ ** Stateless** - Each request is self-contained
319- ✅ ** Error handling** - Clear permission errors, auth errors, connection errors
320- ✅ ** Thread-safe** - RLock for pool access
321- ✅ ** Async** - Full async/await support
195+ See [ CONTRIBUTING.md] ( CONTRIBUTING.md ) for:
196+ - Running tests with pytest
197+ - Test coverage information
198+ - Development workflow and micro-commits
322199
323200## Error Handling
324201
@@ -331,25 +208,22 @@ All errors return `{"error": "...", "status": "..."}`:
331208- ` tool_not_found ` - Unknown tool name
332209- ` odoo_error ` - Odoo RPC error
333210
334- ## Development
211+ ## Note: REST API vs MCP Protocol
335212
336- Micro-commit workflow with glassbear format :
213+ This project exposes ** MCP-style tools via HTTP REST API ** , which is different from the official MCP protocol :
337214
338- ``` bash
339- # Read the requirements
340- cat requirements.txt
215+ - ** This server:** REST API with HTTP endpoints (` /tools/list ` , ` /tools/call ` )
216+ - ** Official MCP protocol:** Used by Claude Desktop, Cursor, and other AI assistants via stdio or websockets
341217
342- # Make a change, test it
343- # Then commit
344- git commit -m " 🔧 fix(scope): handle wildcard override"
345- git push origin main
346- ```
218+ For AI assistant integration, see the excellent [ ivnvxd/mcp-server-odoo] ( https://github.com/ivnvxd/mcp-server-odoo ) which uses true MCP protocol.
347219
348- See ` .git/logs ` for commit history .
220+ This REST API approach is ideal for ** n8n, webhooks, and automation platforms ** where HTTP is more practical .
349221
350222## License
351223
352- This project is open source.
224+ MIT License - see [ LICENSE] ( LICENSE ) for details.
225+
226+ This means you can freely use, modify, and distribute this software as long as you include the license notice.
353227
354228## Support
355229
0 commit comments