Skip to main content
Glama
server.ts2.52 kB
import express from 'express'; import dotenv from 'dotenv'; import { OdooService } from './odooService'; dotenv.config(); const app = express(); app.use(express.json()); const config = { url: process.env.URL_ODOO || 'https://app.x-or.cloud', port: parseInt(process.env.PORT_ODOO || '443', 10), db: process.env.DBNAME_ODOO || 'XOR2', username: process.env.USERNAME_ODOO || 'dev@x-or.pro', password: process.env.PASSWORD_ODOO || '64c1313205a7484674dec05c8939a50b21541abb', }; const svc = new OdooService(config); app.get('/mcp/leads', async (req, res) => { const domain = req.query.domain ? JSON.parse(String(req.query.domain)) : []; const fields = req.query.fields ? JSON.parse(String(req.query.fields)) : ['id', 'name', 'email_from', 'phone']; const limit = req.query.limit ? parseInt(String(req.query.limit), 10) : 50; const offset = req.query.offset ? parseInt(String(req.query.offset), 10) : 0; try { const rows = await svc.queryLeads(domain, fields, limit, offset); res.json(rows); } catch (err: any) { res.status(500).json({ error: err.message || err }); } }); app.get('/mcp/customers', async (req, res) => { const domain = req.query.domain ? JSON.parse(String(req.query.domain)) : [['customer_rank', '>', 0]]; const fields = req.query.fields ? JSON.parse(String(req.query.fields)) : ['id', 'name', 'email', 'phone']; const limit = req.query.limit ? parseInt(String(req.query.limit), 10) : 50; const offset = req.query.offset ? parseInt(String(req.query.offset), 10) : 0; try { const rows = await svc.queryCustomers(domain, fields, limit, offset); res.json(rows); } catch (err: any) { res.status(500).json({ error: err.message || err }); } }); app.get('/mcp/activities', async (req, res) => { const domain = req.query.domain ? JSON.parse(String(req.query.domain)) : []; const fields = req.query.fields ? JSON.parse(String(req.query.fields)) : ['id', 'res_id', 'res_model', 'summary', 'date_deadline', 'user_id']; const limit = req.query.limit ? parseInt(String(req.query.limit), 10) : 50; const offset = req.query.offset ? parseInt(String(req.query.offset), 10) : 0; try { const rows = await svc.queryActivities(domain, fields, limit, offset); res.json(rows); } catch (err: any) { res.status(500).json({ error: err.message || err }); } }); const PORT = process.env.MCP_PORT ? parseInt(process.env.MCP_PORT, 10) : 3000; app.listen(PORT, () => { console.log(`MCP server listening on http://localhost:${PORT}`); });

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/TungND2k2/MCP-Odoo'

If you have feedback or need assistance with the MCP directory API, please join our Discord server