nixflex-mcp 0.2.0 → 0.3.0

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.
Files changed (2) hide show
  1. package/index.js +12 -4
  2. package/package.json +2 -2
package/index.js CHANGED
@@ -26,7 +26,7 @@ import { readFileSync } from 'node:fs';
26
26
  import { homedir } from 'node:os';
27
27
  import { join } from 'node:path';
28
28
 
29
- const VERSION = '0.2.0';
29
+ const VERSION = '0.2.1';
30
30
  const log = (...a) => process.stderr.write('[nixflex-mcp] ' + a.join(' ') + '\n');
31
31
 
32
32
  // ---- key: env first, then the CLI's config file (so `nixflex login` is enough) ----
@@ -57,7 +57,15 @@ const preview = async (what, fetch) => { let current = null; try { current = awa
57
57
  const summariseCall = (c) => ({ call_id: c.call_id, direction: c.direction, from_number: c.from_number, to_number: c.to_number, agent_id: c.agent_id, call_status: c.call_status, ended_reason: c.ended_reason, duration_ms: c.duration_ms, started_at: c.start_timestamp || c.created_at, call_summary: c.call_summary, call_successful: c.call_successful, caller_sentiment: c.caller_sentiment, bookings: Array.isArray(c.bookings) ? c.bookings.length : undefined });
58
58
 
59
59
  const server = new McpServer({ name: 'nixflex', version: VERSION });
60
- const T = (name, description, schema, fn) => server.registerTool(name, { description, inputSchema: schema }, run(fn));
60
+ // Annotations are HINTS for clients (Claude asks before destructive tools) - never a
61
+ // security control. Rule: name starts with get_/list_ -> read-only; delete_/rotate_ ->
62
+ // destructive; everything else writes but is not destructive.
63
+ const annotate = (name) => name.startsWith('get_') || name.startsWith('list_')
64
+ ? { readOnlyHint: true, destructiveHint: false, idempotentHint: true }
65
+ : (name.startsWith('delete_') || name.startsWith('rotate_'))
66
+ ? { readOnlyHint: false, destructiveHint: true, idempotentHint: false }
67
+ : { readOnlyHint: false, destructiveHint: false, idempotentHint: false };
68
+ const T = (name, description, schema, fn) => server.registerTool(name, { description, inputSchema: schema, annotations: annotate(name) }, run(fn));
61
69
 
62
70
  // ============ account ============
63
71
  T('get_usage', 'Usage and balance for this account.', z.object({}), () => client.usage.get());
@@ -68,7 +76,7 @@ T('rotate_api_key', 'Replace the API secret. The current secret stops working im
68
76
  T('list_agents', 'List the agents on this account. Phone numbers, webhooks and integrations are attached per NUMBER, not per agent - use list_phone_numbers to see them.',
69
77
  z.object({ limit: z.number().int().min(1).max(100).optional() }), ({ limit }) => client.agents.list(limit ? { limit } : {}));
70
78
  T('get_agent', 'One agent with its prompt and settings.', z.object({ agent_id: z.string() }), ({ agent_id }) => client.agents.get(agent_id));
71
- T('create_agent', 'Create an agent. name and system_prompt are required; any other agent field (voice_id, language, incall_sms_enabled, silence_hangup_seconds, ...) goes in fields.',
79
+ T('create_agent', 'Create an agent. name and system_prompt are required; any other agent field (voice_id, language, incall_sms_enabled, silence_hangup_seconds, record_call, recording_source = provider or nixflex, ...) goes in fields.',
72
80
  z.object({ name: z.string(), system_prompt: z.string(), fields: fields.optional() }), ({ name, system_prompt, fields: f }) => client.agents.create({ name, system_prompt, ...(f || {}) }));
73
81
  T('update_agent', 'Update an agent. Only the fields you pass change. Pass null to clear a nullable field.',
74
82
  z.object({ agent_id: z.string(), fields }), ({ agent_id, fields: f }) => client.agents.update(agent_id, f));
@@ -97,7 +105,7 @@ T('list_phone_numbers', 'Phone numbers on this account and which agent each one
97
105
  z.object({ agent_id: z.string().optional() }), ({ agent_id }) => client.phoneNumbers.list(agent_id ? { agent_id } : {}));
98
106
  T('import_phone_number', 'Attach a number you own at Twilio or Telnyx to an agent. Needs carrier credentials in fields (twilio_account_sid + twilio_auth_token, or telnyx_api_key + telnyx_connection_id).',
99
107
  z.object({ phone_number: E164, agent_id: z.string(), fields }), ({ fields: f, ...rest }) => client.phoneNumbers.import({ ...rest, ...f }));
100
- T('update_phone_number', 'Update per-number settings: custom_prompt, sms_prompt, sms_reply_enabled, web_prompt, dtmf_enabled, record_call, voice_id, speaking_rate, ... Only passed fields change; null clears.',
108
+ T('update_phone_number', 'Update per-number settings: custom_prompt, sms_prompt, sms_reply_enabled, web_prompt, dtmf_enabled, record_call, recording_source (provider | nixflex | null = inherit), voice_id, speaking_rate, ... Only passed fields change; null clears.',
101
109
  z.object({ phone_number: E164, fields }), ({ phone_number, fields: f }) => client.phoneNumbers.update(phone_number, f));
102
110
  T('delete_phone_number', 'Disconnect a number from Nixflex (the carrier keeps it and keeps billing it). Requires confirm: true.',
103
111
  z.object({ phone_number: E164, confirm: confirmArg }), async ({ phone_number, confirm }) => confirm ? client.phoneNumbers.delete(phone_number) : { would_delete: 'number ' + phone_number + ' from Nixflex', hint: 'Call again with confirm: true.' });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nixflex-mcp",
3
- "version": "0.2.0",
3
+ "version": "0.3.0",
4
4
  "description": "MCP server for the Nixflex voice AI platform - manage agents, calls, numbers and caller context from Claude Desktop, Cursor or any MCP client.",
5
5
  "keywords": ["nixflex", "mcp", "model-context-protocol", "voice-ai", "phone", "claude"],
6
6
  "homepage": "https://docs.nixflex.com/mcp/overview",
@@ -11,7 +11,7 @@
11
11
  "files": ["index.js", "README.md", "LICENSE"],
12
12
  "engines": { "node": ">=18" },
13
13
  "scripts": {
14
- "check": "node --test tests/*.test.mjs",
14
+ "check": "node --test tests/tools.test.mjs tests/contract.test.mjs",
15
15
  "start": "node index.js"
16
16
  },
17
17
  "dependencies": {