@teamnetwork-nz/teamlink-mcp-server 0.6.1 → 0.6.2
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/index.js +9 -11
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -127,14 +127,14 @@ function strictTool(name, description, inputSchema, callback) {
|
|
|
127
127
|
}
|
|
128
128
|
const allowedQueryParams = {
|
|
129
129
|
'/accounts/search': new Set([
|
|
130
|
-
'mode', 'q', '
|
|
130
|
+
'mode', 'q', 'accountId', 'alphaId', 'name', 'address', 'phone', 'website',
|
|
131
131
|
'exactWebsite', 'isActive', 'isCustomer', 'isProspect', 'isSupplier', 'isBranch',
|
|
132
132
|
'branchId', 'teamId', 'page', 'pageSize',
|
|
133
133
|
]),
|
|
134
134
|
'/accounts': new Set(['search', 'isActive', 'isCustomer', 'isProspect', 'isSupplier', 'isBranch', 'branchId', 'teamId', 'page', 'pageSize']),
|
|
135
135
|
'/contacts/search': new Set([
|
|
136
136
|
'mode', 'q', 'cscId', 'contactId', 'firstName', 'lastName', 'fullName', 'shortName',
|
|
137
|
-
'
|
|
137
|
+
'accountId', 'email', 'mobile', 'businessPhone', 'isActive', 'role', 'page', 'pageSize',
|
|
138
138
|
]),
|
|
139
139
|
'/tasks/time-entries/search': new Set(['taskId', 'accountId', 'personId', 'type', 'q', 'dateFrom', 'dateTo', 'page', 'pageSize', 'includeCrm']),
|
|
140
140
|
'/tasks/search': new Set(['q', 'accountId', 'loggedForUserId', 'assignedToUserId', 'enteredByUserId', 'callType', 'priority', 'status', 'dateFrom', 'dateTo', 'page', 'pageSize']),
|
|
@@ -146,11 +146,10 @@ const allowedQueryParams = {
|
|
|
146
146
|
// --- Identity ---
|
|
147
147
|
strictTool('teamlink_whoami', 'Return the authenticated TEAMlink user context for the configured API key, including `roleClass` (CSCClass) and `homeAccountId` (CSAID — the identity key scoping staff vs customer visibility).', {}, async () => get('/me'));
|
|
148
148
|
// --- CRM: accounts ---
|
|
149
|
-
strictTool('crm_search_accounts', 'Search customer accounts. `
|
|
149
|
+
strictTool('crm_search_accounts', 'Search customer accounts. `accountId` is the canonical public name for the account identity stored in SQL as CSAccount.CSAID. Default mode is standard: exact case-insensitive matches. Fuzzy mode performs partial text/phone matching and name DIFFERENCE() matching. `isActive` defaults true unless explicitly set.', {
|
|
150
150
|
mode: z.enum(['standard', 'fuzzy']).optional().describe('Search mode. standard=exact case-insensitive matching; fuzzy=partial matching plus DIFFERENCE() for names. Defaults to standard.'),
|
|
151
|
-
q: z.string().optional().describe('General search value matched against
|
|
152
|
-
|
|
153
|
-
accountId: z.number().optional().describe('Compatibility alias for csaId. Prefer csaId.'),
|
|
151
|
+
q: z.string().optional().describe('General search value matched against accountId, alphaId, name, address, phone, and website.'),
|
|
152
|
+
accountId: z.number().optional().describe('Canonical public account identifier. Maps to CSAccount.CSAID in SQL.'),
|
|
154
153
|
alphaId: z.string().optional(),
|
|
155
154
|
name: z.string().optional(),
|
|
156
155
|
address: z.string().optional(),
|
|
@@ -176,7 +175,7 @@ strictTool('crm_list_accounts', 'Deprecated compatibility wrapper for listing/fi
|
|
|
176
175
|
// and everything linked to it (contacts, orders, tasks, ...) — see lookup_selectors
|
|
177
176
|
// and crm_search_accounts for how to resolve one. Response `isActive` = CSAActive:
|
|
178
177
|
// only active accounts are eligible for transactional activity (orders/tasks).
|
|
179
|
-
strictTool('crm_get_account', 'Get one account by
|
|
178
|
+
strictTool('crm_get_account', 'Get one account by `accountId` (stored as CSAccount.CSAID in SQL). Response `isActive` (CSAActive) gates transactional eligibility for orders/tasks. Lookup-backed fields include industry/source/salesStatus {code,label}, team {teamId,name}, and accountManager/preferredEngineer/backupEngineer/bizDevManager {userId,name}.', { accountId: z.number().describe('Canonical public account identifier. Maps to CSAccount.CSAID in SQL.') }, async ({ accountId }) => get(`/accounts/${accountId}`));
|
|
180
179
|
strictTool('crm_list_account_contacts', 'List contacts linked to an account. Defaults to active-only (CSPCA_Active); pass includeInactive=true to also return deactivated contacts for historical/reporting purposes — inactive does not mean deleted.', { accountId: z.number(), includeInactive: z.boolean().optional() }, async ({ accountId, includeInactive }) => get(`/accounts/${accountId}/contacts`, { includeInactive }));
|
|
181
180
|
if (READWRITE) {
|
|
182
181
|
strictTool('crm_create_account', 'Create an account. Returns duplicate-candidate warnings unless createAnyway=true.', {
|
|
@@ -192,7 +191,7 @@ if (READWRITE) {
|
|
|
192
191
|
// TYPE) — typeFlags.isAdminContact means a client-side admin/accounts contact,
|
|
193
192
|
// NOT the application admin role (role="A").
|
|
194
193
|
const roleDescription = 'CSCClass web-app role: A=Administrator, C=Customer, E=Engineer, M=Business Manager, P=Partner, S=Sales, T=Account Manager.';
|
|
195
|
-
strictTool('crm_search_contacts', 'Search contacts. `cscId` is canonical for CSContact.CSCID; `contactId` is accepted as a compatibility alias. `
|
|
194
|
+
strictTool('crm_search_contacts', 'Search contacts. `cscId` is canonical for CSContact.CSCID; `contactId` is accepted as a compatibility alias. `accountId` is the canonical public name for account linkage and maps to CSAccount.CSAID / CSPivotContactAccount.CSPCA_CSAID in SQL. Default mode is standard: exact case-insensitive matches. Fuzzy mode performs partial matching.', {
|
|
196
195
|
mode: z.enum(['standard', 'fuzzy']).optional().describe('Search mode. standard=exact case-insensitive matching; fuzzy=partial matching. Defaults to standard.'),
|
|
197
196
|
q: z.string().optional().describe('General search value matched against cscId/contactId, names, email, mobile, and business phone.'),
|
|
198
197
|
cscId: z.number().optional().describe('Canonical contact primary key (CSContact.CSCID).'),
|
|
@@ -201,8 +200,7 @@ strictTool('crm_search_contacts', 'Search contacts. `cscId` is canonical for CSC
|
|
|
201
200
|
lastName: z.string().optional(),
|
|
202
201
|
fullName: z.string().optional(),
|
|
203
202
|
shortName: z.string().optional(),
|
|
204
|
-
|
|
205
|
-
accountId: z.number().optional().describe('Compatibility alias for csaId. Prefer csaId.'),
|
|
203
|
+
accountId: z.number().optional().describe('Canonical public linked-account identifier. Maps to CSAccount.CSAID / CSPivotContactAccount.CSPCA_CSAID in SQL.'),
|
|
206
204
|
email: z.string().optional(),
|
|
207
205
|
mobile: z.string().optional().describe('Mobile phone search; punctuation/spaces are ignored.'),
|
|
208
206
|
businessPhone: z.string().optional().describe('Business/DDI phone search; punctuation/spaces are ignored.'),
|
|
@@ -330,7 +328,7 @@ strictTool('product_search', 'Search the read-only product catalog. `q` splits o
|
|
|
330
328
|
}, async (args) => get('/orders/products/search', args));
|
|
331
329
|
function createConfiguredServer() {
|
|
332
330
|
const server = new McpServer({ name: '@teamnetwork-nz/teamlink-mcp-server', version: pkgVersion() }, {
|
|
333
|
-
instructions: 'TEAMlink business operations MCP server supporting stdio and HTTP. Read-only by default; mutation tools are available only when TEAMLINK_READWRITE=true. Use the most specific search filters available and treat customer, order, invoice, and credential data as sensitive.',
|
|
331
|
+
instructions: 'TEAMlink business operations MCP server supporting stdio and HTTP. Read-only by default; mutation tools are available only when TEAMLINK_READWRITE=true. Always use `accountId` for the public account/customer identifier; it maps to CSAID and *_CSAID columns in SQL. Use the most specific search filters available and treat customer, order, invoice, and credential data as sensitive.',
|
|
334
332
|
});
|
|
335
333
|
for (const register of registrations)
|
|
336
334
|
register(server);
|