@jaypie/mcp 0.2.10 → 0.2.12

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.
@@ -1,27 +1,27 @@
1
1
  ---
2
- description: MCP server tool registration from serviceHandler
2
+ description: MCP server tool registration from fabricService
3
3
  ---
4
4
 
5
- # Jaypie Vocabulary MCP Adapter
5
+ # Jaypie Fabric MCP Adapter
6
6
 
7
- The MCP adapter (`@jaypie/vocabulary/mcp`) registers Jaypie service handlers as MCP (Model Context Protocol) tools for use with MCP servers.
7
+ The MCP adapter (`@jaypie/fabric/mcp`) registers Jaypie service handlers as MCP (Model Context Protocol) tools for use with MCP servers.
8
8
 
9
- **See also:** [Jaypie_Vocabulary_Package.md](Jaypie_Vocabulary_Package.md) for core serviceHandler documentation.
9
+ **See also:** [Jaypie_Fabric_Package.md](Jaypie_Fabric_Package.md) for core fabricService documentation.
10
10
 
11
11
  ## Installation
12
12
 
13
13
  ```bash
14
- npm install @jaypie/vocabulary @modelcontextprotocol/sdk
14
+ npm install @jaypie/fabric @modelcontextprotocol/sdk
15
15
  ```
16
16
 
17
17
  ## Quick Start
18
18
 
19
19
  ```typescript
20
20
  import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
21
- import { serviceHandler } from "@jaypie/vocabulary";
22
- import { registerMcpTool } from "@jaypie/vocabulary/mcp";
21
+ import { fabricService } from "@jaypie/fabric";
22
+ import { fabricMcp } from "@jaypie/fabric/mcp";
23
23
 
24
- const handler = serviceHandler({
24
+ const handler = fabricService({
25
25
  alias: "greet",
26
26
  description: "Greet a user by name",
27
27
  input: {
@@ -35,18 +35,18 @@ const handler = serviceHandler({
35
35
  });
36
36
 
37
37
  const server = new McpServer({ name: "my-server", version: "1.0.0" });
38
- registerMcpTool({ handler, server });
38
+ fabricMcp({ service: handler, server });
39
39
  ```
40
40
 
41
- ## registerMcpTool
41
+ ## fabricMcp
42
42
 
43
- Registers a serviceHandler as an MCP tool.
43
+ Registers a fabricService as an MCP tool.
44
44
 
45
45
  ### Options
46
46
 
47
47
  | Option | Type | Description |
48
48
  |--------|------|-------------|
49
- | `handler` | `ServiceHandlerFunction` | Required. The service handler to adapt |
49
+ | `service` | `Service` | Required. The service handler to adapt |
50
50
  | `server` | `McpServer` | Required. The MCP server to register with |
51
51
  | `name` | `string` | Override tool name (defaults to handler.alias) |
52
52
  | `description` | `string` | Override tool description (defaults to handler.description) |
@@ -59,10 +59,10 @@ Registers a serviceHandler as an MCP tool.
59
59
 
60
60
  ```typescript
61
61
  import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
62
- import { serviceHandler } from "@jaypie/vocabulary";
63
- import { registerMcpTool } from "@jaypie/vocabulary/mcp";
62
+ import { fabricService } from "@jaypie/fabric";
63
+ import { fabricMcp } from "@jaypie/fabric/mcp";
64
64
 
65
- const calculateHandler = serviceHandler({
65
+ const calculateHandler = fabricService({
66
66
  alias: "calculate",
67
67
  description: "Perform a mathematical calculation",
68
68
  input: {
@@ -81,14 +81,14 @@ const calculateHandler = serviceHandler({
81
81
  });
82
82
 
83
83
  const server = new McpServer({ name: "calculator", version: "1.0.0" });
84
- registerMcpTool({ handler: calculateHandler, server });
84
+ fabricMcp({ service: calculateHandler, server });
85
85
  ```
86
86
 
87
87
  ### Overriding Name and Description
88
88
 
89
89
  ```typescript
90
- registerMcpTool({
91
- handler,
90
+ fabricMcp({
91
+ service: handler,
92
92
  server,
93
93
  name: "math_calculate",
94
94
  description: "A tool for performing basic math operations",
@@ -100,7 +100,7 @@ registerMcpTool({
100
100
  Services can use context callbacks to report progress, errors, and completion:
101
101
 
102
102
  ```typescript
103
- const handler = serviceHandler({
103
+ const handler = fabricService({
104
104
  alias: "evaluate",
105
105
  input: { jobId: { type: String } },
106
106
  service: async ({ jobId }, context) => {
@@ -116,8 +116,8 @@ const handler = serviceHandler({
116
116
  },
117
117
  });
118
118
 
119
- registerMcpTool({
120
- handler,
119
+ fabricMcp({
120
+ service: handler,
121
121
  server,
122
122
  onComplete: (result) => console.log("Tool completed:", result),
123
123
  onError: (error) => console.warn("Recoverable error:", error),
@@ -165,11 +165,11 @@ For string responses:
165
165
  ```typescript
166
166
  import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
167
167
  import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
168
- import { serviceHandler } from "@jaypie/vocabulary";
169
- import { registerMcpTool } from "@jaypie/vocabulary/mcp";
168
+ import { fabricService } from "@jaypie/fabric";
169
+ import { fabricMcp } from "@jaypie/fabric/mcp";
170
170
 
171
171
  // Define handlers
172
- const weatherHandler = serviceHandler({
172
+ const weatherHandler = fabricService({
173
173
  alias: "get_weather",
174
174
  description: "Get current weather for a location",
175
175
  input: {
@@ -187,7 +187,7 @@ const weatherHandler = serviceHandler({
187
187
  },
188
188
  });
189
189
 
190
- const searchHandler = serviceHandler({
190
+ const searchHandler = fabricService({
191
191
  alias: "search",
192
192
  description: "Search for information",
193
193
  input: {
@@ -205,8 +205,8 @@ const server = new McpServer({
205
205
  version: "1.0.0",
206
206
  });
207
207
 
208
- registerMcpTool({ handler: weatherHandler, server });
209
- registerMcpTool({ handler: searchHandler, server });
208
+ fabricMcp({ service: weatherHandler, server });
209
+ fabricMcp({ service: searchHandler, server });
210
210
 
211
211
  // Start server
212
212
  const transport = new StdioServerTransport();
@@ -233,15 +233,15 @@ input: {
233
233
 
234
234
  ```typescript
235
235
  import type {
236
+ FabricMcpConfig,
237
+ FabricMcpResult,
236
238
  McpToolContentItem,
237
239
  McpToolResponse,
238
240
  OnCompleteCallback,
239
241
  OnErrorCallback,
240
242
  OnFatalCallback,
241
243
  OnMessageCallback,
242
- RegisterMcpToolConfig,
243
- RegisterMcpToolResult,
244
- } from "@jaypie/vocabulary/mcp";
244
+ } from "@jaypie/fabric/mcp";
245
245
  ```
246
246
 
247
247
  ### Type Definitions
@@ -256,8 +256,8 @@ interface McpToolResponse {
256
256
  content: McpToolContentItem[];
257
257
  }
258
258
 
259
- interface RegisterMcpToolConfig {
260
- handler: ServiceHandlerFunction;
259
+ interface FabricMcpConfig {
260
+ service: Service;
261
261
  server: McpServer;
262
262
  name?: string;
263
263
  description?: string;
@@ -267,7 +267,7 @@ interface RegisterMcpToolConfig {
267
267
  onMessage?: OnMessageCallback;
268
268
  }
269
269
 
270
- interface RegisterMcpToolResult {
270
+ interface FabricMcpResult {
271
271
  name: string;
272
272
  }
273
273
  ```
@@ -275,22 +275,22 @@ interface RegisterMcpToolResult {
275
275
  ## Exports
276
276
 
277
277
  ```typescript
278
- // @jaypie/vocabulary/mcp
279
- export { registerMcpTool } from "./registerMcpTool.js";
278
+ // @jaypie/fabric/mcp
279
+ export { fabricMcp } from "./fabricMcp.js";
280
280
 
281
281
  export type {
282
+ FabricMcpConfig,
283
+ FabricMcpResult,
282
284
  McpToolContentItem,
283
285
  McpToolResponse,
284
286
  OnCompleteCallback,
285
287
  OnErrorCallback,
286
288
  OnFatalCallback,
287
289
  OnMessageCallback,
288
- RegisterMcpToolConfig,
289
- RegisterMcpToolResult,
290
290
  } from "./types.js";
291
291
  ```
292
292
 
293
293
  ## Related
294
294
 
295
- - [Jaypie_Vocabulary_Package.md](Jaypie_Vocabulary_Package.md) - Core serviceHandler and type coercion
296
- - [Jaypie_Vocabulary_LLM.md](Jaypie_Vocabulary_LLM.md) - LLM tool creation (similar pattern)
295
+ - [Jaypie_Fabric_Package.md](Jaypie_Fabric_Package.md) - Core fabricService and type conversion
296
+ - [Jaypie_Fabric_LLM.md](Jaypie_Fabric_LLM.md) - LLM tool creation (similar pattern)