@backendkit-labs/mcp-connectors 0.1.3 → 0.1.4
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.
- package/dist/ai-vault/server.d.ts +0 -32
- package/dist/ai-vault/server.d.ts.map +1 -1
- package/dist/ai-vault/server.js +2 -163
- package/dist/ai-vault/server.js.map +1 -1
- package/dist/ai-vault/tools.d.ts +35 -0
- package/dist/ai-vault/tools.d.ts.map +1 -0
- package/dist/ai-vault/tools.js +166 -0
- package/dist/ai-vault/tools.js.map +1 -0
- package/dist/gcal/server.js +2 -146
- package/dist/gcal/server.js.map +1 -1
- package/dist/gcal/tools.d.ts +3 -0
- package/dist/gcal/tools.d.ts.map +1 -0
- package/dist/gcal/tools.js +149 -0
- package/dist/gcal/tools.js.map +1 -0
- package/dist/hubspot/server.js +3 -115
- package/dist/hubspot/server.js.map +1 -1
- package/dist/hubspot/tools.d.ts +3 -0
- package/dist/hubspot/tools.d.ts.map +1 -0
- package/dist/hubspot/tools.js +117 -0
- package/dist/hubspot/tools.js.map +1 -0
- package/dist/jira/server.js +3 -112
- package/dist/jira/server.js.map +1 -1
- package/dist/jira/tools.d.ts +3 -0
- package/dist/jira/tools.d.ts.map +1 -0
- package/dist/jira/tools.js +114 -0
- package/dist/jira/tools.js.map +1 -0
- package/dist/odoo/server.js +2 -158
- package/dist/odoo/server.js.map +1 -1
- package/dist/odoo/tools.d.ts +3 -0
- package/dist/odoo/tools.d.ts.map +1 -0
- package/dist/odoo/tools.js +161 -0
- package/dist/odoo/tools.js.map +1 -0
- package/dist/shared/http-client.d.ts.map +1 -1
- package/dist/shared/http-client.js +7 -3
- package/dist/shared/http-client.js.map +1 -1
- package/dist/shared/server-runner.d.ts +11 -1
- package/dist/shared/server-runner.d.ts.map +1 -1
- package/dist/shared/server-runner.js +51 -8
- package/dist/shared/server-runner.js.map +1 -1
- package/package.json +22 -11
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.buildServer = buildServer;
|
|
4
|
+
const mcp_js_1 = require("@modelcontextprotocol/sdk/server/mcp.js");
|
|
5
|
+
const zod_1 = require("zod");
|
|
6
|
+
const http_client_js_1 = require("../shared/http-client.js");
|
|
7
|
+
// ── Auth ──────────────────────────────────────────────────────────────────────
|
|
8
|
+
const HOST = process.env.JIRA_HOST; // e.g. mycompany.atlassian.net
|
|
9
|
+
const EMAIL = process.env.JIRA_EMAIL;
|
|
10
|
+
const TOKEN = process.env.JIRA_TOKEN; // Jira API token (not password)
|
|
11
|
+
const BASE = `https://${HOST}/rest/api/3`;
|
|
12
|
+
const AUTH = Buffer.from(`${EMAIL}:${TOKEN}`).toString('base64');
|
|
13
|
+
async function jira(method, path, body) {
|
|
14
|
+
return (0, http_client_js_1.fetchJson)('Jira', `${BASE}${path}`, {
|
|
15
|
+
method,
|
|
16
|
+
headers: {
|
|
17
|
+
'Authorization': `Basic ${AUTH}`,
|
|
18
|
+
'Content-Type': 'application/json',
|
|
19
|
+
'Accept': 'application/json',
|
|
20
|
+
},
|
|
21
|
+
body: body !== undefined ? JSON.stringify(body) : undefined,
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
function adfText(node) {
|
|
25
|
+
if (!node)
|
|
26
|
+
return '';
|
|
27
|
+
if (node.text)
|
|
28
|
+
return node.text;
|
|
29
|
+
if (!node.content)
|
|
30
|
+
return '';
|
|
31
|
+
const sep = node.type === 'paragraph' || node.type === 'doc' ? '\n' : '';
|
|
32
|
+
return node.content.map(adfText).join(sep);
|
|
33
|
+
}
|
|
34
|
+
function adfDoc(text) {
|
|
35
|
+
return {
|
|
36
|
+
type: 'doc', version: 1,
|
|
37
|
+
content: [{ type: 'paragraph', content: [{ type: 'text', text }] }],
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
// ── Tools ─────────────────────────────────────────────────────────────────────
|
|
41
|
+
function buildServer() {
|
|
42
|
+
const srv = new mcp_js_1.McpServer({ name: 'bk-mcp-jira', version: '0.1.0' });
|
|
43
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
44
|
+
const t = srv.tool.bind(srv);
|
|
45
|
+
t('jira_search', 'Search Jira issues using JQL (Jira Query Language). Returns key, summary, status, and assignee.', {
|
|
46
|
+
jql: zod_1.z.string().describe('JQL query (e.g. "project=PROJ AND status=\\"In Progress\\"")'),
|
|
47
|
+
limit: zod_1.z.number().min(1).max(100).optional().describe('Max results (default 20, max 100)'),
|
|
48
|
+
}, async ({ jql, limit }) => {
|
|
49
|
+
const data = await jira('GET', `/search?jql=${encodeURIComponent(jql)}&maxResults=${limit ?? 20}&fields=summary,status,assignee,priority`);
|
|
50
|
+
const lines = data.issues.map(i => {
|
|
51
|
+
const f = i.fields;
|
|
52
|
+
return `${i.key} [${f.status.name}] ${f.priority?.name ?? '-'} ${f.summary} @${f.assignee?.displayName ?? 'unassigned'}`;
|
|
53
|
+
});
|
|
54
|
+
return {
|
|
55
|
+
content: [{ type: 'text', text: lines.length ? lines.join('\n') : 'No issues found.' }],
|
|
56
|
+
};
|
|
57
|
+
});
|
|
58
|
+
t('jira_get_issue', 'Get full details for a Jira issue including description and recent comments.', {
|
|
59
|
+
key: zod_1.z.string().describe('Jira issue key (e.g. PROJ-123)'),
|
|
60
|
+
}, async ({ key }) => {
|
|
61
|
+
const data = await jira('GET', `/issue/${key}?fields=summary,status,assignee,description,comment`);
|
|
62
|
+
const f = data.fields;
|
|
63
|
+
const desc = adfText(f.description);
|
|
64
|
+
const comments = f.comment.comments.slice(-3).map(c => ` [${c.author.displayName} · ${c.created.slice(0, 10)}]: ${adfText(c.body)}`);
|
|
65
|
+
const parts = [
|
|
66
|
+
`${key}: ${f.summary}`,
|
|
67
|
+
`Status: ${f.status.name} Assignee: ${f.assignee?.displayName ?? 'unassigned'}`,
|
|
68
|
+
desc ? `\nDescription:\n${desc}` : '',
|
|
69
|
+
comments.length ? `\nComments (last ${comments.length}):\n${comments.join('\n')}` : '',
|
|
70
|
+
].filter(Boolean);
|
|
71
|
+
return { content: [{ type: 'text', text: parts.join('\n') }] };
|
|
72
|
+
});
|
|
73
|
+
t('jira_create_issue', 'Create a new Jira issue.', {
|
|
74
|
+
project: zod_1.z.string().describe('Project key (e.g. PROJ)'),
|
|
75
|
+
summary: zod_1.z.string().describe('Issue title/summary'),
|
|
76
|
+
description: zod_1.z.string().optional().describe('Issue description (plain text)'),
|
|
77
|
+
issue_type: zod_1.z.string().optional().describe('Issue type (e.g. Task, Bug, Story). Default: Task'),
|
|
78
|
+
priority: zod_1.z.string().optional().describe('Priority (e.g. High, Medium, Low)'),
|
|
79
|
+
}, async ({ project, summary, description, issue_type, priority }) => {
|
|
80
|
+
const fields = {
|
|
81
|
+
project: { key: project },
|
|
82
|
+
summary,
|
|
83
|
+
issuetype: { name: issue_type ?? 'Task' },
|
|
84
|
+
};
|
|
85
|
+
if (description)
|
|
86
|
+
fields.description = adfDoc(description);
|
|
87
|
+
if (priority)
|
|
88
|
+
fields.priority = { name: priority };
|
|
89
|
+
const data = await jira('POST', '/issue', { fields });
|
|
90
|
+
return { content: [{ type: 'text', text: `Created ${data.key} (ID: ${data.id})` }] };
|
|
91
|
+
});
|
|
92
|
+
t('jira_add_comment', 'Add a comment to a Jira issue.', {
|
|
93
|
+
key: zod_1.z.string().describe('Issue key (e.g. PROJ-123)'),
|
|
94
|
+
body: zod_1.z.string().describe('Comment text'),
|
|
95
|
+
}, async ({ key, body }) => {
|
|
96
|
+
await jira('POST', `/issue/${key}/comment`, { body: adfDoc(body) });
|
|
97
|
+
return { content: [{ type: 'text', text: `Comment added to ${key}.` }] };
|
|
98
|
+
});
|
|
99
|
+
t('jira_transition', 'Move a Jira issue to a new status (e.g. "In Progress", "Done").', {
|
|
100
|
+
key: zod_1.z.string().describe('Issue key (e.g. PROJ-123)'),
|
|
101
|
+
status: zod_1.z.string().describe('Target status name (e.g. Done, In Progress, To Do)'),
|
|
102
|
+
}, async ({ key, status }) => {
|
|
103
|
+
const { transitions } = await jira('GET', `/issue/${key}/transitions`);
|
|
104
|
+
const match = transitions.find(t => t.name.toLowerCase() === status.toLowerCase());
|
|
105
|
+
if (!match) {
|
|
106
|
+
const available = transitions.map(t => t.name).join(', ');
|
|
107
|
+
throw new Error(`Status "${status}" not available for ${key}. Options: ${available}`);
|
|
108
|
+
}
|
|
109
|
+
await jira('POST', `/issue/${key}/transitions`, { transition: { id: match.id } });
|
|
110
|
+
return { content: [{ type: 'text', text: `${key} → "${match.name}"` }] };
|
|
111
|
+
});
|
|
112
|
+
return srv;
|
|
113
|
+
}
|
|
114
|
+
//# sourceMappingURL=tools.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tools.js","sourceRoot":"","sources":["../../src/jira/tools.ts"],"names":[],"mappings":";;AA2CA,kCA+HC;AA1KD,oEAAoE;AACpE,6BAAwB;AACxB,6DAAqD;AAErD,iFAAiF;AAEjF,MAAM,IAAI,GAAI,OAAO,CAAC,GAAG,CAAC,SAAS,CAAC,CAAG,+BAA+B;AACtE,MAAM,KAAK,GAAG,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC;AACrC,MAAM,KAAK,GAAG,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,CAAE,gCAAgC;AAEvE,MAAM,IAAI,GAAG,WAAW,IAAI,aAAa,CAAC;AAC1C,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,GAAG,KAAK,IAAI,KAAK,EAAE,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;AAEjE,KAAK,UAAU,IAAI,CAAI,MAAc,EAAE,IAAY,EAAE,IAAc;IAC/D,OAAO,IAAA,0BAAS,EAAI,MAAM,EAAE,GAAG,IAAI,GAAG,IAAI,EAAE,EAAE;QAC1C,MAAM;QACN,OAAO,EAAE;YACL,eAAe,EAAE,SAAS,IAAI,EAAE;YAChC,cAAc,EAAE,kBAAkB;YAClC,QAAQ,EAAE,k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AK,CAAC,IAAI,GAAG,EAAE,CAAC,EAAE,CAAC;IACtF,CAAC,CACJ,CAAC;IAEF,OAAO,GAAG,CAAC;AACf,CAAC"}
|
package/dist/odoo/server.js
CHANGED
|
@@ -1,167 +1,11 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
"use strict";
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
const mcp_js_1 = require("@modelcontextprotocol/sdk/server/mcp.js");
|
|
5
|
-
const zod_1 = require("zod");
|
|
6
4
|
const server_runner_js_1 = require("../shared/server-runner.js");
|
|
7
|
-
const
|
|
8
|
-
let _session = null;
|
|
9
|
-
// Dedupe concurrent first-calls so two simultaneous tool invocations don't
|
|
10
|
-
// both hit /web/session/authenticate before either has cached a session.
|
|
11
|
-
let _authInFlight = null;
|
|
12
|
-
function cfg() {
|
|
13
|
-
const url = process.env.ODOO_URL?.replace(/\/$/, '');
|
|
14
|
-
const db = process.env.ODOO_DB;
|
|
15
|
-
const user = process.env.ODOO_USER;
|
|
16
|
-
const pass = process.env.ODOO_PASSWORD;
|
|
17
|
-
if (!url || !db || !user || !pass) {
|
|
18
|
-
throw new Error('Set ODOO_URL, ODOO_DB, ODOO_USER, ODOO_PASSWORD');
|
|
19
|
-
}
|
|
20
|
-
return { url, db, user, pass };
|
|
21
|
-
}
|
|
22
|
-
async function doAuthenticate() {
|
|
23
|
-
const { url, db, user, pass } = cfg();
|
|
24
|
-
const data = await (0, http_client_js_1.fetchJson)('Odoo', `${url}/web/session/authenticate`, {
|
|
25
|
-
method: 'POST',
|
|
26
|
-
headers: { 'Content-Type': 'application/json' },
|
|
27
|
-
body: JSON.stringify({
|
|
28
|
-
jsonrpc: '2.0', method: 'call', id: 1,
|
|
29
|
-
params: { db, login: user, password: pass },
|
|
30
|
-
}),
|
|
31
|
-
});
|
|
32
|
-
if (data.error)
|
|
33
|
-
throw new Error(`Odoo auth error: ${data.error.message}`);
|
|
34
|
-
if (!data.result?.uid)
|
|
35
|
-
throw new Error('Odoo auth failed — no uid returned (wrong credentials?)');
|
|
36
|
-
_session = { uid: data.result.uid, sessionId: data.result.session_id };
|
|
37
|
-
return _session;
|
|
38
|
-
}
|
|
39
|
-
async function authenticate() {
|
|
40
|
-
if (_session)
|
|
41
|
-
return _session;
|
|
42
|
-
if (!_authInFlight) {
|
|
43
|
-
_authInFlight = doAuthenticate().finally(() => { _authInFlight = null; });
|
|
44
|
-
}
|
|
45
|
-
return _authInFlight;
|
|
46
|
-
}
|
|
47
|
-
/** Odoo returns HTTP 200 with a JSON-RPC error when the cached session has expired server-side. */
|
|
48
|
-
function isSessionExpiredError(error) {
|
|
49
|
-
if (!error)
|
|
50
|
-
return false;
|
|
51
|
-
if (error.code === 100)
|
|
52
|
-
return true; // Odoo's "Session Expired" error code
|
|
53
|
-
return /session\s*expired/i.test(error.message ?? '');
|
|
54
|
-
}
|
|
55
|
-
async function odooCall(model, method, args, kwargs = {}, _retriedAfterReauth = false) {
|
|
56
|
-
const sess = await authenticate();
|
|
57
|
-
const { url } = cfg();
|
|
58
|
-
const data = await (0, http_client_js_1.fetchJson)('Odoo', `${url}/web/dataset/call_kw`, {
|
|
59
|
-
method: 'POST',
|
|
60
|
-
headers: {
|
|
61
|
-
'Content-Type': 'application/json',
|
|
62
|
-
'Cookie': `session_id=${sess.sessionId}`,
|
|
63
|
-
},
|
|
64
|
-
body: JSON.stringify({
|
|
65
|
-
jsonrpc: '2.0', method: 'call', id: Date.now(),
|
|
66
|
-
params: { model, method, args, kwargs },
|
|
67
|
-
}),
|
|
68
|
-
});
|
|
69
|
-
if (data.error) {
|
|
70
|
-
if (!_retriedAfterReauth && isSessionExpiredError(data.error)) {
|
|
71
|
-
_session = null;
|
|
72
|
-
return odooCall(model, method, args, kwargs, true);
|
|
73
|
-
}
|
|
74
|
-
throw new Error(`Odoo ${model}.${method}: ${data.error.data?.message ?? data.error.message}`);
|
|
75
|
-
}
|
|
76
|
-
return data.result;
|
|
77
|
-
}
|
|
78
|
-
// ── Tools ─────────────────────────────────────────────────────────────────────
|
|
79
|
-
function buildServer() {
|
|
80
|
-
const srv = new mcp_js_1.McpServer({ name: 'bk-mcp-odoo', version: '0.1.0' });
|
|
81
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
82
|
-
const t = srv.tool.bind(srv);
|
|
83
|
-
t('odoo_employee_create', 'Create a new employee record in Odoo HR.', {
|
|
84
|
-
name: zod_1.z.string().describe('Full name'),
|
|
85
|
-
work_email: zod_1.z.string().email().optional().describe('Work email address'),
|
|
86
|
-
job_title: zod_1.z.string().optional().describe('Job title'),
|
|
87
|
-
department: zod_1.z.string().optional().describe('Department name (partial match)'),
|
|
88
|
-
}, async ({ name, work_email, job_title, department }) => {
|
|
89
|
-
const vals = { name };
|
|
90
|
-
if (work_email)
|
|
91
|
-
vals.work_email = work_email;
|
|
92
|
-
if (job_title)
|
|
93
|
-
vals.job_title = job_title;
|
|
94
|
-
if (department) {
|
|
95
|
-
const ids = await odooCall('hr.department', 'search', [[['name', 'ilike', department]]]);
|
|
96
|
-
if (ids.length)
|
|
97
|
-
vals.department_id = ids[0];
|
|
98
|
-
}
|
|
99
|
-
const id = await odooCall('hr.employee', 'create', [vals]);
|
|
100
|
-
return { content: [{ type: 'text', text: `Employee created. Odoo ID: ${id}` }] };
|
|
101
|
-
});
|
|
102
|
-
t('odoo_employee_get', 'Retrieve employee records from Odoo by ID or name search.', {
|
|
103
|
-
employee_id: zod_1.z.number().optional().describe('Exact employee ID'),
|
|
104
|
-
name: zod_1.z.string().optional().describe('Name filter (partial match)'),
|
|
105
|
-
limit: zod_1.z.number().min(1).max(100).optional().describe('Maximum records to return (default 5, max 100)'),
|
|
106
|
-
}, async ({ employee_id, name, limit }) => {
|
|
107
|
-
let domain;
|
|
108
|
-
if (employee_id !== undefined) {
|
|
109
|
-
domain = [['id', '=', employee_id]];
|
|
110
|
-
}
|
|
111
|
-
else if (name) {
|
|
112
|
-
domain = [['name', 'ilike', name]];
|
|
113
|
-
}
|
|
114
|
-
else {
|
|
115
|
-
domain = [['active', '=', true]];
|
|
116
|
-
}
|
|
117
|
-
const records = await odooCall('hr.employee', 'search_read', [], {
|
|
118
|
-
domain,
|
|
119
|
-
fields: ['id', 'name', 'work_email', 'job_title', 'department_id', 'active'],
|
|
120
|
-
limit: limit ?? 5,
|
|
121
|
-
});
|
|
122
|
-
if (!records.length) {
|
|
123
|
-
return { content: [{ type: 'text', text: 'No employees found.' }] };
|
|
124
|
-
}
|
|
125
|
-
const lines = records.map(r => {
|
|
126
|
-
const dept = r.department_id;
|
|
127
|
-
return [
|
|
128
|
-
`ID: ${r.id}`,
|
|
129
|
-
`Name: ${r.name}`,
|
|
130
|
-
`Title: ${r.job_title ?? '—'}`,
|
|
131
|
-
`Dept: ${dept ? dept[1] : '—'}`,
|
|
132
|
-
`Email: ${r.work_email ?? '—'}`,
|
|
133
|
-
].join(' | ');
|
|
134
|
-
});
|
|
135
|
-
return { content: [{ type: 'text', text: lines.join('\n') }] };
|
|
136
|
-
});
|
|
137
|
-
t('payroll_prepare', 'Create a draft payroll slip (hr.payslip) for an employee and period.', {
|
|
138
|
-
employee_id: zod_1.z.number().describe('Odoo employee ID'),
|
|
139
|
-
date_from: zod_1.z.string().describe('Period start date (YYYY-MM-DD)'),
|
|
140
|
-
date_to: zod_1.z.string().describe('Period end date (YYYY-MM-DD)'),
|
|
141
|
-
}, async ({ employee_id, date_from, date_to }) => {
|
|
142
|
-
const payslipId = await odooCall('hr.payslip', 'create', [{
|
|
143
|
-
employee_id,
|
|
144
|
-
date_from,
|
|
145
|
-
date_to,
|
|
146
|
-
}]);
|
|
147
|
-
return {
|
|
148
|
-
content: [{ type: 'text', text: `Payslip created. ID: ${payslipId} State: draft` }],
|
|
149
|
-
};
|
|
150
|
-
});
|
|
151
|
-
t('payroll_confirm', 'Compute salary lines and confirm (validate) a payroll slip.', {
|
|
152
|
-
payslip_id: zod_1.z.number().describe('Payslip ID returned by payroll_prepare'),
|
|
153
|
-
}, async ({ payslip_id }) => {
|
|
154
|
-
await odooCall('hr.payslip', 'compute_sheet', [[payslip_id]]);
|
|
155
|
-
await odooCall('hr.payslip', 'action_payslip_done', [[payslip_id]]);
|
|
156
|
-
return {
|
|
157
|
-
content: [{ type: 'text', text: `Payslip ${payslip_id} confirmed. State: done` }],
|
|
158
|
-
};
|
|
159
|
-
});
|
|
160
|
-
return srv;
|
|
161
|
-
}
|
|
5
|
+
const tools_js_1 = require("./tools.js");
|
|
162
6
|
// ── Start ─────────────────────────────────────────────────────────────────────
|
|
163
7
|
const { httpMode, port } = (0, server_runner_js_1.parseCliArgs)();
|
|
164
|
-
(0, server_runner_js_1.runMcpServer)(buildServer, { httpMode, port, label: 'bk-mcp-odoo' }).catch(err => {
|
|
8
|
+
(0, server_runner_js_1.runMcpServer)(tools_js_1.buildServer, { httpMode, port, label: 'bk-mcp-odoo' }).catch(err => {
|
|
165
9
|
process.stderr.write(`[bk-mcp-odoo] Fatal: ${err.message}\n`);
|
|
166
10
|
process.exit(1);
|
|
167
11
|
});
|
package/dist/odoo/server.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.js","sourceRoot":"","sources":["../../src/odoo/server.ts"],"names":[],"mappings":";;;AACA,
|
|
1
|
+
{"version":3,"file":"server.js","sourceRoot":"","sources":["../../src/odoo/server.ts"],"names":[],"mappings":";;;AACA,iEAAwE;AACxE,yCAAyC;AAEzC,iFAAiF;AAEjF,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,GAAG,IAAA,+BAAY,GAAE,CAAC;AAC1C,IAAA,+BAAY,EAAC,sBAAW,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,KAAK,EAAE,aAAa,EAAE,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE;IAC5E,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,wBAAyB,GAAa,CAAC,OAAO,IAAI,CAAC,CAAC;IACzE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AACpB,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../../src/odoo/tools.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAsGpE,wBAAgB,WAAW,IAAI,SAAS,CA+GvC"}
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.buildServer = buildServer;
|
|
4
|
+
const mcp_js_1 = require("@modelcontextprotocol/sdk/server/mcp.js");
|
|
5
|
+
const zod_1 = require("zod");
|
|
6
|
+
const http_client_js_1 = require("../shared/http-client.js");
|
|
7
|
+
let _session = null;
|
|
8
|
+
// Dedupe concurrent first-calls so two simultaneous tool invocations don't
|
|
9
|
+
// both hit /web/session/authenticate before either has cached a session.
|
|
10
|
+
let _authInFlight = null;
|
|
11
|
+
function cfg() {
|
|
12
|
+
const url = process.env.ODOO_URL?.replace(/\/$/, '');
|
|
13
|
+
const db = process.env.ODOO_DB;
|
|
14
|
+
const user = process.env.ODOO_USER;
|
|
15
|
+
const pass = process.env.ODOO_PASSWORD;
|
|
16
|
+
if (!url || !db || !user || !pass) {
|
|
17
|
+
throw new Error('Set ODOO_URL, ODOO_DB, ODOO_USER, ODOO_PASSWORD');
|
|
18
|
+
}
|
|
19
|
+
return { url, db, user, pass };
|
|
20
|
+
}
|
|
21
|
+
async function doAuthenticate() {
|
|
22
|
+
const { url, db, user, pass } = cfg();
|
|
23
|
+
const data = await (0, http_client_js_1.fetchJson)('Odoo', `${url}/web/session/authenticate`, {
|
|
24
|
+
method: 'POST',
|
|
25
|
+
headers: { 'Content-Type': 'application/json' },
|
|
26
|
+
body: JSON.stringify({
|
|
27
|
+
jsonrpc: '2.0', method: 'call', id: 1,
|
|
28
|
+
params: { db, login: user, password: pass },
|
|
29
|
+
}),
|
|
30
|
+
});
|
|
31
|
+
if (data.error)
|
|
32
|
+
throw new Error(`Odoo auth error: ${data.error.message}`);
|
|
33
|
+
if (!data.result?.uid)
|
|
34
|
+
throw new Error('Odoo auth failed — no uid returned (wrong credentials?)');
|
|
35
|
+
_session = { uid: data.result.uid, sessionId: data.result.session_id };
|
|
36
|
+
return _session;
|
|
37
|
+
}
|
|
38
|
+
async function authenticate() {
|
|
39
|
+
if (_session)
|
|
40
|
+
return _session;
|
|
41
|
+
if (!_authInFlight) {
|
|
42
|
+
_authInFlight = doAuthenticate().finally(() => { _authInFlight = null; });
|
|
43
|
+
}
|
|
44
|
+
return _authInFlight;
|
|
45
|
+
}
|
|
46
|
+
/** Odoo returns HTTP 200 with a JSON-RPC error when the cached session has expired server-side. */
|
|
47
|
+
function isSessionExpiredError(error) {
|
|
48
|
+
if (!error)
|
|
49
|
+
return false;
|
|
50
|
+
if (error.code === 100)
|
|
51
|
+
return true; // Odoo's "Session Expired" error code
|
|
52
|
+
return /session\s*expired/i.test(error.message ?? '');
|
|
53
|
+
}
|
|
54
|
+
async function odooCall(model, method, args, kwargs = {}, _retriedAfterReauth = false) {
|
|
55
|
+
const sess = await authenticate();
|
|
56
|
+
const { url } = cfg();
|
|
57
|
+
const data = await (0, http_client_js_1.fetchJson)('Odoo', `${url}/web/dataset/call_kw`, {
|
|
58
|
+
method: 'POST',
|
|
59
|
+
headers: {
|
|
60
|
+
'Content-Type': 'application/json',
|
|
61
|
+
'Cookie': `session_id=${sess.sessionId}`,
|
|
62
|
+
},
|
|
63
|
+
body: JSON.stringify({
|
|
64
|
+
jsonrpc: '2.0', method: 'call', id: Date.now(),
|
|
65
|
+
params: { model, method, args, kwargs },
|
|
66
|
+
}),
|
|
67
|
+
});
|
|
68
|
+
if (data.error) {
|
|
69
|
+
if (!_retriedAfterReauth && isSessionExpiredError(data.error)) {
|
|
70
|
+
_session = null;
|
|
71
|
+
return odooCall(model, method, args, kwargs, true);
|
|
72
|
+
}
|
|
73
|
+
throw new Error(`Odoo ${model}.${method}: ${data.error.data?.message ?? data.error.message}`);
|
|
74
|
+
}
|
|
75
|
+
return data.result;
|
|
76
|
+
}
|
|
77
|
+
// ── Tools ─────────────────────────────────────────────────────────────────────
|
|
78
|
+
function buildServer() {
|
|
79
|
+
const srv = new mcp_js_1.McpServer({ name: 'bk-mcp-odoo', version: '0.1.0' });
|
|
80
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
81
|
+
const t = srv.tool.bind(srv);
|
|
82
|
+
t('odoo_employee_create', 'Create a new employee record in Odoo HR.', {
|
|
83
|
+
name: zod_1.z.string().describe('Full name'),
|
|
84
|
+
work_email: zod_1.z.string().email().optional().describe('Work email address'),
|
|
85
|
+
job_title: zod_1.z.string().optional().describe('Job title'),
|
|
86
|
+
department: zod_1.z.string().optional().describe('Department name (partial match)'),
|
|
87
|
+
}, async ({ name, work_email, job_title, department }) => {
|
|
88
|
+
const vals = { name };
|
|
89
|
+
if (work_email)
|
|
90
|
+
vals.work_email = work_email;
|
|
91
|
+
if (job_title)
|
|
92
|
+
vals.job_title = job_title;
|
|
93
|
+
if (department) {
|
|
94
|
+
const ids = await odooCall('hr.department', 'search', [[['name', 'ilike', department]]]);
|
|
95
|
+
if (ids.length)
|
|
96
|
+
vals.department_id = ids[0];
|
|
97
|
+
}
|
|
98
|
+
const id = await odooCall('hr.employee', 'create', [vals]);
|
|
99
|
+
return { content: [{ type: 'text', text: `Employee created. Odoo ID: ${id}` }] };
|
|
100
|
+
});
|
|
101
|
+
t('odoo_employee_get', 'Retrieve employee records from Odoo by ID or name search.', {
|
|
102
|
+
employee_id: zod_1.z.number().optional().describe('Exact employee ID'),
|
|
103
|
+
name: zod_1.z.string().optional().describe('Name filter (partial match)'),
|
|
104
|
+
limit: zod_1.z.number().min(1).max(100).optional().describe('Maximum records to return (default 5, max 100)'),
|
|
105
|
+
}, async ({ employee_id, name, limit }) => {
|
|
106
|
+
let domain;
|
|
107
|
+
if (employee_id !== undefined) {
|
|
108
|
+
domain = [['id', '=', employee_id]];
|
|
109
|
+
}
|
|
110
|
+
else if (name) {
|
|
111
|
+
domain = [['name', 'ilike', name]];
|
|
112
|
+
}
|
|
113
|
+
else {
|
|
114
|
+
domain = [['active', '=', true]];
|
|
115
|
+
}
|
|
116
|
+
const records = await odooCall('hr.employee', 'search_read', [], {
|
|
117
|
+
domain,
|
|
118
|
+
fields: ['id', 'name', 'work_email', 'job_title', 'department_id', 'active'],
|
|
119
|
+
limit: limit ?? 5,
|
|
120
|
+
});
|
|
121
|
+
if (!records.length) {
|
|
122
|
+
return { content: [{ type: 'text', text: 'No employees found.' }] };
|
|
123
|
+
}
|
|
124
|
+
const lines = records.map(r => {
|
|
125
|
+
const dept = r.department_id;
|
|
126
|
+
return [
|
|
127
|
+
`ID: ${r.id}`,
|
|
128
|
+
`Name: ${r.name}`,
|
|
129
|
+
`Title: ${r.job_title ?? '—'}`,
|
|
130
|
+
`Dept: ${dept ? dept[1] : '—'}`,
|
|
131
|
+
`Email: ${r.work_email ?? '—'}`,
|
|
132
|
+
].join(' | ');
|
|
133
|
+
});
|
|
134
|
+
return { content: [{ type: 'text', text: lines.join('\n') }] };
|
|
135
|
+
});
|
|
136
|
+
t('payroll_prepare', 'Create a draft payroll slip (hr.payslip) for an employee and period.', {
|
|
137
|
+
employee_id: zod_1.z.number().describe('Odoo employee ID'),
|
|
138
|
+
date_from: zod_1.z.string().describe('Period start date (YYYY-MM-DD)'),
|
|
139
|
+
date_to: zod_1.z.string().describe('Period end date (YYYY-MM-DD)'),
|
|
140
|
+
}, async ({ employee_id, date_from, date_to }) => {
|
|
141
|
+
const payslipId = await odooCall('hr.payslip', 'create', [{
|
|
142
|
+
employee_id,
|
|
143
|
+
date_from,
|
|
144
|
+
date_to,
|
|
145
|
+
}]);
|
|
146
|
+
return {
|
|
147
|
+
content: [{ type: 'text', text: `Payslip created. ID: ${payslipId} State: draft` }],
|
|
148
|
+
};
|
|
149
|
+
});
|
|
150
|
+
t('payroll_confirm', 'Compute salary lines and confirm (validate) a payroll slip.', {
|
|
151
|
+
payslip_id: zod_1.z.number().describe('Payslip ID returned by payroll_prepare'),
|
|
152
|
+
}, async ({ payslip_id }) => {
|
|
153
|
+
await odooCall('hr.payslip', 'compute_sheet', [[payslip_id]]);
|
|
154
|
+
await odooCall('hr.payslip', 'action_payslip_done', [[payslip_id]]);
|
|
155
|
+
return {
|
|
156
|
+
content: [{ type: 'text', text: `Payslip ${payslip_id} confirmed. State: done` }],
|
|
157
|
+
};
|
|
158
|
+
});
|
|
159
|
+
return srv;
|
|
160
|
+
}
|
|
161
|
+
//# sourceMappingURL=tools.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tools.js","sourceRoot":"","sources":["../../src/odoo/tools.ts"],"names":[],"mappings":";;AAsGA,kCA+GC;AArND,oEAAoE;AACpE,6BAAwB;AACxB,6DAAqD;AAerD,IAAI,QAAQ,GAAuB,IAAI,CAAC;AACxC,2EAA2E;AAC3E,yEAAyE;AACzE,IAAI,aAAa,GAAgC,IAAI,CAAC;AAEtD,SAAS,GAAG;IACR,MAAM,GAAG,GAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,EAAE,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;IACtD,MAAM,EAAE,GAAK,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC;IACjC,MAAM,IAAI,GAAG,OAAO,CAAC,GAAG,CAAC,SAAS,CAAC;IACnC,MAAM,IAAI,GAAG,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC;IACvC,IAAI,CAAC,GAAG,IAAI,CAAC,EAAE,IAAI,CAAC,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC;QAChC,MAAM,IAAI,KAAK,CAAC,iDAAiD,CAAC,CAAC;IACvE,CAAC;IACD,OAAO,EAAE,GAAG,EAAE,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;AACnC,CAAC;AAED,KAAK,UAAU,cAAc;IACzB,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AAqB,GAC5B,OAAO,CAAC,CAAC,CAAC,
|
|
1
|
+
{"version":3,"file":"http-client.d.ts","sourceRoot":"","sources":["../../src/shared/http-client.ts"],"names":[],"mappings":"AAKA,MAAM,WAAW,gBAAgB;IAC7B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;CACxB;AAED;;;;;;;GAOG;AACH,wBAAsB,SAAS,CAAC,CAAC,EAC7B,WAAW,EAAE,MAAM,EACnB,GAAG,EAAE,MAAM,EACX,IAAI,EAAE,WAAW,EACjB,IAAI,GAAE,gBAAqB,GAC5B,OAAO,CAAC,CAAC,CAAC,CAoDZ"}
|
|
@@ -23,7 +23,8 @@ async function fetchJson(serviceName, url, init, opts = {}) {
|
|
|
23
23
|
res = await fetch(url, { ...init, signal: controller.signal });
|
|
24
24
|
}
|
|
25
25
|
catch (err) {
|
|
26
|
-
|
|
26
|
+
// Duck-typed: the DOMException from an aborted fetch can come from another realm.
|
|
27
|
+
const aborted = err?.name === 'AbortError';
|
|
27
28
|
// eslint-disable-next-line @typescript-eslint/no-throw-literal
|
|
28
29
|
throw {
|
|
29
30
|
type: 'network',
|
|
@@ -51,11 +52,14 @@ async function fetchJson(serviceName, url, init, opts = {}) {
|
|
|
51
52
|
const result = await (0, retry_1.retry)(attempt, {
|
|
52
53
|
maxAttempts: opts.maxAttempts ?? DEFAULT_MAX_ATTEMPTS,
|
|
53
54
|
backoff: { type: 'exponential', baseDelay: 500, maxDelay: 8_000, jitter: 'full' },
|
|
54
|
-
retryIf: (e) => e.type === 'network' || (e.type === 'http' && (e.status ?? 0) >= 500),
|
|
55
|
+
retryIf: (e) => e.type === 'network' || (e.type === 'http' && ((e.status ?? 0) >= 500 || e.status === 429)),
|
|
55
56
|
abortIf: (e) => e.type === 'http' && [401, 403].includes(e.status ?? 0),
|
|
56
57
|
});
|
|
57
58
|
if (!result.ok) {
|
|
58
|
-
|
|
59
|
+
// The retry engine wraps what attempt() threw: its own `message` is generic
|
|
60
|
+
// ("HTTP 404", or "[object Object]" for network errors); ours is in `cause`.
|
|
61
|
+
const cause = result.error.cause;
|
|
62
|
+
throw Object.assign(new Error(cause?.message ?? result.error.message), { status: cause?.status ?? result.error.status });
|
|
59
63
|
}
|
|
60
64
|
return result.value;
|
|
61
65
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"http-client.js","sourceRoot":"","sources":["../../src/shared/http-client.ts"],"names":[],"mappings":";;AAkBA,
|
|
1
|
+
{"version":3,"file":"http-client.js","sourceRoot":"","sources":["../../src/shared/http-client.ts"],"names":[],"mappings":";;AAkBA,8BAyDC;AA3ED,kDAA+C;AAE/C,MAAM,kBAAkB,GAAG,MAAM,CAAC;AAClC,MAAM,oBAAoB,GAAG,CAAC,CAAC;AAO/B;;;;;;;GAOG;AACI,KAAK,UAAU,SAAS,CAC3B,WAAmB,EACnB,GAAW,EACX,IAAiB,EACjB,OAAyB,EAAE;IAE3B,MAAM,SAAS,GAAG,IAAI,CAAC,SAAS,IAAI,kBAAkB,CAAC;IACvD,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,IAAI,KAAK,CAAC;IAEpC,MAAM,OAAO,GAAG,KAAK,IAAgB,EAAE;QACnC,MAAM,UAAU,GAAG,IAAI,eAAe,EAAE,CAAC;QACzC,MAAM,KAAK,GAAG,UAAU,CAAC,GAAG,EAAE,CAAC,UAAU,CAAC,KAAK,EAAE,EAAE,SAAS,CAAC,CAAC;QAC9D,IAAI,GAAa,CAAC;QAClB,IAAI,CAAC;YACD,GAAG,GAAG,MAAM,KAAK,CAAC,GAAG,EAAE,EAAE,GAAG,IAAI,EAAE,MAAM,EAAE,UAAU,CAAC,MAAM,EAAE,CAAC,CAAC;QACnE,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACX,kFAAkF;YAClF,MAAM,OAAO,GAAI,GAAgC,EAAE,IAAI,KAAK,YAAY,CAAC;YACzE,+DAA+D;YAC/D,MAAM;gBACF,IAAI,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IAAI,CAAC,CAAC,CAAC,IAAI,KAAK,MAAM,IAAI,CAAC,CAAC,CAAC,CAAC,MAAM,IAAI,CAAC,CAAC,IAAI,GAAG,IAAI,CAAC,CAAC,MAAM,KAAK,GAAG,CAAC,CAAC;QAC/F,OAAO,EAAE,CAAC,CAAoC,EAAE,EAAE,CAC9C,CAAC,CAAC,IAAI,KAAK,MAAM,IAAI,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,IAAI,CAAC,CAAC;KAC9D,CAAC,CAAC;IAEH,IAAI,CAAC,MAAM,CAAC,EAAE,EAAE,CAAC;QACb,4EAA4E;QAC5E,6EAA6E;QAC7E,MAAM,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC,KAA0D,CAAC;QACtF,MAAM,MAAM,CAAC,MAAM,CAAC,IAAI,KAAK,CAAC,KAAK,EAAE,OAAO,IAAI,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,IAAI,MAAM,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC,CAAC;IAC7H,CAAC;IACD,OAAO,MAAM,CAAC,KAAK,CAAC;AACxB,CAAC"}
|
|
@@ -1,11 +1,21 @@
|
|
|
1
1
|
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
2
|
-
|
|
2
|
+
import { type Server } from 'node:http';
|
|
3
|
+
export declare function parseCliArgs(argv?: string[]): {
|
|
3
4
|
httpMode: boolean;
|
|
4
5
|
port: number;
|
|
5
6
|
};
|
|
7
|
+
/**
|
|
8
|
+
* The server binds to 127.0.0.1, but a web page in the user's browser can still reach it
|
|
9
|
+
* (DNS rebinding / cross-site POST). Reject requests whose Host or Origin is not loopback.
|
|
10
|
+
*/
|
|
11
|
+
export declare function isLoopbackRequest(host: string | undefined, origin: string | undefined): boolean;
|
|
12
|
+
/** Constant-time check of `Authorization: Bearer <token>`. */
|
|
13
|
+
export declare function isBearerAuthorized(header: string | undefined, token: string): boolean;
|
|
6
14
|
export declare function runMcpServer(buildServer: () => McpServer, opts: {
|
|
7
15
|
httpMode: boolean;
|
|
8
16
|
port: number;
|
|
9
17
|
label: string;
|
|
10
18
|
}): Promise<void>;
|
|
19
|
+
/** @internal exported for tests */
|
|
20
|
+
export declare function startHttp(buildServer: () => McpServer, port: number, label: string, authToken?: string): Promise<Server>;
|
|
11
21
|
//# sourceMappingURL=server-runner.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server-runner.d.ts","sourceRoot":"","sources":["../../src/shared/server-runner.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;
|
|
1
|
+
{"version":3,"file":"server-runner.d.ts","sourceRoot":"","sources":["../../src/shared/server-runner.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAGpE,OAAO,EAAsC,KAAK,MAAM,EAAuB,MAAM,WAAW,CAAC;AAGjG,wBAAgB,YAAY,CAAC,IAAI,GAAE,MAAM,EAA0B,GAAG;IAAE,QAAQ,EAAE,OAAO,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAUxG;AAID;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,EAAE,MAAM,EAAE,MAAM,GAAG,SAAS,GAAG,OAAO,CAQ/F;AAED,8DAA8D;AAC9D,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAKrF;AAED,wBAAsB,YAAY,CAC9B,WAAW,EAAE,MAAM,SAAS,EAC5B,IAAI,EAAE;IAAE,QAAQ,EAAE,OAAO,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,GACzD,OAAO,CAAC,IAAI,CAAC,CAOf;AAED,mCAAmC;AACnC,wBAAsB,SAAS,CAC3B,WAAW,EAAE,MAAM,SAAS,EAC5B,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,MAAM,EACb,SAAS,CAAC,EAAE,MAAM,GACnB,OAAO,CAAC,MAAM,CAAC,CAmEjB"}
|