@servicialo/mcp-server 0.2.0 → 0.4.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/README.md +121 -43
- package/dist/client.d.ts +20 -6
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +58 -9
- package/dist/client.js.map +1 -1
- package/dist/index.js +82 -51
- package/dist/index.js.map +1 -1
- package/dist/mode.d.ts +9 -0
- package/dist/mode.d.ts.map +1 -0
- package/dist/mode.js +18 -0
- package/dist/mode.js.map +1 -0
- package/dist/tools/{clients.d.ts → authenticated/cerrar.d.ts} +76 -84
- package/dist/tools/authenticated/cerrar.d.ts.map +1 -0
- package/dist/tools/authenticated/cerrar.js +73 -0
- package/dist/tools/authenticated/cerrar.js.map +1 -0
- package/dist/tools/authenticated/comprometer.d.ts +204 -0
- package/dist/tools/authenticated/comprometer.d.ts.map +1 -0
- package/dist/tools/authenticated/comprometer.js +55 -0
- package/dist/tools/authenticated/comprometer.js.map +1 -0
- package/dist/tools/authenticated/delivery.d.ts +234 -0
- package/dist/tools/authenticated/delivery.d.ts.map +1 -0
- package/dist/tools/authenticated/delivery.js +53 -0
- package/dist/tools/authenticated/delivery.js.map +1 -0
- package/dist/tools/authenticated/entender.d.ts +35 -0
- package/dist/tools/authenticated/entender.d.ts.map +1 -0
- package/dist/tools/authenticated/entender.js +25 -0
- package/dist/tools/authenticated/entender.js.map +1 -0
- package/dist/tools/{scheduling.d.ts → authenticated/lifecycle.d.ts} +26 -103
- package/dist/tools/authenticated/lifecycle.d.ts.map +1 -0
- package/dist/tools/authenticated/lifecycle.js +63 -0
- package/dist/tools/authenticated/lifecycle.js.map +1 -0
- package/dist/tools/public/availability.d.ts +34 -0
- package/dist/tools/public/availability.d.ts.map +1 -0
- package/dist/tools/public/availability.js +22 -0
- package/dist/tools/public/availability.js.map +1 -0
- package/dist/tools/public/registry.d.ts +39 -0
- package/dist/tools/public/registry.d.ts.map +1 -0
- package/dist/tools/public/registry.js +28 -0
- package/dist/tools/public/registry.js.map +1 -0
- package/dist/tools/public/services.d.ts +18 -0
- package/dist/tools/public/services.d.ts.map +1 -0
- package/dist/tools/public/services.js +13 -0
- package/dist/tools/public/services.js.map +1 -0
- package/dist/tools/schemas.d.ts +40 -0
- package/dist/tools/schemas.d.ts.map +1 -0
- package/dist/tools/schemas.js +14 -0
- package/dist/tools/schemas.js.map +1 -0
- package/package.json +2 -2
- package/dist/tools/clients.d.ts.map +0 -1
- package/dist/tools/clients.js +0 -64
- package/dist/tools/clients.js.map +0 -1
- package/dist/tools/notifications.d.ts +0 -31
- package/dist/tools/notifications.d.ts.map +0 -1
- package/dist/tools/notifications.js +0 -22
- package/dist/tools/notifications.js.map +0 -1
- package/dist/tools/payments.d.ts +0 -105
- package/dist/tools/payments.d.ts.map +0 -1
- package/dist/tools/payments.js +0 -70
- package/dist/tools/payments.js.map +0 -1
- package/dist/tools/payroll.d.ts +0 -106
- package/dist/tools/payroll.d.ts.map +0 -1
- package/dist/tools/payroll.js +0 -77
- package/dist/tools/payroll.js.map +0 -1
- package/dist/tools/providers.d.ts +0 -52
- package/dist/tools/providers.d.ts.map +0 -1
- package/dist/tools/providers.js +0 -37
- package/dist/tools/providers.js.map +0 -1
- package/dist/tools/scheduling.d.ts.map +0 -1
- package/dist/tools/scheduling.js +0 -99
- package/dist/tools/scheduling.js.map +0 -1
package/README.md
CHANGED
|
@@ -1,16 +1,28 @@
|
|
|
1
1
|
# @servicialo/mcp-server
|
|
2
2
|
|
|
3
|
-
MCP server for the [Servicialo](https://servicialo.com) protocol. Connects AI agents to professional services via
|
|
3
|
+
MCP server for the [Servicialo](https://servicialo.com) protocol. Connects AI agents to professional services via any Servicialo-compatible platform.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
20 tools organized by the 6 lifecycle phases of a service — not by database table.
|
|
6
|
+
|
|
7
|
+
## Two Modes of Operation
|
|
8
|
+
|
|
9
|
+
### Discovery Mode (no configuration)
|
|
6
10
|
|
|
7
11
|
```bash
|
|
8
12
|
npx -y @servicialo/mcp-server
|
|
9
13
|
```
|
|
10
14
|
|
|
11
|
-
|
|
15
|
+
No credentials needed. 4 public tools for discovering organizations, services, and availability.
|
|
16
|
+
|
|
17
|
+
### Authenticated Mode
|
|
12
18
|
|
|
13
|
-
|
|
19
|
+
```bash
|
|
20
|
+
SERVICIALO_API_KEY=your_key SERVICIALO_ORG_ID=your_org npx -y @servicialo/mcp-server
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
Requires `SERVICIALO_API_KEY` and `SERVICIALO_ORG_ID`. Enables all 20 tools across the full service lifecycle.
|
|
24
|
+
|
|
25
|
+
### Claude Desktop Configuration
|
|
14
26
|
|
|
15
27
|
```json
|
|
16
28
|
{
|
|
@@ -27,78 +39,144 @@ Add to your `claude_desktop_config.json`:
|
|
|
27
39
|
}
|
|
28
40
|
```
|
|
29
41
|
|
|
30
|
-
|
|
42
|
+
Omit the `env` block entirely for discovery-only mode.
|
|
31
43
|
|
|
32
44
|
## Environment Variables
|
|
33
45
|
|
|
34
46
|
| Variable | Required | Description |
|
|
35
47
|
|---|---|---|
|
|
36
|
-
| `SERVICIALO_API_KEY` |
|
|
37
|
-
| `SERVICIALO_ORG_ID` |
|
|
38
|
-
| `SERVICIALO_BASE_URL` | No | API base URL
|
|
48
|
+
| `SERVICIALO_API_KEY` | No | Bearer token — enables authenticated mode |
|
|
49
|
+
| `SERVICIALO_ORG_ID` | No | Organization slug — enables authenticated mode |
|
|
50
|
+
| `SERVICIALO_BASE_URL` | No | API base URL of the Servicialo-compatible platform |
|
|
51
|
+
|
|
52
|
+
## Agent Flow (6 Lifecycle Phases)
|
|
39
53
|
|
|
40
|
-
|
|
54
|
+
```
|
|
55
|
+
1. DESCUBRIR → registry.*, check_availability, services.list
|
|
56
|
+
2. ENTENDER → service.get, contract.get
|
|
57
|
+
3. COMPROMETER → clients.get_or_create, scheduling.book, scheduling.confirm
|
|
58
|
+
4. GESTIONAR → lifecycle.get_state, lifecycle.transition, reschedule, cancel
|
|
59
|
+
5. VERIFICAR → delivery.checkin, delivery.checkout, delivery.record_evidence
|
|
60
|
+
6. CERRAR → documentation.create, payments.create_sale, record_payment, get_status
|
|
61
|
+
```
|
|
41
62
|
|
|
42
|
-
|
|
63
|
+
A well-designed agent follows this order. Each phase has its tools. The standard guarantees any agent can complete the full cycle with any compatible implementation.
|
|
64
|
+
|
|
65
|
+
## Phase 1 — Descubrimiento (4 public tools)
|
|
43
66
|
|
|
44
67
|
| Tool | Description |
|
|
45
68
|
|---|---|
|
|
46
|
-
| `
|
|
47
|
-
| `
|
|
48
|
-
| `scheduling.
|
|
49
|
-
| `
|
|
50
|
-
| `scheduling.cancel` | Cancel a session |
|
|
69
|
+
| `registry.search` | Search organizations by vertical and location |
|
|
70
|
+
| `registry.get_organization` | Get public details of an organization |
|
|
71
|
+
| `scheduling.check_availability` | Check available slots without authentication |
|
|
72
|
+
| `services.list` | List the public service catalog |
|
|
51
73
|
|
|
52
|
-
|
|
74
|
+
## Phase 2 — Entender (2 tools)
|
|
53
75
|
|
|
54
76
|
| Tool | Description |
|
|
55
77
|
|---|---|
|
|
56
|
-
| `
|
|
57
|
-
| `
|
|
58
|
-
| `clients.create` | Create a new client |
|
|
59
|
-
| `clients.history` | Get client activity history: past sessions, payments |
|
|
78
|
+
| `service.get` | Get the 9 dimensions of a service: what, who delivers, who receives, who requests, who pays, when, where, evidence, outcome |
|
|
79
|
+
| `contract.get` | Get the pre-agreed service contract: required evidence, cancellation policy, no-show policy, dispute terms |
|
|
60
80
|
|
|
61
|
-
|
|
81
|
+
## Phase 3 — Comprometer (3 tools)
|
|
62
82
|
|
|
63
83
|
| Tool | Description |
|
|
64
84
|
|---|---|
|
|
65
|
-
| `
|
|
66
|
-
| `
|
|
67
|
-
| `
|
|
68
|
-
| `payments.client_balance` | Get client account balance and session availability |
|
|
85
|
+
| `clients.get_or_create` | Find a client by email/phone or create if new. Single call to resolve client identity before booking |
|
|
86
|
+
| `scheduling.book` | Book a new session → state "Solicitado". Requires contract.get first |
|
|
87
|
+
| `scheduling.confirm` | Confirm a booked session → state "Confirmado" |
|
|
69
88
|
|
|
70
|
-
|
|
89
|
+
## Phase 4 — Ciclo de Vida (4 tools)
|
|
71
90
|
|
|
72
91
|
| Tool | Description |
|
|
73
92
|
|---|---|
|
|
74
|
-
| `
|
|
75
|
-
| `
|
|
76
|
-
| `
|
|
93
|
+
| `lifecycle.get_state` | Get current lifecycle state, available transitions, and transition history |
|
|
94
|
+
| `lifecycle.transition` | Execute a state transition with evidence. Valid: requested→matched, matched→scheduled, scheduled→confirmed, confirmed→in_progress, in_progress→completed, completed→documented, documented→billed, billed→closed, any→cancelled |
|
|
95
|
+
| `scheduling.reschedule` | Exception flow: reschedule to new datetime. Contract rescheduling policy may apply |
|
|
96
|
+
| `scheduling.cancel` | Exception flow: cancel with contract cancellation policy applied |
|
|
77
97
|
|
|
78
|
-
|
|
98
|
+
## Phase 5 — Verificar Entrega (3 tools)
|
|
79
99
|
|
|
80
100
|
| Tool | Description |
|
|
81
101
|
|---|---|
|
|
82
|
-
| `
|
|
83
|
-
| `
|
|
84
|
-
| `
|
|
85
|
-
| `payroll.vacations` | Query vacation requests |
|
|
86
|
-
| `payroll.request_vacation` | Create a vacation request for a provider |
|
|
102
|
+
| `delivery.checkin` | Provider/client check-in with GPS + timestamp → state "En Curso" |
|
|
103
|
+
| `delivery.checkout` | Check-out with GPS + timestamp → state "Completado". Duration auto-calculated |
|
|
104
|
+
| `delivery.record_evidence` | Record delivery evidence per vertical: GPS, signature, photo, document, duration, notes |
|
|
87
105
|
|
|
88
|
-
|
|
106
|
+
## Phase 6 — Cerrar (4 tools)
|
|
89
107
|
|
|
90
108
|
| Tool | Description |
|
|
91
109
|
|---|---|
|
|
92
|
-
| `
|
|
93
|
-
| `
|
|
110
|
+
| `documentation.create` | Generate service record (clinical note, inspection report, class minutes, etc.) → state "Documentado" |
|
|
111
|
+
| `payments.create_sale` | Create a sale/charge for the documented service → state "Facturado" |
|
|
112
|
+
| `payments.record_payment` | Record payment received. When fully paid → state "Cerrado" |
|
|
113
|
+
| `payments.get_status` | Get payment status for a sale or client account balance |
|
|
114
|
+
|
|
115
|
+
## End-to-End Example
|
|
116
|
+
|
|
117
|
+
```
|
|
118
|
+
registry.search({ vertical: "kinesiologia", location: "santiago" })
|
|
119
|
+
→ find org "clinica-kinesia"
|
|
120
|
+
|
|
121
|
+
registry.get_organization({ org_slug: "clinica-kinesia" })
|
|
122
|
+
→ list services, providers
|
|
123
|
+
|
|
124
|
+
scheduling.check_availability({ org_slug: "clinica-kinesia", date_from: "2026-03-01", date_to: "2026-03-07" })
|
|
125
|
+
→ available slots
|
|
126
|
+
|
|
127
|
+
service.get({ service_id: "srv_123" })
|
|
128
|
+
→ 9 dimensions: duration 45min, location presencial, etc.
|
|
129
|
+
|
|
130
|
+
contract.get({ service_id: "srv_123", org_id: "org_456" })
|
|
131
|
+
→ evidence: check_in + check_out + clinical_record
|
|
132
|
+
→ cancellation: 0% if >24h, 50% if 2-24h, 100% if <2h
|
|
133
|
+
→ dispute window: 48 hours
|
|
134
|
+
|
|
135
|
+
clients.get_or_create({ email: "paciente@mail.com", name: "María", last_name: "López", actor: { type: "agent", id: "agent_1" } })
|
|
136
|
+
→ client_id: "cli_789"
|
|
137
|
+
|
|
138
|
+
scheduling.book({ service_id: "srv_123", provider_id: "prov_111", client_id: "cli_789", starts_at: "2026-03-03T10:00:00", actor: { type: "agent", id: "agent_1" } })
|
|
139
|
+
→ session_id: "ses_001", state: "requested"
|
|
140
|
+
|
|
141
|
+
scheduling.confirm({ session_id: "ses_001", actor: { type: "client", id: "cli_789" } })
|
|
142
|
+
→ state: "confirmed"
|
|
94
143
|
|
|
95
|
-
|
|
144
|
+
delivery.checkin({ session_id: "ses_001", actor: { type: "provider", id: "prov_111" }, location: { lat: -33.45, lng: -70.66 } })
|
|
145
|
+
→ state: "in_progress"
|
|
96
146
|
|
|
97
|
-
|
|
147
|
+
delivery.checkout({ session_id: "ses_001", actor: { type: "provider", id: "prov_111" }, location: { lat: -33.45, lng: -70.66 } })
|
|
148
|
+
→ state: "completed", duration: 42min
|
|
98
149
|
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
150
|
+
delivery.record_evidence({ session_id: "ses_001", evidence_type: "document", data: { type: "clinical_record", signed_by: ["prov_111", "cli_789"] }, actor: { type: "provider", id: "prov_111" } })
|
|
151
|
+
→ evidence recorded
|
|
152
|
+
|
|
153
|
+
documentation.create({ session_id: "ses_001", content: "Sesión de rehabilitación...", actor: { type: "provider", id: "prov_111" } })
|
|
154
|
+
→ state: "documented"
|
|
155
|
+
|
|
156
|
+
payments.create_sale({ client_id: "cli_789", service_id: "srv_123", provider_id: "prov_111", unit_price: 35000 })
|
|
157
|
+
→ sale_id: "sale_001", state: "billed"
|
|
158
|
+
|
|
159
|
+
payments.record_payment({ venta_id: "sale_001", amount: 35000, method: "transferencia" })
|
|
160
|
+
→ state: "closed"
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
## Migration from v0.3
|
|
164
|
+
|
|
165
|
+
| Removed Tool | Replacement |
|
|
166
|
+
|---|---|
|
|
167
|
+
| `scheduling.list_sessions` | `lifecycle.get_state` |
|
|
168
|
+
| `clients.list` | `clients.get_or_create` |
|
|
169
|
+
| `clients.get` | `clients.get_or_create` |
|
|
170
|
+
| `clients.create` | `clients.get_or_create` |
|
|
171
|
+
| `clients.history` | `lifecycle.get_state` |
|
|
172
|
+
| `payments.list_sales` | `payments.get_status` |
|
|
173
|
+
| `payments.client_balance` | `payments.get_status` |
|
|
174
|
+
| `notifications.send_session_reminder` | `lifecycle.transition` |
|
|
175
|
+
| `notifications.send_payment_reminder` | `lifecycle.transition` |
|
|
176
|
+
| `providers.list` | Removed (not part of service lifecycle) |
|
|
177
|
+
| `providers.get` | Removed (not part of service lifecycle) |
|
|
178
|
+
| `providers.get_commission` | Removed (not part of service lifecycle) |
|
|
179
|
+
| `payroll.*` (5 tools) | Removed (not part of service lifecycle) |
|
|
102
180
|
|
|
103
181
|
## Development
|
|
104
182
|
|
package/dist/client.d.ts
CHANGED
|
@@ -1,26 +1,40 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* HTTP client for Coordinalo REST API.
|
|
3
|
-
*
|
|
4
|
-
*
|
|
3
|
+
*
|
|
4
|
+
* Supports two modes:
|
|
5
|
+
* - Public: calls to /api/v1/public/* without Authorization header
|
|
6
|
+
* - Authenticated: calls to /api/organizations/{orgSlug}/* with Bearer token
|
|
5
7
|
*/
|
|
6
8
|
export interface ClientConfig {
|
|
7
9
|
baseUrl: string;
|
|
8
|
-
apiKey
|
|
9
|
-
orgId
|
|
10
|
+
apiKey?: string;
|
|
11
|
+
orgId?: string;
|
|
10
12
|
}
|
|
11
13
|
export declare class CoordinaloClient {
|
|
12
14
|
private baseUrl;
|
|
13
15
|
private apiKey;
|
|
14
16
|
private orgId;
|
|
15
17
|
constructor(config: ClientConfig);
|
|
18
|
+
/** Whether the client has credentials for authenticated operations */
|
|
19
|
+
get isAuthenticated(): boolean;
|
|
16
20
|
/** Base path for all org-scoped endpoints */
|
|
17
21
|
private orgPath;
|
|
18
|
-
private
|
|
22
|
+
private authHeaders;
|
|
23
|
+
private publicHeaders;
|
|
19
24
|
/**
|
|
20
|
-
* Build full URL
|
|
25
|
+
* Build full URL for authenticated (org-scoped) requests.
|
|
26
|
+
* If path starts with `/api/` it's used as-is (absolute).
|
|
21
27
|
* Otherwise it's appended to the org-scoped base path.
|
|
22
28
|
*/
|
|
23
29
|
private buildUrl;
|
|
30
|
+
/**
|
|
31
|
+
* Build full URL for public requests.
|
|
32
|
+
* Path must be absolute (e.g., /api/v1/public/registry).
|
|
33
|
+
*/
|
|
34
|
+
private buildPublicUrl;
|
|
35
|
+
readonly pub: {
|
|
36
|
+
get: (path: string, params?: Record<string, string | number | undefined>) => Promise<unknown>;
|
|
37
|
+
};
|
|
24
38
|
get(path: string, params?: Record<string, string | number | undefined>): Promise<unknown>;
|
|
25
39
|
post(path: string, body?: unknown): Promise<unknown>;
|
|
26
40
|
put(path: string, body?: unknown): Promise<unknown>;
|
package/dist/client.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,MAAM,WAAW,YAAY;IAC3B,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,qBAAa,gBAAgB;IAC3B,OAAO,CAAC,OAAO,CAAS;IACxB,OAAO,CAAC,MAAM,CAAqB;IACnC,OAAO,CAAC,KAAK,CAAqB;gBAEtB,MAAM,EAAE,YAAY;IAMhC,sEAAsE;IACtE,IAAI,eAAe,IAAI,OAAO,CAE7B;IAID,6CAA6C;IAC7C,OAAO,CAAC,OAAO;IAOf,OAAO,CAAC,WAAW;IAUnB,OAAO,CAAC,aAAa;IAMrB;;;;OAIG;IACH,OAAO,CAAC,QAAQ;IAOhB;;;OAGG;IACH,OAAO,CAAC,cAAc;IAMtB,QAAQ,CAAC,GAAG;oBACQ,MAAM,WAAW,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAAC,KAAG,OAAO,CAAC,OAAO,CAAC;MAsBjG;IAII,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAAC,GAAG,OAAO,CAAC,OAAO,CAAC;IAuBzF,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC;IAepD,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC;IAenD,KAAK,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC;IAerD,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;CAa7C"}
|
package/dist/client.js
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* HTTP client for Coordinalo REST API.
|
|
3
|
-
*
|
|
4
|
-
*
|
|
3
|
+
*
|
|
4
|
+
* Supports two modes:
|
|
5
|
+
* - Public: calls to /api/v1/public/* without Authorization header
|
|
6
|
+
* - Authenticated: calls to /api/organizations/{orgSlug}/* with Bearer token
|
|
5
7
|
*/
|
|
6
8
|
export class CoordinaloClient {
|
|
7
9
|
baseUrl;
|
|
@@ -12,18 +14,35 @@ export class CoordinaloClient {
|
|
|
12
14
|
this.apiKey = config.apiKey;
|
|
13
15
|
this.orgId = config.orgId;
|
|
14
16
|
}
|
|
17
|
+
/** Whether the client has credentials for authenticated operations */
|
|
18
|
+
get isAuthenticated() {
|
|
19
|
+
return !!this.apiKey && !!this.orgId;
|
|
20
|
+
}
|
|
21
|
+
// --- Private helpers ---
|
|
15
22
|
/** Base path for all org-scoped endpoints */
|
|
16
23
|
orgPath() {
|
|
24
|
+
if (!this.orgId) {
|
|
25
|
+
throw new Error('No SERVICIALO_ORG_ID configured — cannot call org-scoped endpoints.');
|
|
26
|
+
}
|
|
17
27
|
return `/api/organizations/${this.orgId}`;
|
|
18
28
|
}
|
|
19
|
-
|
|
29
|
+
authHeaders() {
|
|
30
|
+
if (!this.apiKey) {
|
|
31
|
+
throw new Error('No SERVICIALO_API_KEY configured — cannot call authenticated endpoints.');
|
|
32
|
+
}
|
|
20
33
|
return {
|
|
21
34
|
'Authorization': `Bearer ${this.apiKey}`,
|
|
22
35
|
'Content-Type': 'application/json',
|
|
23
36
|
};
|
|
24
37
|
}
|
|
38
|
+
publicHeaders() {
|
|
39
|
+
return {
|
|
40
|
+
'Content-Type': 'application/json',
|
|
41
|
+
};
|
|
42
|
+
}
|
|
25
43
|
/**
|
|
26
|
-
* Build full URL
|
|
44
|
+
* Build full URL for authenticated (org-scoped) requests.
|
|
45
|
+
* If path starts with `/api/` it's used as-is (absolute).
|
|
27
46
|
* Otherwise it's appended to the org-scoped base path.
|
|
28
47
|
*/
|
|
29
48
|
buildUrl(path) {
|
|
@@ -32,6 +51,36 @@ export class CoordinaloClient {
|
|
|
32
51
|
}
|
|
33
52
|
return `${this.baseUrl}${this.orgPath()}${path}`;
|
|
34
53
|
}
|
|
54
|
+
/**
|
|
55
|
+
* Build full URL for public requests.
|
|
56
|
+
* Path must be absolute (e.g., /api/v1/public/registry).
|
|
57
|
+
*/
|
|
58
|
+
buildPublicUrl(path) {
|
|
59
|
+
return `${this.baseUrl}${path}`;
|
|
60
|
+
}
|
|
61
|
+
// --- Public API (no auth required) ---
|
|
62
|
+
pub = {
|
|
63
|
+
get: async (path, params) => {
|
|
64
|
+
const url = new URL(this.buildPublicUrl(path));
|
|
65
|
+
if (params) {
|
|
66
|
+
for (const [key, value] of Object.entries(params)) {
|
|
67
|
+
if (value !== undefined) {
|
|
68
|
+
url.searchParams.set(key, String(value));
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
const res = await fetch(url.toString(), {
|
|
73
|
+
method: 'GET',
|
|
74
|
+
headers: this.publicHeaders(),
|
|
75
|
+
});
|
|
76
|
+
if (!res.ok) {
|
|
77
|
+
const body = await res.text();
|
|
78
|
+
throw new Error(`GET ${path} failed (${res.status}): ${body}`);
|
|
79
|
+
}
|
|
80
|
+
return res.json();
|
|
81
|
+
},
|
|
82
|
+
};
|
|
83
|
+
// --- Authenticated API ---
|
|
35
84
|
async get(path, params) {
|
|
36
85
|
const url = new URL(this.buildUrl(path));
|
|
37
86
|
if (params) {
|
|
@@ -43,7 +92,7 @@ export class CoordinaloClient {
|
|
|
43
92
|
}
|
|
44
93
|
const res = await fetch(url.toString(), {
|
|
45
94
|
method: 'GET',
|
|
46
|
-
headers: this.
|
|
95
|
+
headers: this.authHeaders(),
|
|
47
96
|
});
|
|
48
97
|
if (!res.ok) {
|
|
49
98
|
const body = await res.text();
|
|
@@ -54,7 +103,7 @@ export class CoordinaloClient {
|
|
|
54
103
|
async post(path, body) {
|
|
55
104
|
const res = await fetch(this.buildUrl(path), {
|
|
56
105
|
method: 'POST',
|
|
57
|
-
headers: this.
|
|
106
|
+
headers: this.authHeaders(),
|
|
58
107
|
body: body !== undefined ? JSON.stringify(body) : undefined,
|
|
59
108
|
});
|
|
60
109
|
if (!res.ok) {
|
|
@@ -66,7 +115,7 @@ export class CoordinaloClient {
|
|
|
66
115
|
async put(path, body) {
|
|
67
116
|
const res = await fetch(this.buildUrl(path), {
|
|
68
117
|
method: 'PUT',
|
|
69
|
-
headers: this.
|
|
118
|
+
headers: this.authHeaders(),
|
|
70
119
|
body: body !== undefined ? JSON.stringify(body) : undefined,
|
|
71
120
|
});
|
|
72
121
|
if (!res.ok) {
|
|
@@ -78,7 +127,7 @@ export class CoordinaloClient {
|
|
|
78
127
|
async patch(path, body) {
|
|
79
128
|
const res = await fetch(this.buildUrl(path), {
|
|
80
129
|
method: 'PATCH',
|
|
81
|
-
headers: this.
|
|
130
|
+
headers: this.authHeaders(),
|
|
82
131
|
body: body !== undefined ? JSON.stringify(body) : undefined,
|
|
83
132
|
});
|
|
84
133
|
if (!res.ok) {
|
|
@@ -90,7 +139,7 @@ export class CoordinaloClient {
|
|
|
90
139
|
async delete(path) {
|
|
91
140
|
const res = await fetch(this.buildUrl(path), {
|
|
92
141
|
method: 'DELETE',
|
|
93
|
-
headers: this.
|
|
142
|
+
headers: this.authHeaders(),
|
|
94
143
|
});
|
|
95
144
|
if (!res.ok) {
|
|
96
145
|
const text = await res.text();
|
package/dist/client.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAQH,MAAM,OAAO,gBAAgB;IACnB,OAAO,CAAS;IAChB,MAAM,CAAqB;IAC3B,KAAK,CAAqB;IAElC,YAAY,MAAoB;QAC9B,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;QAClD,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC;QAC5B,IAAI,CAAC,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC;IAC5B,CAAC;IAED,sEAAsE;IACtE,IAAI,eAAe;QACjB,OAAO,CAAC,CAAC,IAAI,CAAC,MAAM,IAAI,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC;IACvC,CAAC;IAED,0BAA0B;IAE1B,6CAA6C;IACrC,OAAO;QACb,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC;YAChB,MAAM,IAAI,KAAK,CAAC,qEAAqE,CAAC,CAAC;QACzF,CAAC;QACD,OAAO,sBAAsB,IAAI,CAAC,KAAK,EAAE,CAAC;IAC5C,CAAC;IAEO,WAAW;QACjB,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC;YACjB,MAAM,IAAI,KAAK,CAAC,yEAAyE,CAAC,CAAC;QAC7F,CAAC;QACD,OAAO;YACL,eAAe,EAAE,UAAU,IAAI,CAAC,MAAM,EAAE;YACxC,cAAc,EAAE,kBAAkB;SACnC,CAAC;IACJ,CAAC;IAEO,aAAa;QACnB,OAAO;YACL,cAAc,EAAE,kBAAkB;SACnC,CAAC;IACJ,CAAC;IAED;;;;OAIG;IACK,QAAQ,CAAC,IAAY;QAC3B,IAAI,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,EAAE,CAAC;YAC7B,OAAO,GAAG,IAAI,CAAC,OAAO,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,IAAI,EAAE,CAAC;YAC9B,MAAM,IAAI,KAAK,CAAC,SAAS,IAAI,YAAY,GAAG,CAAC,MAAM,MAAM,IAAI,EAAE,CAAC,CAAC;QACnE,CAAC;QAED,OAAO,GAAG,CAAC,IAAI,EAAE,CAAC;IACpB,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,IAAY;QACvB,MAAM,GAAG,GAAG,MAAM,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE;YAC3C,MAAM,EAAE,QAAQ;YAChB,OAAO,EAAE,IAAI,CAAC,WAAW,EAAE;SAC5B,CAAC,CAAC;QAEH,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC;YACZ,MAAM,IAAI,GAAG,MAAM,GAAG,CAAC,IAAI,EAAE,CAAC;YAC9B,MAAM,IAAI,KAAK,CAAC,UAAU,IAAI,YAAY,GAAG,CAAC,MAAM,MAAM,IAAI,EAAE,CAAC,CAAC;QACpE,CAAC;QAED,OAAO,GAAG,CAAC,IAAI,EAAE,CAAC;IACpB,CAAC;CACF"}
|
package/dist/index.js
CHANGED
|
@@ -2,69 +2,100 @@
|
|
|
2
2
|
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
3
3
|
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
|
|
4
4
|
import { CoordinaloClient } from './client.js';
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
5
|
+
import { detectMode } from './mode.js';
|
|
6
|
+
// --- Public tools ---
|
|
7
|
+
import { registryTools } from './tools/public/registry.js';
|
|
8
|
+
import { publicAvailabilityTools } from './tools/public/availability.js';
|
|
9
|
+
import { publicServicesTools } from './tools/public/services.js';
|
|
10
|
+
// --- Authenticated tools (Phases 2–6) ---
|
|
11
|
+
import { entenderTools } from './tools/authenticated/entender.js';
|
|
12
|
+
import { comprometerTools } from './tools/authenticated/comprometer.js';
|
|
13
|
+
import { lifecycleTools } from './tools/authenticated/lifecycle.js';
|
|
14
|
+
import { deliveryTools } from './tools/authenticated/delivery.js';
|
|
15
|
+
import { cerrarTools } from './tools/authenticated/cerrar.js';
|
|
16
|
+
// --- Detect mode ---
|
|
17
|
+
const mode = detectMode();
|
|
14
18
|
const BASE_URL = process.env.SERVICIALO_BASE_URL || 'https://coordinalo.com';
|
|
15
|
-
if (
|
|
16
|
-
console.error(
|
|
17
|
-
process.exit(1);
|
|
19
|
+
if (mode === 'authenticated') {
|
|
20
|
+
console.error(`Servicialo MCP — modo autenticado [org: ${process.env.SERVICIALO_ORG_ID}]`);
|
|
18
21
|
}
|
|
19
|
-
|
|
20
|
-
console.error('
|
|
21
|
-
process.exit(1);
|
|
22
|
+
else {
|
|
23
|
+
console.error('Servicialo MCP — modo discovery (sin credenciales)');
|
|
22
24
|
}
|
|
23
25
|
// --- Init client ---
|
|
24
26
|
const apiClient = new CoordinaloClient({
|
|
25
27
|
baseUrl: BASE_URL,
|
|
26
|
-
apiKey:
|
|
27
|
-
orgId:
|
|
28
|
+
apiKey: process.env.SERVICIALO_API_KEY,
|
|
29
|
+
orgId: process.env.SERVICIALO_ORG_ID,
|
|
28
30
|
});
|
|
29
31
|
// --- Init MCP server ---
|
|
30
32
|
const server = new McpServer({
|
|
31
33
|
name: 'servicialo',
|
|
32
|
-
version: '0.
|
|
34
|
+
version: '0.4.0',
|
|
33
35
|
});
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
...
|
|
37
|
-
...
|
|
38
|
-
...
|
|
39
|
-
|
|
40
|
-
|
|
36
|
+
// --- Public tools (always registered) ---
|
|
37
|
+
const publicTools = {
|
|
38
|
+
...registryTools,
|
|
39
|
+
...publicAvailabilityTools,
|
|
40
|
+
...publicServicesTools,
|
|
41
|
+
};
|
|
42
|
+
// --- Authenticated tools (only in authenticated mode) ---
|
|
43
|
+
const authenticatedTools = {
|
|
44
|
+
...entenderTools,
|
|
45
|
+
...comprometerTools,
|
|
46
|
+
...lifecycleTools,
|
|
47
|
+
...deliveryTools,
|
|
48
|
+
...cerrarTools,
|
|
41
49
|
};
|
|
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
|
-
|
|
50
|
+
// --- Register tools ---
|
|
51
|
+
function registerTools(tools) {
|
|
52
|
+
for (const [name, tool] of Object.entries(tools)) {
|
|
53
|
+
server.tool(name, tool.description, tool.schema.shape, async (args) => {
|
|
54
|
+
try {
|
|
55
|
+
const result = await tool.handler(apiClient, args);
|
|
56
|
+
return {
|
|
57
|
+
content: [
|
|
58
|
+
{
|
|
59
|
+
type: 'text',
|
|
60
|
+
text: JSON.stringify(result, null, 2),
|
|
61
|
+
},
|
|
62
|
+
],
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
catch (error) {
|
|
66
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
67
|
+
return {
|
|
68
|
+
content: [
|
|
69
|
+
{
|
|
70
|
+
type: 'text',
|
|
71
|
+
text: `Error: ${message}`,
|
|
72
|
+
},
|
|
73
|
+
],
|
|
74
|
+
isError: true,
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
// Always register public tools
|
|
81
|
+
registerTools(publicTools);
|
|
82
|
+
if (mode === 'authenticated') {
|
|
83
|
+
// Register authenticated tools
|
|
84
|
+
registerTools(authenticatedTools);
|
|
85
|
+
}
|
|
86
|
+
else {
|
|
87
|
+
// Register stubs for authenticated tools that return a descriptive error
|
|
88
|
+
for (const [name, tool] of Object.entries(authenticatedTools)) {
|
|
89
|
+
server.tool(name, tool.description, tool.schema.shape, async () => ({
|
|
90
|
+
content: [
|
|
91
|
+
{
|
|
92
|
+
type: 'text',
|
|
93
|
+
text: 'Esta operación requiere autenticación. Configura SERVICIALO_API_KEY y SERVICIALO_ORG_ID para operar en nombre de una organización.',
|
|
94
|
+
},
|
|
95
|
+
],
|
|
96
|
+
isError: true,
|
|
97
|
+
}));
|
|
98
|
+
}
|
|
68
99
|
}
|
|
69
100
|
// --- Connect via stdio ---
|
|
70
101
|
async function main() {
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACpE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACpE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAGvC,uBAAuB;AACvB,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAE,uBAAuB,EAAE,MAAM,gCAAgC,CAAC;AACzE,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AAEjE,2CAA2C;AAC3C,OAAO,EAAE,aAAa,EAAE,MAAM,mCAAmC,CAAC;AAClE,OAAO,EAAE,gBAAgB,EAAE,MAAM,sCAAsC,CAAC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AAE;gBACP;oBACE,IAAI,EAAE,MAAe;oBACrB,IAAI,EAAE,oIAAoI;iBAC3I;aACF;YACD,OAAO,EAAE,IAAI;SACd,CAAC,CACH,CAAC;IACJ,CAAC;AACH,CAAC;AAED,4BAA4B;AAC5B,KAAK,UAAU,IAAI;IACjB,MAAM,SAAS,GAAG,IAAI,oBAAoB,EAAE,CAAC;IAC7C,MAAM,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;AAClC,CAAC;AAED,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;IACrB,OAAO,CAAC,KAAK,CAAC,cAAc,EAAE,KAAK,CAAC,CAAC;IACrC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
|
package/dist/mode.d.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Detects the operating mode based on environment variables.
|
|
3
|
+
*
|
|
4
|
+
* - discovery: no credentials, only public tools available
|
|
5
|
+
* - authenticated: full credentials, all tools available
|
|
6
|
+
*/
|
|
7
|
+
export type Mode = 'discovery' | 'authenticated';
|
|
8
|
+
export declare function detectMode(): Mode;
|
|
9
|
+
//# sourceMappingURL=mode.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mode.d.ts","sourceRoot":"","sources":["../src/mode.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,MAAM,IAAI,GAAG,WAAW,GAAG,eAAe,CAAC;AAEjD,wBAAgB,UAAU,IAAI,IAAI,CAajC"}
|
package/dist/mode.js
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Detects the operating mode based on environment variables.
|
|
3
|
+
*
|
|
4
|
+
* - discovery: no credentials, only public tools available
|
|
5
|
+
* - authenticated: full credentials, all tools available
|
|
6
|
+
*/
|
|
7
|
+
export function detectMode() {
|
|
8
|
+
const hasKey = !!process.env.SERVICIALO_API_KEY;
|
|
9
|
+
const hasOrg = !!process.env.SERVICIALO_ORG_ID;
|
|
10
|
+
if (hasKey && hasOrg)
|
|
11
|
+
return 'authenticated';
|
|
12
|
+
if (!hasKey && !hasOrg)
|
|
13
|
+
return 'discovery';
|
|
14
|
+
// Only one of the two is set — warn and fall back to discovery
|
|
15
|
+
console.error('WARN: Se requieren ambas variables (SERVICIALO_API_KEY y SERVICIALO_ORG_ID) para modo autenticado. Operando en modo discovery.');
|
|
16
|
+
return 'discovery';
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=mode.js.map
|
package/dist/mode.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mode.js","sourceRoot":"","sources":["../src/mode.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,MAAM,UAAU,UAAU;IACxB,MAAM,MAAM,GAAG,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,kBAAkB,CAAC;IAChD,MAAM,MAAM,GAAG,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,iBAAiB,CAAC;IAE/C,IAAI,MAAM,IAAI,MAAM;QAAE,OAAO,eAAe,CAAC;IAE7C,IAAI,CAAC,MAAM,IAAI,CAAC,MAAM;QAAE,OAAO,WAAW,CAAC;IAE3C,+DAA+D;IAC/D,OAAO,CAAC,KAAK,CACX,gIAAgI,CACjI,CAAC;IACF,OAAO,WAAW,CAAC;AACrB,CAAC"}
|