silkweave 1.3.1 → 1.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/.turbo/turbo-build.log +9 -9
- package/.turbo/turbo-check.log +12 -0
- package/.turbo/turbo-lint.log +5 -0
- package/.turbo/turbo-prepack.log +12 -12
- package/README.md +97 -29
- package/package.json +8 -8
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
|
|
2
2
|
|
|
3
|
-
> silkweave@1.3.
|
|
3
|
+
> silkweave@1.3.2 build /Users/atomic/projects/ai/silkweave/packages/silkweave
|
|
4
4
|
> tsup
|
|
5
5
|
|
|
6
6
|
[34mCLI[39m Building entry: src/auth.ts, src/cli.ts, src/core.ts, src/fastify.ts, src/logger.ts, src/mcp.ts, src/vercel.ts
|
|
@@ -11,22 +11,22 @@
|
|
|
11
11
|
[34mCLI[39m Cleaning output folder
|
|
12
12
|
[34mESM[39m Build start
|
|
13
13
|
[32mESM[39m [1mbuild/cli.js [22m[32m77.00 B[39m
|
|
14
|
+
[32mESM[39m [1mbuild/fastify.js [22m[32m89.00 B[39m
|
|
14
15
|
[32mESM[39m [1mbuild/core.js [22m[32m80.00 B[39m
|
|
15
|
-
[32mESM[39m [1mbuild/
|
|
16
|
+
[32mESM[39m [1mbuild/logger.js [22m[32m86.00 B[39m
|
|
16
17
|
[32mESM[39m [1mbuild/mcp.js [22m[32m77.00 B[39m
|
|
17
18
|
[32mESM[39m [1mbuild/auth.js [22m[32m80.00 B[39m
|
|
18
|
-
[32mESM[39m [1mbuild/
|
|
19
|
-
[32mESM[39m [1mbuild/logger.js [22m[32m86.00 B[39m
|
|
19
|
+
[32mESM[39m [1mbuild/vercel.js [22m[32m86.00 B[39m
|
|
20
20
|
[32mESM[39m [1mbuild/cli.js.map [22m[32m131.00 B[39m
|
|
21
|
-
[32mESM[39m [1mbuild/core.js.map [22m[32m133.00 B[39m
|
|
22
|
-
[32mESM[39m [1mbuild/mcp.js.map [22m[32m131.00 B[39m
|
|
23
|
-
[32mESM[39m [1mbuild/vercel.js.map [22m[32m137.00 B[39m
|
|
24
21
|
[32mESM[39m [1mbuild/fastify.js.map [22m[32m139.00 B[39m
|
|
25
|
-
[32mESM[39m [1mbuild/auth.js.map [22m[32m133.00 B[39m
|
|
26
22
|
[32mESM[39m [1mbuild/logger.js.map [22m[32m137.00 B[39m
|
|
23
|
+
[32mESM[39m [1mbuild/core.js.map [22m[32m133.00 B[39m
|
|
24
|
+
[32mESM[39m [1mbuild/auth.js.map [22m[32m133.00 B[39m
|
|
25
|
+
[32mESM[39m [1mbuild/vercel.js.map [22m[32m137.00 B[39m
|
|
26
|
+
[32mESM[39m [1mbuild/mcp.js.map [22m[32m131.00 B[39m
|
|
27
27
|
[32mESM[39m ⚡️ Build success in 6ms
|
|
28
28
|
DTS Build start
|
|
29
|
-
DTS ⚡️ Build success in
|
|
29
|
+
DTS ⚡️ Build success in 643ms
|
|
30
30
|
DTS build/auth.d.ts 194.00 B
|
|
31
31
|
DTS build/cli.d.ts 32.00 B
|
|
32
32
|
DTS build/core.d.ts 33.00 B
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
|
|
2
|
+
> silkweave@1.3.2 check /Users/atomic/projects/ai/silkweave/packages/silkweave
|
|
3
|
+
> pnpm lint && pnpm typecheck
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
> silkweave@1.3.2 lint /Users/atomic/projects/ai/silkweave/packages/silkweave
|
|
7
|
+
> eslint
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
> silkweave@1.3.2 typecheck /Users/atomic/projects/ai/silkweave/packages/silkweave
|
|
11
|
+
> tsc --noEmit
|
|
12
|
+
|
package/.turbo/turbo-prepack.log
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
|
|
2
2
|
|
|
3
|
-
> silkweave@1.
|
|
3
|
+
> silkweave@1.4.0 prepack /Users/atomic/projects/ai/silkweave/packages/silkweave
|
|
4
4
|
> pnpm clean && pnpm build
|
|
5
5
|
|
|
6
6
|
|
|
7
|
-
> silkweave@1.
|
|
7
|
+
> silkweave@1.4.0 clean /Users/atomic/projects/ai/silkweave/packages/silkweave
|
|
8
8
|
> rimraf build
|
|
9
9
|
|
|
10
10
|
|
|
11
|
-
> silkweave@1.
|
|
11
|
+
> silkweave@1.4.0 build /Users/atomic/projects/ai/silkweave/packages/silkweave
|
|
12
12
|
> tsup
|
|
13
13
|
|
|
14
14
|
[34mCLI[39m Building entry: src/auth.ts, src/cli.ts, src/core.ts, src/fastify.ts, src/logger.ts, src/mcp.ts, src/vercel.ts
|
|
@@ -19,22 +19,22 @@
|
|
|
19
19
|
[34mCLI[39m Cleaning output folder
|
|
20
20
|
[34mESM[39m Build start
|
|
21
21
|
[32mESM[39m [1mbuild/core.js [22m[32m80.00 B[39m
|
|
22
|
-
[32mESM[39m [1mbuild/fastify.js [22m[32m89.00 B[39m
|
|
23
|
-
[32mESM[39m [1mbuild/logger.js [22m[32m86.00 B[39m
|
|
24
22
|
[32mESM[39m [1mbuild/auth.js [22m[32m80.00 B[39m
|
|
25
|
-
[32mESM[39m [1mbuild/vercel.js [22m[32m86.00 B[39m
|
|
26
|
-
[32mESM[39m [1mbuild/cli.js [22m[32m77.00 B[39m
|
|
27
23
|
[32mESM[39m [1mbuild/mcp.js [22m[32m77.00 B[39m
|
|
28
|
-
[32mESM[39m [1mbuild/
|
|
29
|
-
[32mESM[39m [1mbuild/
|
|
24
|
+
[32mESM[39m [1mbuild/cli.js [22m[32m77.00 B[39m
|
|
25
|
+
[32mESM[39m [1mbuild/vercel.js [22m[32m86.00 B[39m
|
|
26
|
+
[32mESM[39m [1mbuild/fastify.js [22m[32m89.00 B[39m
|
|
27
|
+
[32mESM[39m [1mbuild/logger.js [22m[32m86.00 B[39m
|
|
30
28
|
[32mESM[39m [1mbuild/core.js.map [22m[32m133.00 B[39m
|
|
31
|
-
[32mESM[39m [1mbuild/cli.js.map [22m[32m131.00 B[39m
|
|
32
29
|
[32mESM[39m [1mbuild/auth.js.map [22m[32m133.00 B[39m
|
|
33
30
|
[32mESM[39m [1mbuild/mcp.js.map [22m[32m131.00 B[39m
|
|
31
|
+
[32mESM[39m [1mbuild/fastify.js.map [22m[32m139.00 B[39m
|
|
32
|
+
[32mESM[39m [1mbuild/cli.js.map [22m[32m131.00 B[39m
|
|
34
33
|
[32mESM[39m [1mbuild/vercel.js.map [22m[32m137.00 B[39m
|
|
35
|
-
[32mESM[39m
|
|
34
|
+
[32mESM[39m [1mbuild/logger.js.map [22m[32m137.00 B[39m
|
|
35
|
+
[32mESM[39m ⚡️ Build success in 6ms
|
|
36
36
|
DTS Build start
|
|
37
|
-
DTS ⚡️ Build success in
|
|
37
|
+
DTS ⚡️ Build success in 676ms
|
|
38
38
|
DTS build/auth.d.ts 194.00 B
|
|
39
39
|
DTS build/cli.d.ts 32.00 B
|
|
40
40
|
DTS build/core.d.ts 33.00 B
|
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
**Write your logic once. Run it everywhere.**
|
|
4
4
|
|
|
5
|
-
Silkweave is a TypeScript toolkit that lets you define application logic as portable **Actions** and instantly expose them through any combination of transports
|
|
5
|
+
Silkweave is a TypeScript toolkit that lets you define application logic as portable **Actions** and instantly expose them through any combination of transports - MCP servers (stdio and HTTP), REST APIs with auto-generated OpenAPI docs, and fully-featured CLIs. No glue code required.
|
|
6
6
|
|
|
7
7
|
```
|
|
8
8
|
┌─────────────────────┐
|
|
@@ -39,6 +39,7 @@ Silkweave is a TypeScript toolkit that lets you define application logic as port
|
|
|
39
39
|
- [CLI](#cli)
|
|
40
40
|
- [Vercel Serverless](#vercel-serverless)
|
|
41
41
|
- [Logging and Progress](#logging-and-progress)
|
|
42
|
+
- [Smart Tool Results](#smart-tool-results)
|
|
42
43
|
- [Advanced Patterns](#advanced-patterns)
|
|
43
44
|
- [Multiple Adapters Simultaneously](#multiple-adapters-simultaneously)
|
|
44
45
|
- [CLI Arguments vs Options](#cli-arguments-vs-options)
|
|
@@ -51,9 +52,9 @@ Silkweave is a TypeScript toolkit that lets you define application logic as port
|
|
|
51
52
|
|
|
52
53
|
## Why Silkweave
|
|
53
54
|
|
|
54
|
-
Building an MCP server usually means wiring up transports, registering tools, serializing responses, and handling errors
|
|
55
|
+
Building an MCP server usually means wiring up transports, registering tools, serializing responses, and handling errors - for every single tool. If you also want a CLI or REST API for the same logic, you're writing it all again.
|
|
55
56
|
|
|
56
|
-
Silkweave eliminates this duplication. You define an **Action**
|
|
57
|
+
Silkweave eliminates this duplication. You define an **Action** - a name, a Zod schema, and an async function - and Silkweave handles the rest:
|
|
57
58
|
|
|
58
59
|
- **MCP adapters** register your actions as MCP tools with proper notifications, progress reporting, and error handling
|
|
59
60
|
- **Fastify adapter** generates a REST API with full OpenAPI/Swagger documentation derived from your Zod schemas
|
|
@@ -69,12 +70,12 @@ Silkweave is organized as a monorepo with modular packages. Install only what yo
|
|
|
69
70
|
|
|
70
71
|
| Package | npm | Description |
|
|
71
72
|
|---------|-----|-------------|
|
|
72
|
-
| `@silkweave/core` | [](https://www.npmjs.com/package/@silkweave/core) | Core library
|
|
73
|
-
| `@silkweave/mcp` | [](https://www.npmjs.com/package/@silkweave/mcp) | MCP adapters
|
|
74
|
-
| `@silkweave/cli` | [](https://www.npmjs.com/package/@silkweave/cli) | CLI adapter
|
|
75
|
-
| `@silkweave/fastify` | [](https://www.npmjs.com/package/@silkweave/fastify) | Fastify REST adapter
|
|
76
|
-
| `@silkweave/vercel` | [](https://www.npmjs.com/package/@silkweave/vercel) | Vercel serverless adapter
|
|
77
|
-
| `@silkweave/logger` | [](https://www.npmjs.com/package/@silkweave/logger) | Logging utilities
|
|
73
|
+
| `@silkweave/core` | [](https://www.npmjs.com/package/@silkweave/core) | Core library - actions, adapters, builder, context, logger, utilities |
|
|
74
|
+
| `@silkweave/mcp` | [](https://www.npmjs.com/package/@silkweave/mcp) | MCP adapters - stdio, streamable HTTP, CLI proxy |
|
|
75
|
+
| `@silkweave/cli` | [](https://www.npmjs.com/package/@silkweave/cli) | CLI adapter - commander + clack terminal UI |
|
|
76
|
+
| `@silkweave/fastify` | [](https://www.npmjs.com/package/@silkweave/fastify) | Fastify REST adapter - auto-generated OpenAPI/Swagger docs |
|
|
77
|
+
| `@silkweave/vercel` | [](https://www.npmjs.com/package/@silkweave/vercel) | Vercel serverless adapter - stateless MCP over Streamable HTTP |
|
|
78
|
+
| `@silkweave/logger` | [](https://www.npmjs.com/package/@silkweave/logger) | Logging utilities - pino, clack, and MCP notification support |
|
|
78
79
|
|
|
79
80
|
**`@silkweave/core`** is always required. Then add the adapter packages for the transports you need:
|
|
80
81
|
|
|
@@ -178,7 +179,8 @@ export const SearchAction = createAction({
|
|
|
178
179
|
| `description` | `string` | Human-readable description. Shown in MCP tool listings, CLI help, and Swagger docs. |
|
|
179
180
|
| `input` | `z.ZodObject` | A Zod object schema defining the input. `.describe()` on each field provides per-field documentation across all adapters. |
|
|
180
181
|
| `args` | `(keyof I)[]` | *(Optional)* Fields to expose as positional CLI arguments instead of `--options`. Only relevant for the CLI adapter. |
|
|
181
|
-
| `run` | `(input, context) => Promise<O>` | The implementation. Receives validated input and an `SilkweaveContext` with a `logger`. Returns any object
|
|
182
|
+
| `run` | `(input, context) => Promise<O>` | The implementation. Receives validated input and an `SilkweaveContext` with a `logger`. Returns any object - adapters handle serialization. |
|
|
183
|
+
| `toolResult` | `(response, context) => CallToolResult \| undefined` | *(Optional)* Custom MCP result formatting. Return `undefined` to fall through to the default `smartToolResult` behavior. See [Smart Tool Results](#smart-tool-results). |
|
|
182
184
|
|
|
183
185
|
### Adapters
|
|
184
186
|
|
|
@@ -204,10 +206,10 @@ cli()
|
|
|
204
206
|
|
|
205
207
|
The adapter lifecycle:
|
|
206
208
|
|
|
207
|
-
1. **Factory**
|
|
208
|
-
2. **Generator**
|
|
209
|
-
3. **Start**
|
|
210
|
-
4. **Stop**
|
|
209
|
+
1. **Factory** - `stdio()` / `http({ ... })` / etc. captures configuration
|
|
210
|
+
2. **Generator** - Silkweave calls the factory result with `{ name, description, version }` to produce an `Adapter`
|
|
211
|
+
3. **Start** - `adapter.start(actions)` registers all actions and begins listening
|
|
212
|
+
4. **Stop** - `adapter.stop()` tears down gracefully
|
|
211
213
|
|
|
212
214
|
### The Silkweave Builder
|
|
213
215
|
|
|
@@ -225,7 +227,7 @@ const app = silkweave({
|
|
|
225
227
|
|
|
226
228
|
app
|
|
227
229
|
.adapter(stdio()) // Add an adapter
|
|
228
|
-
.adapter(http({ ... })) // Add another
|
|
230
|
+
.adapter(http({ ... })) // Add another - they run in parallel
|
|
229
231
|
.action(SearchAction) // Mount an action
|
|
230
232
|
.action(GreetAction) // Mount another
|
|
231
233
|
|
|
@@ -259,10 +261,12 @@ await silkweave({ name: 'my-tools', description: 'My Tools', version: '1.0.0' })
|
|
|
259
261
|
| `name: 'searchDocs'` | Tool name: `SearchDocs` (PascalCase) |
|
|
260
262
|
| `description` | Tool description |
|
|
261
263
|
| `input` (Zod schema) | `inputSchema` (JSON Schema via Zod) |
|
|
262
|
-
| Return value | `
|
|
263
|
-
| Thrown errors | Structured error response
|
|
264
|
+
| Return value | `CallToolResult` via `smartToolResult` or custom `toolResult` hook |
|
|
265
|
+
| Thrown errors | Structured error response via `handleToolError` |
|
|
264
266
|
|
|
265
|
-
|
|
267
|
+
By default, MCP adapters use `smartToolResult()` to format return values — responses ≤ 4096 chars are returned as inline JSON, while larger payloads are automatically split into a text summary + base64 embedded resource to reduce LLM context bloat. Actions can override this with a custom [`toolResult` hook](#smart-tool-results).
|
|
268
|
+
|
|
269
|
+
MCP logging notifications are wired automatically - `logger.info("message")` in your action sends a `notifications/message` to the MCP client. Progress reporting works via `logger.progress()` when the client provides a progress token.
|
|
266
270
|
|
|
267
271
|
**Claude Desktop / Claude Code configuration:**
|
|
268
272
|
|
|
@@ -303,7 +307,7 @@ await silkweave({ name: 'my-tools', description: 'My Tools', version: '1.0.0' })
|
|
|
303
307
|
| `GET` | `/mcp` | Establish SSE stream for a session |
|
|
304
308
|
| `DELETE` | `/mcp` | Terminate a session |
|
|
305
309
|
|
|
306
|
-
The adapter manages session lifecycle automatically
|
|
310
|
+
The adapter manages session lifecycle automatically - each new `initialize` request creates a new `StreamableHTTPServerTransport` with a UUID session ID. Sessions are cleaned up when the transport closes.
|
|
307
311
|
|
|
308
312
|
CORS is configured out of the box, exposing MCP-specific headers (`Mcp-Session-Id`, `Mcp-Protocol-Version`, `Last-Event-Id`).
|
|
309
313
|
|
|
@@ -399,7 +403,7 @@ $ mytool greet --name "World" --enthusiastic
|
|
|
399
403
|
|
|
400
404
|
### Vercel Serverless
|
|
401
405
|
|
|
402
|
-
Deploy your actions as a stateless MCP server on Vercel. Each request creates a fresh server instance
|
|
406
|
+
Deploy your actions as a stateless MCP server on Vercel. Each request creates a fresh server instance - no sessions, no persistent connections, fully compatible with serverless constraints.
|
|
403
407
|
|
|
404
408
|
```typescript
|
|
405
409
|
// api/mcp.ts (Vercel function)
|
|
@@ -417,7 +421,7 @@ await silkweave({ name: 'my-tools', description: 'My Tools', version: '1.0.0' })
|
|
|
417
421
|
export default { fetch: handler }
|
|
418
422
|
```
|
|
419
423
|
|
|
420
|
-
The `vercel()` function returns a compound object
|
|
424
|
+
The `vercel()` function returns a compound object - `adapter` wires into the Silkweave builder, while `handler`/`GET`/`POST`/`DELETE` are the request handler for your Vercel route.
|
|
421
425
|
|
|
422
426
|
**For Next.js App Router** (`app/api/mcp/route.ts`):
|
|
423
427
|
|
|
@@ -437,7 +441,7 @@ export { GET, POST, DELETE }
|
|
|
437
441
|
- Uses `WebStandardStreamableHTTPServerTransport` from the MCP SDK in stateless mode (`sessionIdGenerator: undefined`)
|
|
438
442
|
- Each request creates a fresh `McpServer` + transport, registers tools, handles the request, and returns a Web Standard `Response`
|
|
439
443
|
- Logging goes to `process.stderr` (Vercel log drain) and MCP client notifications
|
|
440
|
-
- No CORS handling
|
|
444
|
+
- No CORS handling - use Next.js middleware or `vercel.json` headers
|
|
441
445
|
|
|
442
446
|
**`VercelAdapterOptions`:**
|
|
443
447
|
|
|
@@ -486,6 +490,69 @@ run: async (input, { logger }) => {
|
|
|
486
490
|
|
|
487
491
|
---
|
|
488
492
|
|
|
493
|
+
## Smart Tool Results
|
|
494
|
+
|
|
495
|
+
MCP adapters (stdio, HTTP, and Vercel) use `smartToolResult()` by default to format action return values. This is a server-side best practice for managing LLM context bloat:
|
|
496
|
+
|
|
497
|
+
- **Small responses** (≤ 4096 chars): returned as inline `TextContent` JSON
|
|
498
|
+
- **Large responses** (> 4096 chars): split into a short text summary + a base64 **embedded resource**, keeping the LLM's context window lean while preserving full data access
|
|
499
|
+
|
|
500
|
+
Some MCP clients (e.g. VS Code since December 2025) handle this client-side for all tool calls, but most clients don't — `smartToolResult` ensures good behavior regardless of client capabilities.
|
|
501
|
+
|
|
502
|
+
### Custom `toolResult` Hook
|
|
503
|
+
|
|
504
|
+
Actions can override the default formatting by defining a `toolResult` hook:
|
|
505
|
+
|
|
506
|
+
```typescript
|
|
507
|
+
import { createAction } from '@silkweave/core'
|
|
508
|
+
import { smartToolResult } from '@silkweave/mcp'
|
|
509
|
+
import z from 'zod'
|
|
510
|
+
|
|
511
|
+
export const UserListAction = createAction({
|
|
512
|
+
name: 'user-list',
|
|
513
|
+
description: 'Return a list of users',
|
|
514
|
+
input: z.object({
|
|
515
|
+
format: z.enum(['full', 'summary']).default('summary')
|
|
516
|
+
}),
|
|
517
|
+
run: async ({ format }, context) => {
|
|
518
|
+
context.set('format', format)
|
|
519
|
+
return await fetchUsers()
|
|
520
|
+
},
|
|
521
|
+
toolResult: (users, context) => {
|
|
522
|
+
if (context.get('format') === 'full') {
|
|
523
|
+
return smartToolResult(users) // Use default smart splitting
|
|
524
|
+
}
|
|
525
|
+
// Return a lean summary as text + full data as embedded resource
|
|
526
|
+
const summary = users.map(({ id, name }) => ({ id, name }))
|
|
527
|
+
return {
|
|
528
|
+
content: [
|
|
529
|
+
{ type: 'text', text: JSON.stringify(summary) },
|
|
530
|
+
{ type: 'resource', resource: {
|
|
531
|
+
uri: 'mcp://my-app/users.json',
|
|
532
|
+
mimeType: 'application/json',
|
|
533
|
+
blob: Buffer.from(JSON.stringify(users)).toString('base64')
|
|
534
|
+
}}
|
|
535
|
+
]
|
|
536
|
+
}
|
|
537
|
+
}
|
|
538
|
+
})
|
|
539
|
+
```
|
|
540
|
+
|
|
541
|
+
Return `undefined` from `toolResult` to fall through to the default `smartToolResult` behavior. The hook only affects MCP adapters — CLI and Fastify adapters handle serialization independently.
|
|
542
|
+
|
|
543
|
+
### MCP Result Utilities
|
|
544
|
+
|
|
545
|
+
All result utilities are exported from `@silkweave/mcp`:
|
|
546
|
+
|
|
547
|
+
| Function | Description |
|
|
548
|
+
|----------|-------------|
|
|
549
|
+
| `smartToolResult(data)` | Default formatter — automatic embedded resource splitting at 4096 chars |
|
|
550
|
+
| `jsonToolResult(data, isError?)` | Simple inline `TextContent` JSON (no splitting) |
|
|
551
|
+
| `errorToolResult(error)` | Format a `SilkweaveError` as an error result |
|
|
552
|
+
| `handleToolError(error)` | Catch-all error handler used by all MCP adapters |
|
|
553
|
+
|
|
554
|
+
---
|
|
555
|
+
|
|
489
556
|
## Advanced Patterns
|
|
490
557
|
|
|
491
558
|
### Multiple Adapters Simultaneously
|
|
@@ -506,7 +573,7 @@ await silkweave({ name: 'my-platform', description: 'Multi-transport', version:
|
|
|
506
573
|
.start()
|
|
507
574
|
```
|
|
508
575
|
|
|
509
|
-
All adapters start concurrently. The MCP stdio server communicates over stdin/stdout while Fastify listens on port 8080
|
|
576
|
+
All adapters start concurrently. The MCP stdio server communicates over stdin/stdout while Fastify listens on port 8080 - each serving the exact same actions.
|
|
510
577
|
|
|
511
578
|
### CLI Arguments vs Options
|
|
512
579
|
|
|
@@ -536,7 +603,7 @@ $ mytool deploy production v2.1.0 --dry-run
|
|
|
536
603
|
ℹ Deploying v2.1.0 to production (dry run)
|
|
537
604
|
```
|
|
538
605
|
|
|
539
|
-
Fields listed in `args` become positional arguments in the CLI. All other fields remain as `--options`. The `args` property has no effect on MCP or REST adapters
|
|
606
|
+
Fields listed in `args` become positional arguments in the CLI. All other fields remain as `--options`. The `args` property has no effect on MCP or REST adapters - they always receive all fields as a single input object.
|
|
540
607
|
|
|
541
608
|
### Complex Input Types
|
|
542
609
|
|
|
@@ -673,6 +740,7 @@ interface Action<I, O> {
|
|
|
673
740
|
args?: (keyof I)[]
|
|
674
741
|
isEnabled?: (context: SilkweaveContext) => boolean
|
|
675
742
|
run: (input: I, context: SilkweaveContext) => Promise<O>
|
|
743
|
+
toolResult?: (response: O, context: SilkweaveContext) => CallToolResult | undefined
|
|
676
744
|
}
|
|
677
745
|
```
|
|
678
746
|
|
|
@@ -701,11 +769,11 @@ interface ProgressOptions {
|
|
|
701
769
|
### Adapter Factories
|
|
702
770
|
|
|
703
771
|
```typescript
|
|
704
|
-
// MCP over stdin/stdout
|
|
772
|
+
// MCP over stdin/stdout - from @silkweave/mcp
|
|
705
773
|
import { stdio } from '@silkweave/mcp'
|
|
706
774
|
function stdio(): AdapterFactory
|
|
707
775
|
|
|
708
|
-
// MCP Streamable HTTP
|
|
776
|
+
// MCP Streamable HTTP - from @silkweave/mcp
|
|
709
777
|
import { http } from '@silkweave/mcp'
|
|
710
778
|
function http(options: HttpAdapterOptions): AdapterFactory
|
|
711
779
|
interface HttpAdapterOptions {
|
|
@@ -714,7 +782,7 @@ interface HttpAdapterOptions {
|
|
|
714
782
|
// ...plus CreateMcpExpressAppOptions (e.g., allowedHosts)
|
|
715
783
|
}
|
|
716
784
|
|
|
717
|
-
// Fastify REST API with Swagger
|
|
785
|
+
// Fastify REST API with Swagger - from @silkweave/fastify
|
|
718
786
|
import { fastify } from '@silkweave/fastify'
|
|
719
787
|
function fastify(options: FastifyAdapterOptions): AdapterFactory
|
|
720
788
|
interface FastifyAdapterOptions {
|
|
@@ -723,11 +791,11 @@ interface FastifyAdapterOptions {
|
|
|
723
791
|
// ...plus all FastifyHttpOptions (logger, connectionTimeout, etc.)
|
|
724
792
|
}
|
|
725
793
|
|
|
726
|
-
// CLI via commander + clack
|
|
794
|
+
// CLI via commander + clack - from @silkweave/cli
|
|
727
795
|
import { cli } from '@silkweave/cli'
|
|
728
796
|
function cli(): AdapterFactory
|
|
729
797
|
|
|
730
|
-
// Vercel serverless
|
|
798
|
+
// Vercel serverless - from @silkweave/vercel
|
|
731
799
|
import { vercel } from '@silkweave/vercel'
|
|
732
800
|
function vercel(options?: VercelAdapterOptions): VercelAdapter
|
|
733
801
|
interface VercelAdapterOptions {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "silkweave",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.4.0",
|
|
4
4
|
"description": "Silkweave Umbrella Package",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -39,13 +39,13 @@
|
|
|
39
39
|
}
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"@silkweave/
|
|
43
|
-
"@silkweave/
|
|
44
|
-
"@silkweave/
|
|
45
|
-
"@silkweave/
|
|
46
|
-
"@silkweave/
|
|
47
|
-
"@silkweave/
|
|
48
|
-
"@silkweave/
|
|
42
|
+
"@silkweave/cli": "1.4.0",
|
|
43
|
+
"@silkweave/core": "1.4.0",
|
|
44
|
+
"@silkweave/logger": "1.4.0",
|
|
45
|
+
"@silkweave/auth": "1.4.0",
|
|
46
|
+
"@silkweave/mcp": "1.4.0",
|
|
47
|
+
"@silkweave/fastify": "1.4.0",
|
|
48
|
+
"@silkweave/vercel": "1.4.0"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
51
|
"@eslint/js": "^10.0.1",
|