agent-gateway-mcp 0.1.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 ADDED
@@ -0,0 +1,303 @@
1
+ # Agent Gateway MCP
2
+
3
+ **One MCP server. Every API. Zero configuration per service.**
4
+
5
+ Your agent's web browser. Instead of installing a separate MCP server for every service your agent might need, install this one gateway and let your agent discover and use any API at runtime.
6
+
7
+ ```
8
+ Today: Agent → MCP-Slack + MCP-Gmail + MCP-Stripe + MCP-GitHub + MCP-Calendar + ...
9
+ (install, configure, and maintain each one)
10
+
11
+ Gateway: Agent → Agent Gateway (one install)
12
+ → discovers and calls any service on demand
13
+ ```
14
+
15
+ ## Quick Start
16
+
17
+ ```bash
18
+ # Install globally
19
+ npm install -g agent-gateway-mcp
20
+
21
+ # Sign in (opens browser → Sign in with Google/GitHub/Microsoft)
22
+ agent-gateway init
23
+
24
+ # Add to your MCP client config — that's it
25
+ ```
26
+
27
+ Add this to your MCP client (Claude Desktop, Cursor, etc.):
28
+
29
+ ```json
30
+ {
31
+ "mcpServers": {
32
+ "gateway": {
33
+ "command": "agent-gateway-mcp"
34
+ }
35
+ }
36
+ }
37
+ ```
38
+
39
+ Custom registry:
40
+
41
+ ```json
42
+ {
43
+ "mcpServers": {
44
+ "gateway": {
45
+ "command": "agent-gateway-mcp",
46
+ "args": ["--registry", "https://your-registry.dev"]
47
+ }
48
+ }
49
+ }
50
+ ```
51
+
52
+ ## How It Works
53
+
54
+ ```mermaid
55
+ graph LR
56
+ A[Your Agent] -->|MCP| B[Agent Gateway]
57
+ B -->|"discover('send email')"| C[Registry]
58
+ C -->|"MailForge, SendGrid, ..."| B
59
+ B -->|"/.well-known/agent"| D[MailForge API]
60
+ B -->|"/.well-known/agent"| E[SendGrid API]
61
+ B -->|OAuth / API key| D
62
+ B -->|"POST /send"| D
63
+ D -->|"200 OK"| B
64
+ B -->|Result| A
65
+
66
+ style B fill:#10b981,stroke:#059669,color:#000
67
+ style C fill:#3b82f6,stroke:#2563eb,color:#fff
68
+ ```
69
+
70
+ **The flow:**
71
+
72
+ 1. Agent asks: *"Send an email to Alice"*
73
+ 2. Gateway searches the registry: *"send email"*
74
+ 3. Registry returns matching services (MailForge, SendGrid, ...)
75
+ 4. Agent picks one, gateway fetches its `/.well-known/agent` manifest
76
+ 5. Agent drills into the `send_email` capability for full details
77
+ 6. Gateway handles auth (OAuth2 / API key), constructs the HTTP request, calls the API
78
+ 7. Response flows back to the agent
79
+
80
+ No MCP plugin was installed for MailForge. No configuration file was edited. The agent discovered it, connected, and used it — all at runtime.
81
+
82
+ ## Architecture
83
+
84
+ ```
85
+ ~/.agent-gateway/
86
+ ├── config.json # Registry URL, identity, sync state
87
+ ├── tokens.json # Service tokens and connections
88
+ └── cache/
89
+ ├── manifests/ # /.well-known/agent manifests (24h TTL)
90
+ ├── details/ # Capability details (1h TTL)
91
+ └── discovery/ # Registry search results (15min TTL)
92
+ ```
93
+
94
+ **Identity-first auth:** Your Google/GitHub/Microsoft account is your identity. Sign in once, and all your service connections are stored on the registry and synced across machines. Set up a new machine? `agent-gateway init` → sign in → all connections restored.
95
+
96
+ **Cloud-synced tokens:** Tokens are encrypted at rest on the registry. Local cache in `~/.agent-gateway/` for speed. New connections auto-sync to cloud.
97
+
98
+ **Smart caching:** Three-tier TTLs prevent unnecessary network calls:
99
+ - **Manifests**: 24 hours (service capabilities rarely change)
100
+ - **Capability details**: 1 hour (endpoints and schemas are stable)
101
+ - **Discovery results**: 15 minutes (new services may appear)
102
+
103
+ Both in-memory hot cache and disk-backed persistent cache.
104
+
105
+ ## Tool Reference
106
+
107
+ ### `discover` — Find and explore services
108
+
109
+ Search the registry by intent, explore a domain's manifest, or drill into a capability.
110
+
111
+ ```
112
+ # Search by intent
113
+ discover({ query: "send email" })
114
+
115
+ # Explore a specific service
116
+ discover({ domain: "api.mailforge.dev" })
117
+
118
+ # Get full capability details
119
+ discover({ domain: "api.mailforge.dev", capability: "send_email" })
120
+ ```
121
+
122
+ **Parameters:**
123
+ | Name | Type | Description |
124
+ |------|------|-------------|
125
+ | `query` | string? | Natural language search (e.g. "send email", "create invoice") |
126
+ | `domain` | string? | Specific domain to explore |
127
+ | `capability` | string? | Capability name to drill into (requires `domain`) |
128
+
129
+ ### `call` — Execute a capability
130
+
131
+ Calls a capability on a service. The gateway handles everything: auth, request construction, and execution.
132
+
133
+ ```
134
+ call({
135
+ domain: "api.mailforge.dev",
136
+ capability: "send_email",
137
+ params: {
138
+ to: "alice@example.com",
139
+ subject: "Hello",
140
+ body: "Hi Alice!"
141
+ }
142
+ })
143
+ ```
144
+
145
+ **Parameters:**
146
+ | Name | Type | Description |
147
+ |------|------|-------------|
148
+ | `domain` | string | Service domain |
149
+ | `capability` | string | Capability name |
150
+ | `params` | object? | Parameters for the capability |
151
+ | `api_key` | string? | API key (if service requires one and you haven't connected) |
152
+
153
+ ### `auth` — Connect to a service
154
+
155
+ Initiates authentication with a service. Handles OAuth2 (browser flow), API keys, and public APIs.
156
+
157
+ ```
158
+ # OAuth2 service (opens browser)
159
+ auth({ domain: "api.mailforge.dev" })
160
+
161
+ # API key service
162
+ auth({ domain: "api.weather.io", api_key: "sk-abc123" })
163
+ ```
164
+
165
+ **Parameters:**
166
+ | Name | Type | Description |
167
+ |------|------|-------------|
168
+ | `domain` | string | Service domain to connect to |
169
+ | `api_key` | string? | API key (for api_key auth type services) |
170
+
171
+ ### `subscribe` — Subscribe to a paid plan
172
+
173
+ Shows plan details and initiates payment. The agent **never** auto-approves payments — always requires human confirmation via push notification or browser.
174
+
175
+ ```
176
+ subscribe({ domain: "api.invoicing.io", plan: "Pro" })
177
+ ```
178
+
179
+ ### `manage_subscriptions` — Manage existing subscriptions
180
+
181
+ ```
182
+ # List all subscriptions
183
+ manage_subscriptions({})
184
+
185
+ # Cancel a subscription
186
+ manage_subscriptions({ domain: "api.invoicing.io", action: "cancel" })
187
+
188
+ # Upgrade
189
+ manage_subscriptions({ domain: "api.invoicing.io", action: "upgrade", plan: "Enterprise" })
190
+ ```
191
+
192
+ ### `list_connections` — View connected services
193
+
194
+ ```
195
+ # List all
196
+ list_connections({})
197
+
198
+ # Details for one service
199
+ list_connections({ domain: "api.mailforge.dev" })
200
+ ```
201
+
202
+ ## End-to-End Demo
203
+
204
+ Here's what a real agent conversation looks like with the gateway:
205
+
206
+ ```
207
+ User: "Send an invoice to Acme Corp for $5,000"
208
+
209
+ Agent → discover({ query: "create invoice" })
210
+ Gateway: Found 2 services:
211
+ InvoiceNinja (api.invoiceninja.com) [NOT CONNECTED]
212
+ - create_invoice: Create and send a professional invoice
213
+ BillingBot (api.billingbot.io) [NOT CONNECTED]
214
+ - create_invoice: Generate invoices with templates
215
+
216
+ Agent → discover({ domain: "api.invoiceninja.com", capability: "create_invoice" })
217
+ Gateway: create_invoice — InvoiceNinja
218
+ Endpoint: POST https://api.invoiceninja.com/v1/invoices
219
+ Parameters:
220
+ - client_name (string, required): Client company name
221
+ - amount (number, required): Invoice amount in cents
222
+ - currency (string, optional): ISO currency code. Default: USD
223
+ - ...
224
+
225
+ Agent → auth({ domain: "api.invoiceninja.com" })
226
+ Gateway: InvoiceNinja requires an API key.
227
+ Get your key at: https://app.invoiceninja.com/settings/api
228
+ Provide it with: auth({ domain: "api.invoiceninja.com", api_key: "..." })
229
+
230
+ User: "Here's my key: INJ-abc123"
231
+
232
+ Agent → auth({ domain: "api.invoiceninja.com", api_key: "INJ-abc123" })
233
+ Gateway: API key stored for InvoiceNinja. Connected.
234
+
235
+ Agent → call({
236
+ domain: "api.invoiceninja.com",
237
+ capability: "create_invoice",
238
+ params: {
239
+ client_name: "Acme Corp",
240
+ amount: 500000,
241
+ currency: "USD",
242
+ description: "Consulting services"
243
+ }
244
+ })
245
+ Gateway: create_invoice on api.invoiceninja.com — HTTP 201
246
+ { "invoice_id": "INV-2024-0042", "status": "sent", "pdf_url": "..." }
247
+
248
+ Agent: "Done! Invoice INV-2024-0042 for $5,000 has been sent to Acme Corp."
249
+ ```
250
+
251
+ The agent discovered InvoiceNinja, learned how to use it, authenticated, and called it — all through one gateway. No MCP plugin for InvoiceNinja was installed.
252
+
253
+ ## Comparison
254
+
255
+ | | N MCP Servers | 1 Agent Gateway |
256
+ |---|---|---|
257
+ | **Install** | `npm install` each one | `npm install` once |
258
+ | **Configure** | Edit JSON per service | `agent-gateway init` (one time) |
259
+ | **New service** | Install new MCP server | Agent discovers it at runtime |
260
+ | **Auth** | Configure per service | Cloud-synced, auto-managed |
261
+ | **New machine** | Reconfigure everything | `agent-gateway init` → sign in → done |
262
+ | **Context window** | Polluted with all tools | Only active tools loaded |
263
+ | **Maintenance** | Update each server | Update one package |
264
+ | **Discovery** | You must know it exists | Search by intent |
265
+
266
+ ## CLI Reference
267
+
268
+ ### `agent-gateway init`
269
+
270
+ Interactive setup. Opens browser for identity provider sign-in, syncs existing connections.
271
+
272
+ ```bash
273
+ agent-gateway init # Default (Google)
274
+ agent-gateway init --provider github # Use GitHub
275
+ agent-gateway init --provider microsoft # Use Microsoft
276
+ agent-gateway init --registry https://custom.dev # Custom registry
277
+ ```
278
+
279
+ ### `agent-gateway-mcp`
280
+
281
+ Starts the MCP server (used by MCP clients, not run manually).
282
+
283
+ ```bash
284
+ agent-gateway-mcp # Default registry
285
+ agent-gateway-mcp --registry https://custom.dev # Custom registry
286
+ ```
287
+
288
+ ## Security
289
+
290
+ - **Tokens encrypted at rest** on the registry
291
+ - **Local cache** in `~/.agent-gateway/` (user-only permissions)
292
+ - **OAuth2 with PKCE** for browser-based auth flows
293
+ - **No master password** — your identity provider handles authentication
294
+ - **Human-in-the-loop for payments** — the agent can never auto-approve subscriptions
295
+ - **Token auto-refresh** — expired OAuth2 tokens are refreshed transparently
296
+
297
+ ## Protocol
298
+
299
+ This gateway implements the [Agent Discovery Protocol](../spec/README.md) — an open standard for service-to-agent communication via `/.well-known/agent` manifests. Any service that implements the spec is instantly accessible through this gateway.
300
+
301
+ ## License
302
+
303
+ MIT
package/dist/auth.d.ts ADDED
@@ -0,0 +1,9 @@
1
+ import type { StoredToken } from "./types.js";
2
+ export interface AuthResult {
3
+ success: boolean;
4
+ message: string;
5
+ token?: StoredToken;
6
+ }
7
+ export declare function authenticate(domain: string): Promise<AuthResult>;
8
+ export declare function storeApiKey(domain: string, apiKey: string): Promise<AuthResult>;
9
+ //# sourceMappingURL=auth.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../src/auth.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,WAAW,EAAY,MAAM,YAAY,CAAC;AAExD,MAAM,WAAW,UAAU;IACzB,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,WAAW,CAAC;CACrB;AAED,wBAAsB,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC,CAkFtE;AAED,wBAAsB,WAAW,CAC/B,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,GACb,OAAO,CAAC,UAAU,CAAC,CA8BrB"}
package/dist/auth.js ADDED
@@ -0,0 +1,272 @@
1
+ import http from "http";
2
+ import { loadConfig, getToken, storeToken, storeConnection } from "./config.js";
3
+ import { fetchManifest } from "./discovery.js";
4
+ export async function authenticate(domain) {
5
+ // Check existing token
6
+ const existing = getToken(domain);
7
+ if (existing && existing.access_token) {
8
+ return {
9
+ success: true,
10
+ message: `Already connected to ${domain}.`,
11
+ token: existing,
12
+ };
13
+ }
14
+ // If token exists but expired, try refresh
15
+ if (existing && !existing.access_token && existing.refresh_token) {
16
+ const refreshed = await tryRefreshToken(domain, existing);
17
+ if (refreshed) {
18
+ return {
19
+ success: true,
20
+ message: `Token refreshed for ${domain}.`,
21
+ token: refreshed,
22
+ };
23
+ }
24
+ }
25
+ // Fetch manifest to get auth requirements
26
+ let manifest;
27
+ try {
28
+ manifest = await fetchManifest(domain);
29
+ }
30
+ catch (err) {
31
+ return {
32
+ success: false,
33
+ message: `Cannot reach ${domain}: ${err instanceof Error ? err.message : "unknown error"}`,
34
+ };
35
+ }
36
+ const auth = manifest.auth;
37
+ if (auth.type === "none") {
38
+ const token = {
39
+ domain,
40
+ type: "api_key",
41
+ access_token: "none",
42
+ };
43
+ storeToken(token);
44
+ storeConnection({
45
+ domain,
46
+ service_name: manifest.name,
47
+ auth_type: "none",
48
+ token,
49
+ connected_at: new Date().toISOString(),
50
+ });
51
+ return {
52
+ success: true,
53
+ message: `${manifest.name} requires no authentication. Connected.`,
54
+ token,
55
+ };
56
+ }
57
+ if (auth.type === "api_key") {
58
+ return {
59
+ success: false,
60
+ message: [
61
+ `${manifest.name} requires an API key.`,
62
+ auth.setup_url ? `Get your key at: ${auth.setup_url}` : "",
63
+ `Once you have it, the agent should call the auth tool with:`,
64
+ ` domain: "${domain}"`,
65
+ `Then provide the API key when prompted.`,
66
+ ``,
67
+ `Or set the key manually: the header is "${auth.header ?? "Authorization"}"${auth.prefix ? ` with prefix "${auth.prefix}"` : ""}.`,
68
+ ]
69
+ .filter(Boolean)
70
+ .join("\n"),
71
+ };
72
+ }
73
+ if (auth.type === "oauth2") {
74
+ return startOAuth2Flow(domain, manifest);
75
+ }
76
+ return {
77
+ success: false,
78
+ message: `Unknown auth type: ${auth.type}`,
79
+ };
80
+ }
81
+ export async function storeApiKey(domain, apiKey) {
82
+ let manifest;
83
+ try {
84
+ manifest = await fetchManifest(domain);
85
+ }
86
+ catch (err) {
87
+ return {
88
+ success: false,
89
+ message: `Cannot reach ${domain}: ${err instanceof Error ? err.message : "unknown error"}`,
90
+ };
91
+ }
92
+ const token = {
93
+ domain,
94
+ type: "api_key",
95
+ access_token: apiKey,
96
+ };
97
+ storeToken(token);
98
+ storeConnection({
99
+ domain,
100
+ service_name: manifest.name,
101
+ auth_type: "api_key",
102
+ token,
103
+ connected_at: new Date().toISOString(),
104
+ });
105
+ return {
106
+ success: true,
107
+ message: `API key stored for ${manifest.name}. Connected.`,
108
+ token,
109
+ };
110
+ }
111
+ async function tryRefreshToken(domain, existing) {
112
+ try {
113
+ const manifest = await fetchManifest(domain);
114
+ if (manifest.auth.type !== "oauth2" || !manifest.auth.token_url) {
115
+ return null;
116
+ }
117
+ const body = new URLSearchParams({
118
+ grant_type: "refresh_token",
119
+ refresh_token: existing.refresh_token,
120
+ });
121
+ const res = await fetch(manifest.auth.token_url, {
122
+ method: "POST",
123
+ headers: { "Content-Type": "application/x-www-form-urlencoded" },
124
+ body: body.toString(),
125
+ signal: AbortSignal.timeout(10000),
126
+ });
127
+ if (!res.ok)
128
+ return null;
129
+ const data = (await res.json());
130
+ const token = {
131
+ domain,
132
+ type: "oauth2",
133
+ access_token: data.access_token,
134
+ refresh_token: data.refresh_token ?? existing.refresh_token,
135
+ expires_at: data.expires_in
136
+ ? Date.now() + data.expires_in * 1000
137
+ : undefined,
138
+ scopes: existing.scopes,
139
+ };
140
+ storeToken(token);
141
+ return token;
142
+ }
143
+ catch {
144
+ return null;
145
+ }
146
+ }
147
+ async function startOAuth2Flow(domain, manifest) {
148
+ const auth = manifest.auth;
149
+ if (!auth.authorization_url || !auth.token_url) {
150
+ return {
151
+ success: false,
152
+ message: "OAuth2 configuration missing authorization_url or token_url.",
153
+ };
154
+ }
155
+ const config = loadConfig();
156
+ const port = config.auth_callback_port;
157
+ const redirectUri = `http://localhost:${port}/callback`;
158
+ const state = Math.random().toString(36).substring(2);
159
+ const authUrl = new URL(auth.authorization_url);
160
+ authUrl.searchParams.set("response_type", "code");
161
+ authUrl.searchParams.set("redirect_uri", redirectUri);
162
+ authUrl.searchParams.set("state", state);
163
+ if (auth.scopes?.length) {
164
+ authUrl.searchParams.set("scope", auth.scopes.join(" "));
165
+ }
166
+ // Start local callback server
167
+ const tokenPromise = new Promise((resolve, reject) => {
168
+ const timeout = setTimeout(() => {
169
+ server.close();
170
+ reject(new Error("OAuth timeout — no callback received within 120 seconds."));
171
+ }, 120000);
172
+ const server = http.createServer(async (req, res) => {
173
+ const url = new URL(req.url ?? "/", `http://localhost:${port}`);
174
+ if (url.pathname !== "/callback") {
175
+ res.writeHead(404);
176
+ res.end("Not found");
177
+ return;
178
+ }
179
+ const code = url.searchParams.get("code");
180
+ const returnedState = url.searchParams.get("state");
181
+ const error = url.searchParams.get("error");
182
+ if (error) {
183
+ res.writeHead(200, { "Content-Type": "text/html" });
184
+ res.end(`<html><body><h2>Authorization failed</h2><p>${error}</p><p>You can close this tab.</p></body></html>`);
185
+ clearTimeout(timeout);
186
+ server.close();
187
+ reject(new Error(`OAuth error: ${error}`));
188
+ return;
189
+ }
190
+ if (!code || returnedState !== state) {
191
+ res.writeHead(400, { "Content-Type": "text/html" });
192
+ res.end("<html><body><h2>Invalid callback</h2><p>Missing code or state mismatch.</p></body></html>");
193
+ return;
194
+ }
195
+ // Exchange code for token
196
+ try {
197
+ const tokenBody = new URLSearchParams({
198
+ grant_type: "authorization_code",
199
+ code,
200
+ redirect_uri: redirectUri,
201
+ });
202
+ const tokenRes = await fetch(auth.token_url, {
203
+ method: "POST",
204
+ headers: { "Content-Type": "application/x-www-form-urlencoded" },
205
+ body: tokenBody.toString(),
206
+ signal: AbortSignal.timeout(10000),
207
+ });
208
+ if (!tokenRes.ok) {
209
+ throw new Error(`Token exchange failed: HTTP ${tokenRes.status}`);
210
+ }
211
+ const tokenData = (await tokenRes.json());
212
+ const token = {
213
+ domain,
214
+ type: "oauth2",
215
+ access_token: tokenData.access_token,
216
+ refresh_token: tokenData.refresh_token,
217
+ expires_at: tokenData.expires_in
218
+ ? Date.now() + tokenData.expires_in * 1000
219
+ : undefined,
220
+ scopes: tokenData.scope?.split(" ") ?? auth.scopes,
221
+ };
222
+ res.writeHead(200, { "Content-Type": "text/html" });
223
+ res.end(`<html><body><h2>Connected to ${manifest.name}!</h2><p>You can close this tab and return to your agent.</p></body></html>`);
224
+ clearTimeout(timeout);
225
+ server.close();
226
+ resolve(token);
227
+ }
228
+ catch (err) {
229
+ res.writeHead(500, { "Content-Type": "text/html" });
230
+ res.end(`<html><body><h2>Token exchange failed</h2><p>${err instanceof Error ? err.message : "Unknown error"}</p></body></html>`);
231
+ clearTimeout(timeout);
232
+ server.close();
233
+ reject(err);
234
+ }
235
+ });
236
+ server.listen(port, () => {
237
+ // Server ready
238
+ });
239
+ });
240
+ // Open browser
241
+ try {
242
+ const open = (await import("open")).default;
243
+ await open(authUrl.toString());
244
+ }
245
+ catch {
246
+ // If open fails, just return the URL
247
+ }
248
+ const openMessage = `Opening browser for authorization...\n\nIf the browser didn't open, visit:\n${authUrl.toString()}\n\nWaiting for callback on http://localhost:${port}/callback...`;
249
+ try {
250
+ const token = await tokenPromise;
251
+ storeToken(token);
252
+ storeConnection({
253
+ domain,
254
+ service_name: manifest.name,
255
+ auth_type: "oauth2",
256
+ token,
257
+ connected_at: new Date().toISOString(),
258
+ });
259
+ return {
260
+ success: true,
261
+ message: `${openMessage}\n\nConnected to ${manifest.name} via OAuth2.`,
262
+ token,
263
+ };
264
+ }
265
+ catch (err) {
266
+ return {
267
+ success: false,
268
+ message: `${openMessage}\n\nAuth failed: ${err instanceof Error ? err.message : "unknown error"}`,
269
+ };
270
+ }
271
+ }
272
+ //# sourceMappingURL=auth.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"auth.js","sourceRoot":"","sources":["../src/auth.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAChF,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAS/C,MAAM,CAAC,KAAK,UAAU,YAAY,CAAC,MAAc;IAC/C,uBAAuB;IACvB,MAAM,QAAQ,GAAG,QAAQ,CAAC,MAAM,CAAC,CAAC;IAClC,IAAI,QAAQ,IAAI,QAAQ,CAAC,YAAY,EAAE,CAAC;QACtC,OAAO;YACL,OAAO,EAAE,IAAI;YACb,OAAO,EAAE,wBAAwB,MAAM,GAAG;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,qCAAqC;IACvC,CAAC;IAED,MAAM,WAAW,GAAG,+EAA+E,OAAO,CAAC,QAAQ,EAAE,gDAAgD,IAAI,cAAc,CAAC;IAExL,IAAI,CAAC;QACH,MAAM,KAAK,GAAG,MAAM,YAAY,CAAC;QACjC,UAAU,CAAC,KAAK,CAAC,CAAC;QAClB,eAAe,CAAC;YACd,MAAM;YACN,YAAY,EAAE,QAAQ,CAAC,IAAI;YAC3B,SAAS,EAAE,QAAQ;YACnB,KAAK;YACL,YAAY,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;SACvC,CAAC,CAAC;QACH,OAAO;YACL,OAAO,EAAE,IAAI;YACb,OAAO,EAAE,GAAG,WAAW,oBAAoB,QAAQ,CAAC,IAAI,cAAc;YACtE,KAAK;SACN,CAAC;IACJ,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,OAAO;YACL,OAAO,EAAE,KAAK;YACd,OAAO,EAAE,GAAG,WAAW,oBAAoB,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,eAAe,EAAE;SAClG,CAAC;IACJ,CAAC;AACH,CAAC"}
@@ -0,0 +1,9 @@
1
+ export interface CallResult {
2
+ success: boolean;
3
+ status?: number;
4
+ data?: unknown;
5
+ error?: string;
6
+ auth_required?: boolean;
7
+ }
8
+ export declare function callCapability(domain: string, capabilityName: string, params: Record<string, unknown>, apiKey?: string): Promise<CallResult>;
9
+ //# sourceMappingURL=caller.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"caller.d.ts","sourceRoot":"","sources":["../src/caller.ts"],"names":[],"mappings":"AAKA,MAAM,WAAW,UAAU;IACzB,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB;AAED,wBAAsB,cAAc,CAClC,MAAM,EAAE,MAAM,EACd,cAAc,EAAE,MAAM,EACtB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC/B,MAAM,CAAC,EAAE,MAAM,GACd,OAAO,CAAC,UAAU,CAAC,CA+GrB"}