@servicialo/mcp-server 0.1.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.
- package/README.md +72 -18
- package/dist/client.d.ts +28 -4
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +95 -9
- package/dist/client.js.map +1 -1
- package/dist/index.js +80 -43
- 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/clients.d.ts} +15 -2
- package/dist/tools/authenticated/clients.d.ts.map +1 -0
- package/dist/tools/{clients.js → authenticated/clients.js} +15 -9
- package/dist/tools/authenticated/clients.js.map +1 -0
- package/dist/tools/authenticated/notifications.d.ts +31 -0
- package/dist/tools/authenticated/notifications.d.ts.map +1 -0
- package/dist/tools/authenticated/notifications.js +22 -0
- package/dist/tools/authenticated/notifications.js.map +1 -0
- package/dist/tools/{payments.d.ts → authenticated/payments.d.ts} +54 -23
- package/dist/tools/authenticated/payments.d.ts.map +1 -0
- package/dist/tools/authenticated/payments.js +70 -0
- package/dist/tools/authenticated/payments.js.map +1 -0
- package/dist/tools/authenticated/payroll.d.ts +106 -0
- package/dist/tools/authenticated/payroll.d.ts.map +1 -0
- package/dist/tools/authenticated/payroll.js +77 -0
- package/dist/tools/authenticated/payroll.js.map +1 -0
- package/dist/tools/authenticated/providers.d.ts +52 -0
- package/dist/tools/authenticated/providers.d.ts.map +1 -0
- package/dist/tools/authenticated/providers.js +37 -0
- package/dist/tools/authenticated/providers.js.map +1 -0
- package/dist/tools/{scheduling.d.ts → authenticated/scheduling.d.ts} +32 -34
- package/dist/tools/authenticated/scheduling.d.ts.map +1 -0
- package/dist/tools/{scheduling.js → authenticated/scheduling.js} +20 -19
- package/dist/tools/authenticated/scheduling.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/package.json +1 -1
- package/dist/tools/clients.d.ts.map +0 -1
- package/dist/tools/clients.js.map +0 -1
- package/dist/tools/notifications.d.ts +0 -34
- package/dist/tools/notifications.d.ts.map +0 -1
- package/dist/tools/notifications.js +0 -24
- package/dist/tools/notifications.js.map +0 -1
- package/dist/tools/payments.d.ts.map +0 -1
- package/dist/tools/payments.js +0 -59
- package/dist/tools/payments.js.map +0 -1
- package/dist/tools/scheduling.d.ts.map +0 -1
- package/dist/tools/scheduling.js.map +0 -1
package/README.md
CHANGED
|
@@ -1,16 +1,30 @@
|
|
|
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
|
+
## Two Modes of Operation
|
|
6
|
+
|
|
7
|
+
### Discovery Mode (no configuration)
|
|
6
8
|
|
|
7
9
|
```bash
|
|
8
10
|
npx -y @servicialo/mcp-server
|
|
9
11
|
```
|
|
10
12
|
|
|
11
|
-
|
|
13
|
+
No credentials needed. The server exposes 4 public tools for discovering organizations, services, and availability across any Servicialo-compatible platform.
|
|
14
|
+
|
|
15
|
+
Useful for: agents that help users find and evaluate professional services.
|
|
16
|
+
|
|
17
|
+
### Authenticated Mode
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
SERVICIALO_API_KEY=your_key SERVICIALO_ORG_ID=your_org npx -y @servicialo/mcp-server
|
|
21
|
+
```
|
|
12
22
|
|
|
13
|
-
|
|
23
|
+
Requires `SERVICIALO_API_KEY` and `SERVICIALO_ORG_ID` obtained from the Servicialo-compatible platform your organization uses (e.g., [Coordinalo](https://coordinalo.com)).
|
|
24
|
+
|
|
25
|
+
Enables: scheduling, client management, payments, providers, payroll, and notifications — all 23 tools.
|
|
26
|
+
|
|
27
|
+
### Claude Desktop Configuration
|
|
14
28
|
|
|
15
29
|
```json
|
|
16
30
|
{
|
|
@@ -27,46 +41,86 @@ Add to your `claude_desktop_config.json`:
|
|
|
27
41
|
}
|
|
28
42
|
```
|
|
29
43
|
|
|
44
|
+
Omit the `env` block entirely for discovery-only mode.
|
|
45
|
+
|
|
30
46
|
## Environment Variables
|
|
31
47
|
|
|
32
48
|
| Variable | Required | Description |
|
|
33
49
|
|---|---|---|
|
|
34
|
-
| `SERVICIALO_API_KEY` |
|
|
35
|
-
| `SERVICIALO_ORG_ID` |
|
|
50
|
+
| `SERVICIALO_API_KEY` | No | Bearer token — enables authenticated mode |
|
|
51
|
+
| `SERVICIALO_ORG_ID` | No | Organization slug — enables authenticated mode |
|
|
36
52
|
| `SERVICIALO_BASE_URL` | No | API base URL (default: `https://coordinalo.com`) |
|
|
37
53
|
|
|
38
|
-
##
|
|
54
|
+
## Public Tools (4) — Always Available
|
|
55
|
+
|
|
56
|
+
| Tool | Description |
|
|
57
|
+
|---|---|
|
|
58
|
+
| `registry.search` | Search Servicialo-compatible organizations by vertical and location |
|
|
59
|
+
| `registry.get_organization` | Get public details of an organization (services, providers, booking) |
|
|
60
|
+
| `scheduling.check_availability` | Check available slots without authentication |
|
|
61
|
+
| `services.list` | List the public service catalog of an organization |
|
|
62
|
+
|
|
63
|
+
## Authenticated Tools (19) — Require Credentials
|
|
39
64
|
|
|
40
65
|
### Scheduling (4)
|
|
41
66
|
|
|
42
67
|
| Tool | Description |
|
|
43
68
|
|---|---|
|
|
44
|
-
| `scheduling.
|
|
45
|
-
| `scheduling.book` | Book a new session |
|
|
46
|
-
| `scheduling.reschedule` | Reschedule an existing session |
|
|
69
|
+
| `scheduling.list_sessions` | List sessions filtered by date, provider, client, or status |
|
|
70
|
+
| `scheduling.book` | Book a new session for a client with a provider |
|
|
71
|
+
| `scheduling.reschedule` | Reschedule an existing session to a new datetime |
|
|
47
72
|
| `scheduling.cancel` | Cancel a session |
|
|
48
73
|
|
|
49
|
-
### Clients (
|
|
74
|
+
### Clients (4)
|
|
50
75
|
|
|
51
76
|
| Tool | Description |
|
|
52
77
|
|---|---|
|
|
53
78
|
| `clients.list` | List clients with search and pagination |
|
|
54
|
-
| `clients.get` | Get client details
|
|
79
|
+
| `clients.get` | Get client details including history and pending payments |
|
|
55
80
|
| `clients.create` | Create a new client |
|
|
81
|
+
| `clients.history` | Get client activity history: past sessions, payments |
|
|
56
82
|
|
|
57
|
-
### Payments (
|
|
83
|
+
### Payments (4)
|
|
58
84
|
|
|
59
85
|
| Tool | Description |
|
|
60
86
|
|---|---|
|
|
61
|
-
| `payments.
|
|
62
|
-
| `payments.
|
|
63
|
-
| `payments.
|
|
87
|
+
| `payments.list_sales` | List sales filtered by client, provider, service, or status |
|
|
88
|
+
| `payments.create_sale` | Create a sale/charge for a client |
|
|
89
|
+
| `payments.record_payment` | Record a payment received against a sale |
|
|
90
|
+
| `payments.client_balance` | Get client account balance and session availability |
|
|
64
91
|
|
|
65
|
-
###
|
|
92
|
+
### Providers (3)
|
|
66
93
|
|
|
67
94
|
| Tool | Description |
|
|
68
95
|
|---|---|
|
|
69
|
-
| `
|
|
96
|
+
| `providers.list` | List organization providers/professionals |
|
|
97
|
+
| `providers.get` | Get provider details including services and commissions |
|
|
98
|
+
| `providers.get_commission` | Get provider commission configuration |
|
|
99
|
+
|
|
100
|
+
### Payroll (5)
|
|
101
|
+
|
|
102
|
+
| Tool | Description |
|
|
103
|
+
|---|---|
|
|
104
|
+
| `payroll.calculate` | Calculate salary settlement for a provider in a period |
|
|
105
|
+
| `payroll.history` | Query payroll settlement history |
|
|
106
|
+
| `payroll.settlement_detail` | Get monthly settlement breakdown (earnings and deductions) |
|
|
107
|
+
| `payroll.vacations` | Query vacation requests |
|
|
108
|
+
| `payroll.request_vacation` | Create a vacation request for a provider |
|
|
109
|
+
|
|
110
|
+
### Notifications (2)
|
|
111
|
+
|
|
112
|
+
| Tool | Description |
|
|
113
|
+
|---|---|
|
|
114
|
+
| `notifications.send_session_reminder` | Send a reminder notification for a session |
|
|
115
|
+
| `notifications.send_payment_reminder` | Send a payment reminder for a pending sale |
|
|
116
|
+
|
|
117
|
+
## API Modules
|
|
118
|
+
|
|
119
|
+
The server connects to three platform modules:
|
|
120
|
+
|
|
121
|
+
- **Coordinalo** — Scheduling and session management
|
|
122
|
+
- **Relacionalo** — Client CRM and relationship management
|
|
123
|
+
- **Planificalo** — Finance, payments, payroll, and provider management
|
|
70
124
|
|
|
71
125
|
## Development
|
|
72
126
|
|
package/dist/client.d.ts
CHANGED
|
@@ -1,20 +1,44 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* HTTP client for Coordinalo REST API.
|
|
3
|
-
*
|
|
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
|
|
4
7
|
*/
|
|
5
8
|
export interface ClientConfig {
|
|
6
9
|
baseUrl: string;
|
|
7
|
-
apiKey
|
|
8
|
-
orgId
|
|
10
|
+
apiKey?: string;
|
|
11
|
+
orgId?: string;
|
|
9
12
|
}
|
|
10
13
|
export declare class CoordinaloClient {
|
|
11
14
|
private baseUrl;
|
|
12
15
|
private apiKey;
|
|
13
16
|
private orgId;
|
|
14
17
|
constructor(config: ClientConfig);
|
|
15
|
-
|
|
18
|
+
/** Whether the client has credentials for authenticated operations */
|
|
19
|
+
get isAuthenticated(): boolean;
|
|
20
|
+
/** Base path for all org-scoped endpoints */
|
|
21
|
+
private orgPath;
|
|
22
|
+
private authHeaders;
|
|
23
|
+
private publicHeaders;
|
|
24
|
+
/**
|
|
25
|
+
* Build full URL for authenticated (org-scoped) requests.
|
|
26
|
+
* If path starts with `/api/` it's used as-is (absolute).
|
|
27
|
+
* Otherwise it's appended to the org-scoped base path.
|
|
28
|
+
*/
|
|
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
|
+
};
|
|
16
38
|
get(path: string, params?: Record<string, string | number | undefined>): Promise<unknown>;
|
|
17
39
|
post(path: string, body?: unknown): Promise<unknown>;
|
|
18
40
|
put(path: string, body?: unknown): Promise<unknown>;
|
|
41
|
+
patch(path: string, body?: unknown): Promise<unknown>;
|
|
42
|
+
delete(path: string): Promise<unknown>;
|
|
19
43
|
}
|
|
20
44
|
//# sourceMappingURL=client.d.ts.map
|
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,6 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* HTTP client for Coordinalo REST API.
|
|
3
|
-
*
|
|
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
|
|
4
7
|
*/
|
|
5
8
|
export class CoordinaloClient {
|
|
6
9
|
baseUrl;
|
|
@@ -11,15 +14,75 @@ export class CoordinaloClient {
|
|
|
11
14
|
this.apiKey = config.apiKey;
|
|
12
15
|
this.orgId = config.orgId;
|
|
13
16
|
}
|
|
14
|
-
|
|
17
|
+
/** Whether the client has credentials for authenticated operations */
|
|
18
|
+
get isAuthenticated() {
|
|
19
|
+
return !!this.apiKey && !!this.orgId;
|
|
20
|
+
}
|
|
21
|
+
// --- Private helpers ---
|
|
22
|
+
/** Base path for all org-scoped endpoints */
|
|
23
|
+
orgPath() {
|
|
24
|
+
if (!this.orgId) {
|
|
25
|
+
throw new Error('No SERVICIALO_ORG_ID configured — cannot call org-scoped endpoints.');
|
|
26
|
+
}
|
|
27
|
+
return `/api/organizations/${this.orgId}`;
|
|
28
|
+
}
|
|
29
|
+
authHeaders() {
|
|
30
|
+
if (!this.apiKey) {
|
|
31
|
+
throw new Error('No SERVICIALO_API_KEY configured — cannot call authenticated endpoints.');
|
|
32
|
+
}
|
|
15
33
|
return {
|
|
16
34
|
'Authorization': `Bearer ${this.apiKey}`,
|
|
17
35
|
'Content-Type': 'application/json',
|
|
18
|
-
'X-Org-Id': this.orgId,
|
|
19
36
|
};
|
|
20
37
|
}
|
|
38
|
+
publicHeaders() {
|
|
39
|
+
return {
|
|
40
|
+
'Content-Type': 'application/json',
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Build full URL for authenticated (org-scoped) requests.
|
|
45
|
+
* If path starts with `/api/` it's used as-is (absolute).
|
|
46
|
+
* Otherwise it's appended to the org-scoped base path.
|
|
47
|
+
*/
|
|
48
|
+
buildUrl(path) {
|
|
49
|
+
if (path.startsWith('/api/')) {
|
|
50
|
+
return `${this.baseUrl}${path}`;
|
|
51
|
+
}
|
|
52
|
+
return `${this.baseUrl}${this.orgPath()}${path}`;
|
|
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 ---
|
|
21
84
|
async get(path, params) {
|
|
22
|
-
const url = new URL(
|
|
85
|
+
const url = new URL(this.buildUrl(path));
|
|
23
86
|
if (params) {
|
|
24
87
|
for (const [key, value] of Object.entries(params)) {
|
|
25
88
|
if (value !== undefined) {
|
|
@@ -29,7 +92,7 @@ export class CoordinaloClient {
|
|
|
29
92
|
}
|
|
30
93
|
const res = await fetch(url.toString(), {
|
|
31
94
|
method: 'GET',
|
|
32
|
-
headers: this.
|
|
95
|
+
headers: this.authHeaders(),
|
|
33
96
|
});
|
|
34
97
|
if (!res.ok) {
|
|
35
98
|
const body = await res.text();
|
|
@@ -38,9 +101,9 @@ export class CoordinaloClient {
|
|
|
38
101
|
return res.json();
|
|
39
102
|
}
|
|
40
103
|
async post(path, body) {
|
|
41
|
-
const res = await fetch(
|
|
104
|
+
const res = await fetch(this.buildUrl(path), {
|
|
42
105
|
method: 'POST',
|
|
43
|
-
headers: this.
|
|
106
|
+
headers: this.authHeaders(),
|
|
44
107
|
body: body !== undefined ? JSON.stringify(body) : undefined,
|
|
45
108
|
});
|
|
46
109
|
if (!res.ok) {
|
|
@@ -50,9 +113,9 @@ export class CoordinaloClient {
|
|
|
50
113
|
return res.json();
|
|
51
114
|
}
|
|
52
115
|
async put(path, body) {
|
|
53
|
-
const res = await fetch(
|
|
116
|
+
const res = await fetch(this.buildUrl(path), {
|
|
54
117
|
method: 'PUT',
|
|
55
|
-
headers: this.
|
|
118
|
+
headers: this.authHeaders(),
|
|
56
119
|
body: body !== undefined ? JSON.stringify(body) : undefined,
|
|
57
120
|
});
|
|
58
121
|
if (!res.ok) {
|
|
@@ -61,5 +124,28 @@ export class CoordinaloClient {
|
|
|
61
124
|
}
|
|
62
125
|
return res.json();
|
|
63
126
|
}
|
|
127
|
+
async patch(path, body) {
|
|
128
|
+
const res = await fetch(this.buildUrl(path), {
|
|
129
|
+
method: 'PATCH',
|
|
130
|
+
headers: this.authHeaders(),
|
|
131
|
+
body: body !== undefined ? JSON.stringify(body) : undefined,
|
|
132
|
+
});
|
|
133
|
+
if (!res.ok) {
|
|
134
|
+
const text = await res.text();
|
|
135
|
+
throw new Error(`PATCH ${path} failed (${res.status}): ${text}`);
|
|
136
|
+
}
|
|
137
|
+
return res.json();
|
|
138
|
+
}
|
|
139
|
+
async delete(path) {
|
|
140
|
+
const res = await fetch(this.buildUrl(path), {
|
|
141
|
+
method: 'DELETE',
|
|
142
|
+
headers: this.authHeaders(),
|
|
143
|
+
});
|
|
144
|
+
if (!res.ok) {
|
|
145
|
+
const text = await res.text();
|
|
146
|
+
throw new Error(`DELETE ${path} failed (${res.status}): ${text}`);
|
|
147
|
+
}
|
|
148
|
+
return res.json();
|
|
149
|
+
}
|
|
64
150
|
}
|
|
65
151
|
//# sourceMappingURL=client.js.map
|
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,CAA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C;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,65 +2,102 @@
|
|
|
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
|
-
|
|
10
|
-
|
|
11
|
-
|
|
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 ---
|
|
11
|
+
import { schedulingTools } from './tools/authenticated/scheduling.js';
|
|
12
|
+
import { clientsTools } from './tools/authenticated/clients.js';
|
|
13
|
+
import { paymentsTools } from './tools/authenticated/payments.js';
|
|
14
|
+
import { notificationsTools } from './tools/authenticated/notifications.js';
|
|
15
|
+
import { providersTools } from './tools/authenticated/providers.js';
|
|
16
|
+
import { payrollTools } from './tools/authenticated/payroll.js';
|
|
17
|
+
// --- Detect mode ---
|
|
18
|
+
const mode = detectMode();
|
|
12
19
|
const BASE_URL = process.env.SERVICIALO_BASE_URL || 'https://coordinalo.com';
|
|
13
|
-
if (
|
|
14
|
-
console.error(
|
|
15
|
-
process.exit(1);
|
|
20
|
+
if (mode === 'authenticated') {
|
|
21
|
+
console.error(`Servicialo MCP — modo autenticado [org: ${process.env.SERVICIALO_ORG_ID}]`);
|
|
16
22
|
}
|
|
17
|
-
|
|
18
|
-
console.error('
|
|
19
|
-
process.exit(1);
|
|
23
|
+
else {
|
|
24
|
+
console.error('Servicialo MCP — modo discovery (sin credenciales)');
|
|
20
25
|
}
|
|
21
26
|
// --- Init client ---
|
|
22
27
|
const apiClient = new CoordinaloClient({
|
|
23
28
|
baseUrl: BASE_URL,
|
|
24
|
-
apiKey:
|
|
25
|
-
orgId:
|
|
29
|
+
apiKey: process.env.SERVICIALO_API_KEY,
|
|
30
|
+
orgId: process.env.SERVICIALO_ORG_ID,
|
|
26
31
|
});
|
|
27
32
|
// --- Init MCP server ---
|
|
28
33
|
const server = new McpServer({
|
|
29
34
|
name: 'servicialo',
|
|
30
|
-
version: '0.
|
|
35
|
+
version: '0.3.0',
|
|
31
36
|
});
|
|
32
|
-
|
|
37
|
+
// --- Public tools (always registered) ---
|
|
38
|
+
const publicTools = {
|
|
39
|
+
...registryTools,
|
|
40
|
+
...publicAvailabilityTools,
|
|
41
|
+
...publicServicesTools,
|
|
42
|
+
};
|
|
43
|
+
// --- Authenticated tools (only in authenticated mode) ---
|
|
44
|
+
const authenticatedTools = {
|
|
33
45
|
...schedulingTools,
|
|
34
46
|
...clientsTools,
|
|
35
47
|
...paymentsTools,
|
|
36
48
|
...notificationsTools,
|
|
49
|
+
...providersTools,
|
|
50
|
+
...payrollTools,
|
|
37
51
|
};
|
|
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
|
-
|
|
52
|
+
// --- Register tools ---
|
|
53
|
+
function registerTools(tools) {
|
|
54
|
+
for (const [name, tool] of Object.entries(tools)) {
|
|
55
|
+
server.tool(name, tool.description, tool.schema.shape, async (args) => {
|
|
56
|
+
try {
|
|
57
|
+
const result = await tool.handler(apiClient, args);
|
|
58
|
+
return {
|
|
59
|
+
content: [
|
|
60
|
+
{
|
|
61
|
+
type: 'text',
|
|
62
|
+
text: JSON.stringify(result, null, 2),
|
|
63
|
+
},
|
|
64
|
+
],
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
catch (error) {
|
|
68
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
69
|
+
return {
|
|
70
|
+
content: [
|
|
71
|
+
{
|
|
72
|
+
type: 'text',
|
|
73
|
+
text: `Error: ${message}`,
|
|
74
|
+
},
|
|
75
|
+
],
|
|
76
|
+
isError: true,
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
// Always register public tools
|
|
83
|
+
registerTools(publicTools);
|
|
84
|
+
if (mode === 'authenticated') {
|
|
85
|
+
// Register authenticated tools
|
|
86
|
+
registerTools(authenticatedTools);
|
|
87
|
+
}
|
|
88
|
+
else {
|
|
89
|
+
// Register stubs for authenticated tools that return a descriptive error
|
|
90
|
+
for (const [name, tool] of Object.entries(authenticatedTools)) {
|
|
91
|
+
server.tool(name, tool.description, tool.schema.shape, async () => ({
|
|
92
|
+
content: [
|
|
93
|
+
{
|
|
94
|
+
type: 'text',
|
|
95
|
+
text: 'Esta operación requiere autenticación. Configura SERVICIALO_API_KEY y SERVICIALO_ORG_ID para operar en nombre de una organización.',
|
|
96
|
+
},
|
|
97
|
+
],
|
|
98
|
+
isError: true,
|
|
99
|
+
}));
|
|
100
|
+
}
|
|
64
101
|
}
|
|
65
102
|
// --- Connect via stdio ---
|
|
66
103
|
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,8BAA8B;AAC9B,OAAO,EAAE,eAAe,EAAE,MAAM,qCAAqC,CAAC;AACtE,OAAO,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAC;AAChE,OAAO,EAAE,aAAa,EAAE,MAAM,mCAAmC,CAAC;AAClE,OAAO,EAAE,kBAAkB,EAAE,MAAM,wCAAwC,CAAC;AAC5E,OAAO,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AACpE,OAAO,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAC;AAEhE,sBAAsB;AACtB,MAAM,IA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,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"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import type { CoordinaloClient } from '
|
|
2
|
+
import type { CoordinaloClient } from '../../client.js';
|
|
3
3
|
declare const ActorSchema: z.ZodObject<{
|
|
4
4
|
type: z.ZodEnum<["client", "provider", "organization", "agent"]>;
|
|
5
5
|
id: z.ZodString;
|
|
@@ -40,9 +40,9 @@ export declare const clientsTools: {
|
|
|
40
40
|
page: number;
|
|
41
41
|
search?: string | undefined;
|
|
42
42
|
}, {
|
|
43
|
-
search?: string | undefined;
|
|
44
43
|
limit?: number | undefined;
|
|
45
44
|
page?: number | undefined;
|
|
45
|
+
search?: string | undefined;
|
|
46
46
|
}>;
|
|
47
47
|
handler: (client: CoordinaloClient, args: {
|
|
48
48
|
search?: string;
|
|
@@ -133,6 +133,19 @@ export declare const clientsTools: {
|
|
|
133
133
|
actor: z.infer<typeof ActorSchema>;
|
|
134
134
|
}) => Promise<unknown>;
|
|
135
135
|
};
|
|
136
|
+
'clients.history': {
|
|
137
|
+
description: string;
|
|
138
|
+
schema: z.ZodObject<{
|
|
139
|
+
client_id: z.ZodString;
|
|
140
|
+
}, "strip", z.ZodTypeAny, {
|
|
141
|
+
client_id: string;
|
|
142
|
+
}, {
|
|
143
|
+
client_id: string;
|
|
144
|
+
}>;
|
|
145
|
+
handler: (client: CoordinaloClient, args: {
|
|
146
|
+
client_id: string;
|
|
147
|
+
}) => Promise<unknown>;
|
|
148
|
+
};
|
|
136
149
|
};
|
|
137
150
|
export {};
|
|
138
151
|
//# sourceMappingURL=clients.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"clients.d.ts","sourceRoot":"","sources":["../../../src/tools/authenticated/clients.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAExD,QAAA,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;EAOf,CAAC;AAEH,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;0BAQG,gBAAgB,QAAQ;YAAE,MAAM,CAAC,EAAE,MAAM,CAAC;YAAC,KAAK,CAAC,EAAE,MAAM,CAAC;YAAC,IAAI,CAAC,EAAE,MAAM,CAAA;SAAE;;;;;;;;;;;0BAc1E,gBAAgB,QAAQ;YAAE,SAAS,EAAE,MAAM,CAAA;SAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;0BAc7C,gBAAgB,QAAQ;YAAE,IAAI,EAAE,MAAM,CAAC;YAAC,SAAS,EAAE,MAAM,CAAC;YAAC,KAAK,CAAC,EAAE,MAAM,CAAC;YAAC,KAAK,CAAC,EAAE,MAAM,CAAC;YAAC,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC,CAAA;SAAE;;;;;;;;;;;0BAgB/H,gBAAgB,QAAQ;YAAE,SAAS,EAAE,MAAM,CAAA;SAAE;;CAIxE,CAAC"}
|