nixflex-mcp 0.5.1 → 0.6.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.
- package/{KIT-EXAMPLES-K7.md → CALL-EXAMPLES.md} +2 -2
- package/CALL-REQUESTS.md +3 -5
- package/CHANGELOG.md +132 -124
- package/{B57-DELETES.md → DELETING-CONTENT.md} +2 -4
- package/METHODS.md +136 -129
- package/{KIT-EXAMPLES-K6.md → NUMBER-EXAMPLES.md} +128 -118
- package/NUMBER-FEATURES.md +3 -5
- package/ORGANISATIONS.md +3 -3
- package/README.md +28 -23
- package/agent-settings.js +34 -0
- package/booking-schemas.js +1 -0
- package/c5-schemas.js +31 -17
- package/c5-tools.js +35 -31
- package/foundation/tool-metadata.mjs +2 -1
- package/index.js +7 -3
- package/k9-deletes.js +2 -2
- package/monitor-tools.js +17 -0
- package/package.json +89 -86
package/METHODS.md
CHANGED
|
@@ -1,129 +1,136 @@
|
|
|
1
|
-
# Registered MCP tools
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
|
13
|
-
|
|
|
14
|
-
|
|
|
15
|
-
|
|
|
16
|
-
|
|
|
17
|
-
|
|
|
18
|
-
|
|
|
19
|
-
|
|
|
20
|
-
|
|
|
21
|
-
|
|
|
22
|
-
|
|
|
23
|
-
|
|
|
24
|
-
|
|
|
25
|
-
|
|
|
26
|
-
|
|
|
27
|
-
|
|
|
28
|
-
|
|
|
29
|
-
|
|
|
30
|
-
|
|
|
31
|
-
|
|
|
32
|
-
|
|
|
33
|
-
|
|
|
34
|
-
|
|
|
35
|
-
|
|
|
36
|
-
|
|
|
37
|
-
|
|
|
38
|
-
|
|
|
39
|
-
|
|
|
40
|
-
|
|
|
41
|
-
|
|
|
42
|
-
|
|
|
43
|
-
|
|
|
44
|
-
|
|
|
45
|
-
|
|
|
46
|
-
|
|
|
47
|
-
|
|
|
48
|
-
|
|
|
49
|
-
|
|
|
50
|
-
|
|
|
51
|
-
|
|
|
52
|
-
|
|
|
53
|
-
|
|
|
54
|
-
|
|
|
55
|
-
|
|
|
56
|
-
|
|
|
57
|
-
|
|
|
58
|
-
|
|
|
59
|
-
|
|
|
60
|
-
|
|
|
61
|
-
|
|
|
62
|
-
|
|
|
63
|
-
|
|
|
64
|
-
|
|
|
65
|
-
|
|
|
66
|
-
|
|
|
67
|
-
|
|
|
68
|
-
|
|
|
69
|
-
|
|
|
70
|
-
|
|
|
71
|
-
|
|
|
72
|
-
|
|
|
73
|
-
|
|
|
74
|
-
|
|
|
75
|
-
|
|
|
76
|
-
|
|
|
77
|
-
|
|
|
78
|
-
|
|
|
79
|
-
|
|
|
80
|
-
|
|
|
81
|
-
|
|
|
82
|
-
|
|
|
83
|
-
|
|
|
84
|
-
|
|
|
85
|
-
|
|
|
86
|
-
|
|
|
87
|
-
|
|
|
88
|
-
|
|
|
89
|
-
|
|
|
90
|
-
|
|
|
91
|
-
|
|
|
92
|
-
|
|
|
93
|
-
|
|
|
94
|
-
|
|
|
95
|
-
|
|
|
96
|
-
|
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
|
101
|
-
|
|
|
102
|
-
|
|
|
103
|
-
|
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
|
113
|
-
|
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
1
|
+
# Registered MCP tools
|
|
2
|
+
|
|
3
|
+
The server registers 98 tools. Call tools/list for their current schemas. A legacy draft read can save changes and is available only through the SDK and CLI.
|
|
4
|
+
Inspect each tool’s input and confirmation requirements before sending a request.
|
|
5
|
+
|
|
6
|
+
Monitor pass creation is available through the server SDKs and CLI. The default API key limit is 300 requests per minute. If pass creation through a server SDK receives HTTP 503 `monitor_unavailable`, the SDK reports `outcome_unknown`, preserves status 503 and the cause in `details.original_code`, and makes one attempt. The CLI reports `503 outcome_unknown`. Check the call before requesting another pass.
|
|
7
|
+
|
|
8
|
+
Each call supports up to **10 audio listeners** and **100 listeners in total** across audio and text. A pass is single-use and gives the listener 60 seconds to join. Once connected, the session continues past that deadline while its lease and permission remain valid. A pass does not reserve a seat. When all 10 audio seats are taken, an audio pass request through a server SDK or the CLI returns HTTP 409 `audio_seats_full`. This is a definite refusal after one attempt and no pass was issued. Request a fresh pass in text mode to follow the transcript. `list_live_calls` is unchanged.
|
|
9
|
+
|
|
10
|
+
Agent edits accept `if_revision`, `if_voice` and `changes`. See the README for error recovery and `paused_by_card`.
|
|
11
|
+
|
|
12
|
+
| Tool | Read-only hint | Input fields |
|
|
13
|
+
| --- | --- | --- |
|
|
14
|
+
| list_live_calls | true | No inputs |
|
|
15
|
+
| get_usage | true | |
|
|
16
|
+
| rotate_api_key | false | confirm |
|
|
17
|
+
| list_agents | true | limit, offset, status, search |
|
|
18
|
+
| get_agent | true | agent_id |
|
|
19
|
+
| create_agent | false | name, system_prompt, fields |
|
|
20
|
+
| update_agent | false | agent_id, fields |
|
|
21
|
+
| delete_agent | false | agent_id, confirm |
|
|
22
|
+
| create_call | false | agent_id, to_number, prompt, from_number, variables, recipient_country, recipient_timezone |
|
|
23
|
+
| list_calls | true | history, limit, offset, cursor, agent_id, agent, number, search, direction, outcome, source, period, since, until |
|
|
24
|
+
| get_call | true | call_id, view |
|
|
25
|
+
| delete_call | false | call_id, confirm |
|
|
26
|
+
| create_campaign | false | agent_id, from_number, name, recipients, consent_confirmed, duplicate_policy, allow_wider_hours, hours_confirmation, schedule_type, scheduled_date, window_start_minutes, window_end_minutes, window_days, timezone, skip_invalid, reply_window_hours, reply_context_prompt, fields, prompt |
|
|
27
|
+
| launch_campaign | false | campaign_id |
|
|
28
|
+
| list_phone_numbers | true | phone_number, usage, period, time_zone, agent_id, provider, limit, cursor |
|
|
29
|
+
| import_phone_number | false | phone_number, agent_id, fields |
|
|
30
|
+
| update_phone_number | false | phone_number, fields |
|
|
31
|
+
| delete_phone_number | false | phone_number, confirm |
|
|
32
|
+
| set_number_web_calls | false | phone_number, enabled |
|
|
33
|
+
| get_caller_context | true | phone_number, caller_number |
|
|
34
|
+
| set_caller_context | false | phone_number, caller_number, name, email, phone, location, reference_id, preference |
|
|
35
|
+
| import_caller_context | false | phone_number, callers |
|
|
36
|
+
| delete_caller_context | false | phone_number, caller_number, confirm |
|
|
37
|
+
| send_sms | false | agent_id, from_number, to, message, context, recipient_country, recipient_timezone |
|
|
38
|
+
| create_sms_campaign | false | agent_id, from_number, name, recipients, consent_confirmed, duplicate_policy, allow_wider_hours, hours_confirmation, schedule_type, scheduled_date, window_start_minutes, window_end_minutes, window_days, timezone, skip_invalid, reply_window_hours, reply_context_prompt, fields, message, message_template |
|
|
39
|
+
| launch_sms_campaign | false | campaign_id |
|
|
40
|
+
| list_sms_campaigns | true | status, limit, before |
|
|
41
|
+
| get_sms_campaign | true | campaign_id, limit, recipient_cursor, message_cursor |
|
|
42
|
+
| delete_sms_campaign | false | campaign_id, confirm |
|
|
43
|
+
| set_webhook | false | phone_number, url, slot |
|
|
44
|
+
| get_webhook | true | phone_number, slot |
|
|
45
|
+
| delete_webhook | false | phone_number, slot, confirm |
|
|
46
|
+
| get_organisation | true | |
|
|
47
|
+
| list_organisation_members | true | |
|
|
48
|
+
| list_organisation_activity | true | before, actor |
|
|
49
|
+
| invite_organisation_member | false | email, role, confirm |
|
|
50
|
+
| resend_organisation_invite | false | invite_id, confirm |
|
|
51
|
+
| revoke_organisation_invite | false | invite_id, confirm |
|
|
52
|
+
| remove_organisation_member | false | user_id, confirm |
|
|
53
|
+
| update_organisation_member_role | false | user_id, role, confirm |
|
|
54
|
+
| claim_organisation_owner | false | email, confirm |
|
|
55
|
+
| get_account_retention | true | |
|
|
56
|
+
| get_key_activity | true | period |
|
|
57
|
+
| list_voices | true | agent_id, agent_language, language, gender, locale, availability, limit, cursor |
|
|
58
|
+
| get_voice | true | voice_key, agent_id, agent_language |
|
|
59
|
+
| list_campaigns | true | status, limit |
|
|
60
|
+
| cancel_campaign | false | id, confirm |
|
|
61
|
+
| update_sms_campaign | false | id, body, confirm |
|
|
62
|
+
| cancel_sms_campaign | false | id, confirm |
|
|
63
|
+
| preview_contact_hours | true | agent_id, recipients, campaign |
|
|
64
|
+
| list_contact_suppressions | true | channel, after, business_number, scope, source |
|
|
65
|
+
| add_contact_suppressions | false | phone_numbers, channel, business_number, confirm |
|
|
66
|
+
| get_web_agent | true | number |
|
|
67
|
+
| update_web_agent | false | number, body, confirm |
|
|
68
|
+
| list_inbox_conversations | true | channel, number, archived, unread, search, since, period, limit, offset |
|
|
69
|
+
| get_inbox_thread | true | channel, number, thread, limit, before, before_id |
|
|
70
|
+
| update_inbox_thread | false | channel, number, thread, body, confirm |
|
|
71
|
+
| get_inbox_features | true | |
|
|
72
|
+
| list_inbox_numbers | true | offset |
|
|
73
|
+
| get_inbox_retention | true | number |
|
|
74
|
+
| get_calcom | true | phone_number |
|
|
75
|
+
| get_slack | true | phone_number |
|
|
76
|
+
| get_zapier | true | phone_number |
|
|
77
|
+
| get_make | true | phone_number |
|
|
78
|
+
| get_gohighlevel | true | phone_number |
|
|
79
|
+
| get_number_web_calls | true | phone_number |
|
|
80
|
+
| get_number_precall | true | phone_number |
|
|
81
|
+
| get_agent_precall | true | agent_id |
|
|
82
|
+
| list_custom_functions | true | phone_number |
|
|
83
|
+
| list_organisation_activity_filtered | true | before, actor, from, to |
|
|
84
|
+
| rename_organisation | false | name, confirm |
|
|
85
|
+
| get_agent_knowledge | true | target |
|
|
86
|
+
| get_agent_knowledge_keyterms | true | target |
|
|
87
|
+
| measure_knowledge_source | true | target, text |
|
|
88
|
+
| start_knowledge_test | false | target, mode, channel, draft_id, idempotency_key, confirm |
|
|
89
|
+
| get_knowledge_base | true | kb |
|
|
90
|
+
| get_knowledge_overview | true | kb |
|
|
91
|
+
| list_knowledge_sources | true | kb, limit, cursor |
|
|
92
|
+
| search_knowledge_topics | true | kb, query |
|
|
93
|
+
| list_knowledge_topics | true | kb, limit, cursor |
|
|
94
|
+
| get_knowledge_topic | true | kb, id |
|
|
95
|
+
| list_knowledge_unanswered | true | kb, limit, cursor |
|
|
96
|
+
| get_knowledge_capabilities | true | |
|
|
97
|
+
| list_knowledge_events | true | cursor |
|
|
98
|
+
| get_knowledge_job | true | id |
|
|
99
|
+
| list_knowledge_targets | true | limit, cursor, q, target |
|
|
100
|
+
| get_knowledge_test | true | id |
|
|
101
|
+
| cancel_knowledge_test | false | id, idempotency_key, confirm |
|
|
102
|
+
| ask_knowledge_test | false | id, text, idempotency_key, confirm |
|
|
103
|
+
| get_knowledge_usage | true | kb |
|
|
104
|
+
|
|
105
|
+
## Calendar and number features
|
|
106
|
+
|
|
107
|
+
| HTTP operation (number is URL-encoded E.164) | Node / CLI command | Python sync + async | MCP |
|
|
108
|
+
| --- | --- | --- | --- |
|
|
109
|
+
| POST /v1/integrations/google-calendar/number/{number}/connect | integrations.connectGoogleCalendar / integrations connectGoogleCalendar | integrations.connect_google_calendar | connect_google_calendar |
|
|
110
|
+
| GET /v1/integrations/google-calendar/number/{number} | integrations.getGoogleCalendar / integrations getGoogleCalendar | integrations.get_google_calendar | get_google_calendar |
|
|
111
|
+
| DELETE /v1/integrations/google-calendar/number/{number} | integrations.disconnectGoogleCalendar / integrations disconnectGoogleCalendar | integrations.disconnect_google_calendar | disconnect_google_calendar |
|
|
112
|
+
| PATCH /v1/integrations/google-calendar/number/{number} | integrations.updateGoogleCalendarSettings / integrations updateGoogleCalendarSettings | integrations.update_google_calendar_settings | update_google_calendar_settings |
|
|
113
|
+
| POST /v1/phone-numbers/{number}/credentials | phoneNumbers.updateCredentials / numbers updateCredentials | phone_numbers.update_credentials | update_phone_number_credentials |
|
|
114
|
+
|
|
115
|
+
See NUMBER-FEATURES.md for exact input/output and errors.
|
|
116
|
+
|
|
117
|
+
## Call results and requests
|
|
118
|
+
|
|
119
|
+
| Operation | Node | CLI | Python sync / async | MCP |
|
|
120
|
+
| --- | --- | --- | --- | --- |
|
|
121
|
+
| GET /v1/calls/{call_id}/bookings | calls.bookings(id) | calls bookings ID | calls.bookings(id) | get_call_bookings |
|
|
122
|
+
| POST /v1/calls/outbound, optional UUID request_id | calls.create(params) | calls create --request-id UUID or --body @prepared.json | calls.create(..., request_id=uuid) | create_call, optional request_id / safe_retry / confirm |
|
|
123
|
+
| GET /v1/calls/outbound/requests/{request_id} | calls.outboundRequest(uuid) | calls outboundRequest UUID | calls.outbound_request(uuid) | get_outbound_call_request |
|
|
124
|
+
| Local preparation, no API request | calls.prepare(params), prepareOutboundCall(params) | calls prepare --output prepared.json | calls.prepare(**params), prepare_outbound_call(params) | create_call with safe_retry:true and no request_id |
|
|
125
|
+
|
|
126
|
+
Use the two GET routes to read the booking result or look up an outbound request. Preparing a UUID locally sends no API request.
|
|
127
|
+
|
|
128
|
+
See CALL-REQUESTS.md for exact fields, typed errors, unchanged no-ID behavior and CLI/MCP confirmation rules.
|
|
129
|
+
|
|
130
|
+
## Deleting calls and campaigns
|
|
131
|
+
|
|
132
|
+
| Tool | Read only | Arguments |
|
|
133
|
+
|---|---|---|
|
|
134
|
+
| delete_campaign | false | campaign_id, confirm |
|
|
135
|
+
|
|
136
|
+
See [DELETING-CONTENT.md](DELETING-CONTENT.md) for the three receipts, queued 503, permissions, uncertainty and unchanged bulk guard.
|
|
@@ -1,118 +1,128 @@
|
|
|
1
|
-
#
|
|
2
|
-
|
|
3
|
-
Examples are not an instruction to perform a live write. Use your owned number and explicit environment; no keys or carrier secrets belong in source, terminal arguments or chat. API authentication is NIXFLEX_API_KEY.
|
|
4
|
-
|
|
5
|
-
## Node / TypeScript
|
|
6
|
-
|
|
7
|
-
```ts
|
|
8
|
-
import Nixflex, {NixflexDoNotContactError, NixflexInvalidRequestError,
|
|
9
|
-
type Booking, type CallCompletedBookingEvent, type SmsBookingEvent} from 'nixflex';
|
|
10
|
-
const client = new Nixflex({apiKey:process.env.NIXFLEX_API_KEY!, baseUrl:process.env.NIXFLEX_BASE_URL!});
|
|
11
|
-
const number = '+12025550123'; // fictional example; replace with your owned number
|
|
12
|
-
const consent = await client.integrations.connectGoogleCalendar(number, 'https://app.example.test/calendar-return');
|
|
13
|
-
// Present consent.url privately to the human; never auto-open or log it.
|
|
14
|
-
const status = await client.integrations.getGoogleCalendar(number);
|
|
15
|
-
if (status.needs_reconnect) { /* Request fresh human consent, not a silent reconnect. */ }
|
|
16
|
-
const settings = await client.integrations.updateGoogleCalendarSettings(number, {
|
|
17
|
-
timezone:'America/New_York', slot_minutes:30, calendar_id:'primary', send_invites:false,
|
|
18
|
-
hours:{monday:['09:00','17:00'],tuesday:['09:00','17:00'],wednesday:['09:00','17:00'],
|
|
19
|
-
thursday:['09:00','17:00'],friday:['09:00','17:00'],saturday:null,sunday:null}
|
|
20
|
-
});
|
|
21
|
-
// Only on a separate, deliberate disconnect request:
|
|
22
|
-
await client.integrations.disconnectGoogleCalendar(number);
|
|
23
|
-
// Sensitive routing change. Read values from a privately configured process, never log.
|
|
24
|
-
const receipt = await client.phoneNumbers.updateCredentials(number, {
|
|
25
|
-
twilio_sid:process.env.NIXFLEX_TWILIO_SID!,twilio_token:process.env.NIXFLEX_TWILIO_TOKEN!
|
|
26
|
-
});
|
|
27
|
-
try {
|
|
28
|
-
await client.sms.send({agent_id:'your-agent-id',from_number:number,to:'+12025550124',message:'Requested information'});
|
|
29
|
-
} catch (error) {
|
|
30
|
-
if (error instanceof NixflexDoNotContactError) { /* Stop; do not resend or remove suppression. */ }
|
|
31
|
-
else if (error instanceof NixflexInvalidRequestError) { /* Retain old 400 validation/suppression handling. */ }
|
|
32
|
-
else throw error;
|
|
33
|
-
}
|
|
34
|
-
function bookingPart(event: CallCompletedBookingEvent | SmsBookingEvent): Booking[] {
|
|
35
|
-
// Call only AFTER the existing verifier has checked the original raw webhook body.
|
|
36
|
-
return event.event === 'call.completed' ? event.bookings : [event.booking];
|
|
37
|
-
}
|
|
38
|
-
```
|
|
39
|
-
|
|
40
|
-
Telnyx uses the same updateCredentials method with only `{telnyx_api_key:process.env.NIXFLEX_TELNYX_API_KEY!,telnyx_connection_id:process.env.NIXFLEX_TELNYX_CONNECTION_ID!}`. Never mix pairs or send provider in the body. Type assertions are not runtime secret validation; the method rejects missing/invalid pairs without HTTP.
|
|
41
|
-
|
|
42
|
-
## Python sync and async
|
|
43
|
-
|
|
44
|
-
```python
|
|
45
|
-
import os
|
|
46
|
-
from nixflex import (Nixflex, AsyncNixflex, NixflexDoNotContactError,
|
|
47
|
-
NixflexInvalidRequestError, Booking, CallCompletedBookingEvent, SmsBookingEvent)
|
|
48
|
-
number = '+12025550123'
|
|
49
|
-
config = dict(api_key=os.environ['NIXFLEX_API_KEY'],base_url=os.environ['NIXFLEX_BASE_URL'])
|
|
50
|
-
with Nixflex(**config) as client:
|
|
51
|
-
consent = client.integrations.connect_google_calendar(number, 'https://app.example.test/calendar-return')
|
|
52
|
-
# Present the short-lived link privately to a human; never print it to logs.
|
|
53
|
-
status = client.integrations.get_google_calendar(number)
|
|
54
|
-
settings = client.integrations.update_google_calendar_settings(number, send_invites=False)
|
|
55
|
-
# Separate deliberate disconnect:
|
|
56
|
-
client.integrations.disconnect_google_calendar(number)
|
|
57
|
-
receipt = client.phone_numbers.update_credentials(number,
|
|
58
|
-
telnyx_api_key=os.environ['NIXFLEX_TELNYX_API_KEY'],
|
|
59
|
-
telnyx_connection_id=os.environ['NIXFLEX_TELNYX_CONNECTION_ID'])
|
|
60
|
-
try:
|
|
61
|
-
client.sms.send(agent_id='your-agent-id',from_number=number,to='+12025550124',message='Requested information')
|
|
62
|
-
except NixflexDoNotContactError:
|
|
63
|
-
pass # Stop; nothing sent. Do not retry or bypass opt-out.
|
|
64
|
-
except NixflexInvalidRequestError:
|
|
65
|
-
pass # Existing old-server 400 handling; not all validation failures mean opt-out.
|
|
66
|
-
|
|
67
|
-
async def read_status():
|
|
68
|
-
async with AsyncNixflex(**config) as client:
|
|
69
|
-
return await client.integrations.get_google_calendar(number)
|
|
70
|
-
# Every other method has the same arguments and is awaited in AsyncNixflex.
|
|
71
|
-
|
|
72
|
-
def booking_part(event):
|
|
73
|
-
# Only after raw-body signature verification. TypedDict is not authentication.
|
|
74
|
-
return event['bookings'] if event['event'] == 'call.completed' else [event['booking']]
|
|
75
|
-
```
|
|
76
|
-
|
|
77
|
-
## CLI (PowerShell-safe argument shapes)
|
|
78
|
-
|
|
79
|
-
Privately configure NIXFLEX_API_KEY, NIXFLEX_BASE_URL and the selected carrier pair. These command lines contain no secret values. These are independent actions, not one recommended sequence.
|
|
80
|
-
|
|
81
|
-
```powershell
|
|
82
|
-
nixflex integrations connectGoogleCalendar '+12025550123' --return-url 'https://app.example.test/calendar-return' --confirm
|
|
83
|
-
nixflex integrations getGoogleCalendar '+12025550123' --json
|
|
84
|
-
nixflex integrations updateGoogleCalendarSettings '+12025550123' --body '@calendar-settings.json' --confirm
|
|
85
|
-
nixflex integrations disconnectGoogleCalendar '+12025550123' --confirm
|
|
86
|
-
nixflex numbers updateCredentials '+12025550123' --provider twilio --confirm --json
|
|
87
|
-
# Alternative: a trusted local secret-manager process pipes the exact JSON pair to stdin:
|
|
88
|
-
# <private secret-manager command> | nixflex numbers updateCredentials '+12025550123' --provider telnyx --credentials-stdin --confirm
|
|
89
|
-
```
|
|
90
|
-
|
|
91
|
-
calendar-settings.json contains settings only, e.g. `{"send_invites":false}`; never carrier credentials. Omit --confirm to preview without a request. Credential commands reject --body, --key and secret flags before the argument parser can echo values. SMS --json errors expose status/type/code: stop on 409 do_not_contact; retain old 400 handling. Webhook types do not add a CLI listener or ingest endpoint.
|
|
92
|
-
|
|
93
|
-
##
|
|
94
|
-
|
|
95
|
-
Ask the human to approve the exact number/change before using confirm:true. Credentials are preconfigured privately in the SERVER process environment, never tool arguments or chat. Missing configuration sends nothing.
|
|
96
|
-
|
|
97
|
-
| Tool | Arguments example | Result |
|
|
98
|
-
| --- | --- | --- |
|
|
99
|
-
| connect_google_calendar | `{ "phone_number":"+12025550123", "return_url":"https://app.example.test/calendar-return", "confirm":true }` | Consent url + expires_at; human opens it |
|
|
100
|
-
| get_google_calendar | `{ "phone_number":"+12025550123" }` | Six status fields including needs_reconnect and send_invites |
|
|
101
|
-
| update_google_calendar_settings | `{ "phone_number":"+12025550123", "send_invites":false, "confirm":true }` | Safe settings, false preserved |
|
|
102
|
-
| disconnect_google_calendar | `{ "phone_number":"+12025550123", "confirm":true }` | ok:true, connected:false; no claim of remote revoke |
|
|
103
|
-
| update_phone_number_credentials | `{ "phone_number":"+12025550123", "provider":"twilio", "confirm":true }` | Number, provider, updated:true only |
|
|
104
|
-
|
|
105
|
-
All new writes without confirmation return confirmation_required:true, sent:false. Google settings accepts the same fields as Node/Python, including the seven-day hours object above. Use provider telnyx for the alternate private environment pair. No bulk deletion, signup, suppression removal, campaign resume/consent or hidden-write Knowledge draft tool is added.
|
|
106
|
-
|
|
107
|
-
MCP SMS errors use `error.status=409`, `error.type=conflict`, `error.code=do_not_contact`; report that nothing was sent and stop. Older 400 invalid_request remains generic. The shipped booking schema can validate the booking part of an authenticated webhook locally:
|
|
108
|
-
|
|
109
|
-
```js
|
|
110
|
-
import {callCompletedBookingSchema, smsBookingSchema} from 'nixflex-mcp/
|
|
111
|
-
// verifiedEvent is supplied only after existing raw-body signature verification.
|
|
112
|
-
function parseBookingEvent(verifiedEvent) {
|
|
113
|
-
return verifiedEvent.event === 'call.completed'
|
|
114
|
-
? callCompletedBookingSchema.parse(verifiedEvent) : smsBookingSchema.parse(verifiedEvent);
|
|
115
|
-
}
|
|
116
|
-
```
|
|
117
|
-
|
|
118
|
-
No MCP webhook-receiver tool is registered. Booking required keys: action, booking_uid, start, end, attendee_name, attendee_email, service, timezone. Preserve null; service can be numeric. Never count internal already_exists lookups as mutations.
|
|
1
|
+
# Number, calendar and booking examples
|
|
2
|
+
|
|
3
|
+
Examples are not an instruction to perform a live write. Use your owned number and explicit environment; no keys or carrier secrets belong in source, terminal arguments or chat. API authentication is NIXFLEX_API_KEY.
|
|
4
|
+
|
|
5
|
+
## Node / TypeScript
|
|
6
|
+
|
|
7
|
+
```ts
|
|
8
|
+
import Nixflex, {NixflexDoNotContactError, NixflexInvalidRequestError,
|
|
9
|
+
type Booking, type CallCompletedBookingEvent, type SmsBookingEvent} from 'nixflex';
|
|
10
|
+
const client = new Nixflex({apiKey:process.env.NIXFLEX_API_KEY!, baseUrl:process.env.NIXFLEX_BASE_URL!});
|
|
11
|
+
const number = '+12025550123'; // fictional example; replace with your owned number
|
|
12
|
+
const consent = await client.integrations.connectGoogleCalendar(number, 'https://app.example.test/calendar-return');
|
|
13
|
+
// Present consent.url privately to the human; never auto-open or log it.
|
|
14
|
+
const status = await client.integrations.getGoogleCalendar(number);
|
|
15
|
+
if (status.needs_reconnect) { /* Request fresh human consent, not a silent reconnect. */ }
|
|
16
|
+
const settings = await client.integrations.updateGoogleCalendarSettings(number, {
|
|
17
|
+
timezone:'America/New_York', slot_minutes:30, calendar_id:'primary', send_invites:false,
|
|
18
|
+
hours:{monday:['09:00','17:00'],tuesday:['09:00','17:00'],wednesday:['09:00','17:00'],
|
|
19
|
+
thursday:['09:00','17:00'],friday:['09:00','17:00'],saturday:null,sunday:null}
|
|
20
|
+
});
|
|
21
|
+
// Only on a separate, deliberate disconnect request:
|
|
22
|
+
await client.integrations.disconnectGoogleCalendar(number);
|
|
23
|
+
// Sensitive routing change. Read values from a privately configured process, never log.
|
|
24
|
+
const receipt = await client.phoneNumbers.updateCredentials(number, {
|
|
25
|
+
twilio_sid:process.env.NIXFLEX_TWILIO_SID!,twilio_token:process.env.NIXFLEX_TWILIO_TOKEN!
|
|
26
|
+
});
|
|
27
|
+
try {
|
|
28
|
+
await client.sms.send({agent_id:'your-agent-id',from_number:number,to:'+12025550124',message:'Requested information'});
|
|
29
|
+
} catch (error) {
|
|
30
|
+
if (error instanceof NixflexDoNotContactError) { /* Stop; do not resend or remove suppression. */ }
|
|
31
|
+
else if (error instanceof NixflexInvalidRequestError) { /* Retain old 400 validation/suppression handling. */ }
|
|
32
|
+
else throw error;
|
|
33
|
+
}
|
|
34
|
+
function bookingPart(event: CallCompletedBookingEvent | SmsBookingEvent): Booking[] {
|
|
35
|
+
// Call only AFTER the existing verifier has checked the original raw webhook body.
|
|
36
|
+
return event.event === 'call.completed' ? event.bookings : [event.booking];
|
|
37
|
+
}
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
Telnyx uses the same updateCredentials method with only `{telnyx_api_key:process.env.NIXFLEX_TELNYX_API_KEY!,telnyx_connection_id:process.env.NIXFLEX_TELNYX_CONNECTION_ID!}`. Never mix pairs or send provider in the body. Type assertions are not runtime secret validation; the method rejects missing/invalid pairs without HTTP.
|
|
41
|
+
|
|
42
|
+
## Python sync and async
|
|
43
|
+
|
|
44
|
+
```python
|
|
45
|
+
import os
|
|
46
|
+
from nixflex import (Nixflex, AsyncNixflex, NixflexDoNotContactError,
|
|
47
|
+
NixflexInvalidRequestError, Booking, CallCompletedBookingEvent, SmsBookingEvent)
|
|
48
|
+
number = '+12025550123'
|
|
49
|
+
config = dict(api_key=os.environ['NIXFLEX_API_KEY'],base_url=os.environ['NIXFLEX_BASE_URL'])
|
|
50
|
+
with Nixflex(**config) as client:
|
|
51
|
+
consent = client.integrations.connect_google_calendar(number, 'https://app.example.test/calendar-return')
|
|
52
|
+
# Present the short-lived link privately to a human; never print it to logs.
|
|
53
|
+
status = client.integrations.get_google_calendar(number)
|
|
54
|
+
settings = client.integrations.update_google_calendar_settings(number, send_invites=False)
|
|
55
|
+
# Separate deliberate disconnect:
|
|
56
|
+
client.integrations.disconnect_google_calendar(number)
|
|
57
|
+
receipt = client.phone_numbers.update_credentials(number,
|
|
58
|
+
telnyx_api_key=os.environ['NIXFLEX_TELNYX_API_KEY'],
|
|
59
|
+
telnyx_connection_id=os.environ['NIXFLEX_TELNYX_CONNECTION_ID'])
|
|
60
|
+
try:
|
|
61
|
+
client.sms.send(agent_id='your-agent-id',from_number=number,to='+12025550124',message='Requested information')
|
|
62
|
+
except NixflexDoNotContactError:
|
|
63
|
+
pass # Stop; nothing sent. Do not retry or bypass opt-out.
|
|
64
|
+
except NixflexInvalidRequestError:
|
|
65
|
+
pass # Existing old-server 400 handling; not all validation failures mean opt-out.
|
|
66
|
+
|
|
67
|
+
async def read_status():
|
|
68
|
+
async with AsyncNixflex(**config) as client:
|
|
69
|
+
return await client.integrations.get_google_calendar(number)
|
|
70
|
+
# Every other method has the same arguments and is awaited in AsyncNixflex.
|
|
71
|
+
|
|
72
|
+
def booking_part(event):
|
|
73
|
+
# Only after raw-body signature verification. TypedDict is not authentication.
|
|
74
|
+
return event['bookings'] if event['event'] == 'call.completed' else [event['booking']]
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
## CLI (PowerShell-safe argument shapes)
|
|
78
|
+
|
|
79
|
+
Privately configure NIXFLEX_API_KEY, NIXFLEX_BASE_URL and the selected carrier pair. These command lines contain no secret values. These are independent actions, not one recommended sequence.
|
|
80
|
+
|
|
81
|
+
```powershell
|
|
82
|
+
nixflex integrations connectGoogleCalendar '+12025550123' --return-url 'https://app.example.test/calendar-return' --confirm
|
|
83
|
+
nixflex integrations getGoogleCalendar '+12025550123' --json
|
|
84
|
+
nixflex integrations updateGoogleCalendarSettings '+12025550123' --body '@calendar-settings.json' --confirm
|
|
85
|
+
nixflex integrations disconnectGoogleCalendar '+12025550123' --confirm
|
|
86
|
+
nixflex numbers updateCredentials '+12025550123' --provider twilio --confirm --json
|
|
87
|
+
# Alternative: a trusted local secret-manager process pipes the exact JSON pair to stdin:
|
|
88
|
+
# <private secret-manager command> | nixflex numbers updateCredentials '+12025550123' --provider telnyx --credentials-stdin --confirm
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
calendar-settings.json contains settings only, e.g. `{"send_invites":false}`; never carrier credentials. Omit --confirm to preview without a request. Credential commands reject --body, --key and secret flags before the argument parser can echo values. SMS --json errors expose status/type/code: stop on 409 do_not_contact; retain old 400 handling. Webhook types do not add a CLI listener or ingest endpoint.
|
|
92
|
+
|
|
93
|
+
## Calendar and number tools for MCP
|
|
94
|
+
|
|
95
|
+
Ask the human to approve the exact number/change before using confirm:true. Credentials are preconfigured privately in the SERVER process environment, never tool arguments or chat. Missing configuration sends nothing.
|
|
96
|
+
|
|
97
|
+
| Tool | Arguments example | Result |
|
|
98
|
+
| --- | --- | --- |
|
|
99
|
+
| connect_google_calendar | `{ "phone_number":"+12025550123", "return_url":"https://app.example.test/calendar-return", "confirm":true }` | Consent url + expires_at; human opens it |
|
|
100
|
+
| get_google_calendar | `{ "phone_number":"+12025550123" }` | Six status fields including needs_reconnect and send_invites |
|
|
101
|
+
| update_google_calendar_settings | `{ "phone_number":"+12025550123", "send_invites":false, "confirm":true }` | Safe settings, false preserved |
|
|
102
|
+
| disconnect_google_calendar | `{ "phone_number":"+12025550123", "confirm":true }` | ok:true, connected:false; no claim of remote revoke |
|
|
103
|
+
| update_phone_number_credentials | `{ "phone_number":"+12025550123", "provider":"twilio", "confirm":true }` | Number, provider, updated:true only |
|
|
104
|
+
|
|
105
|
+
All new writes without confirmation return confirmation_required:true, sent:false. Google settings accepts the same fields as Node/Python, including the seven-day hours object above. Use provider telnyx for the alternate private environment pair. No bulk deletion, signup, suppression removal, campaign resume/consent or hidden-write Knowledge draft tool is added.
|
|
106
|
+
|
|
107
|
+
MCP SMS errors use `error.status=409`, `error.type=conflict`, `error.code=do_not_contact`; report that nothing was sent and stop. Older 400 invalid_request remains generic. The shipped booking schema can validate the booking part of an authenticated webhook locally:
|
|
108
|
+
|
|
109
|
+
```js
|
|
110
|
+
import {callCompletedBookingSchema, smsBookingSchema} from 'nixflex-mcp/booking-schemas.js';
|
|
111
|
+
// verifiedEvent is supplied only after existing raw-body signature verification.
|
|
112
|
+
function parseBookingEvent(verifiedEvent) {
|
|
113
|
+
return verifiedEvent.event === 'call.completed'
|
|
114
|
+
? callCompletedBookingSchema.parse(verifiedEvent) : smsBookingSchema.parse(verifiedEvent);
|
|
115
|
+
}
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
No MCP webhook-receiver tool is registered. Booking required keys: action, booking_uid, start, end, attendee_name, attendee_email, service, timezone. Preserve null; service can be numeric. Never count internal already_exists lookups as mutations.
|
|
119
|
+
|
|
120
|
+
## Contact blocks by business number
|
|
121
|
+
|
|
122
|
+
A STOP received on one number blocks calls and texts from that number. Do not switch senders to bypass an objection. Existing all-number blocks still apply. Check the relevant channel as well as the separate `all` channel bucket.
|
|
123
|
+
|
|
124
|
+
The field `business_number` tells you which sender is blocked. The field `opted_out_business_number` records where the message arrived. For one owned sender, use `scope=effective` to include all-number blocks. A sender alone filters keyword evidence. Use `business_number=all` to list only global entries. Keep filters unchanged and pass each opaque `next_cursor` back as `after` until null. The same recipient can occur on both sides of a page boundary.
|
|
125
|
+
|
|
126
|
+
Use `list_contact_suppressions` with `{"business_number":"+12025550101","scope":"effective"}`. For `add_contact_suppressions`, review `{"phone_numbers":["+12025550100"],"business_number":"+12025550101"}` with the user. Only add `confirm:true` after explicit confirmation. MCP cannot remove blocks. A person must review eligible owner entries in the dashboard, API, SDK or CLI.
|
|
127
|
+
|
|
128
|
+
Omitting the sender on a write targets all numbers. List filters never change this default. A locked STOP cannot be removed. After an uncertain write, check the list before deciding what to do. Never retry automatically.
|
package/NUMBER-FEATURES.md
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
#
|
|
2
|
-
|
|
3
|
-
Engine contract: deb63749acc74fe5d1d840dbf3589b2c40b5627e (B50/B50b/B51/B52). No engine changes. Public Cal.com methods remain unchanged.
|
|
1
|
+
# Calendar, number credentials, SMS and bookings
|
|
4
2
|
|
|
5
3
|
| HTTP operation (number is URL-encoded E.164) | Node / CLI command | Python sync + async | MCP |
|
|
6
4
|
| --- | --- | --- | --- |
|
|
@@ -44,8 +42,8 @@ New response: HTTP 409, type `conflict`, code `do_not_contact`. Node/Python rais
|
|
|
44
42
|
|
|
45
43
|
## Booking webhook model
|
|
46
44
|
|
|
47
|
-
Node/Python export Booking, CallCompletedBookingEvent and SmsBookingEvent. MCP ships bookingSchema, callCompletedBookingSchema and smsBookingSchema in
|
|
45
|
+
Node/Python export Booking, CallCompletedBookingEvent and SmsBookingEvent. MCP ships bookingSchema, callCompletedBookingSchema and smsBookingSchema in booking-schemas.js (models, not extra tools). Verify the original raw-body webhook signature first using the existing verifier; these models do not authenticate a delivery.
|
|
48
46
|
|
|
49
47
|
Required booking keys: action (`created`/`rescheduled`/`cancelled`), booking_uid, start, end, attendee_name, attendee_email, service, timezone. Every field except action can be null; service can also be a string or number. Do not turn null into fabricated dates or attendee data. The flat call.completed event has bookings[], sms.booking has booking. Duplicate `already_exists` lookup is internal and is NOT a public booking mutation. Event models describe the booking part; other existing envelope fields remain available. No webhook receiver or listener is added.
|
|
50
48
|
|
|
51
|
-
See
|
|
49
|
+
See [Number examples](NUMBER-EXAMPLES.md) for Node, CLI, Python and MCP usage.
|
package/ORGANISATIONS.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# Organisations in the main MCP server
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
Remove the old optional `nixflex-organisations-mcp` configuration when
|
|
3
|
+
The server registers all nine tools in `nixflex-mcp`; no second install, process or key.
|
|
4
|
+
Remove the old optional `nixflex-organisations-mcp` configuration when switching to the main server.
|
|
5
5
|
Reads: get_organisation, list_organisation_members, list_organisation_activity.
|
|
6
6
|
Changes: invite_organisation_member, resend_organisation_invite,
|
|
7
7
|
revoke_organisation_invite, remove_organisation_member,
|
|
@@ -11,4 +11,4 @@ The same existing full API key and explicitly bound approved API URL are used.
|
|
|
11
11
|
An API key has Owner authority; it is not a restricted dashboard Member credential.
|
|
12
12
|
Removing a dashboard member does not revoke a key shared externally; the Owner must rotate it.
|
|
13
13
|
No personal acceptance, Leave, ownership transfer, account deletion or signing-secret tool.
|
|
14
|
-
The rebuilt Desktop bundles include these nine tools.
|
|
14
|
+
The rebuilt Desktop bundles include these nine tools.
|