@outfitter/mcp 0.4.3 → 0.5.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 +92 -0
- package/dist/actions.d.ts +7 -2
- package/dist/actions.js +35 -9
- package/dist/core-tools.d.ts +7 -2
- package/dist/index.d.ts +12 -6
- package/dist/index.js +1 -0
- package/dist/internal/content-types.d.ts +2 -0
- package/dist/internal/content-types.js +1 -0
- package/dist/internal/log-config.d.ts +24 -0
- package/dist/internal/log-config.js +13 -0
- package/dist/internal/prompt-types.d.ts +3 -0
- package/dist/internal/prompt-types.js +1 -0
- package/dist/internal/resource-types.d.ts +4 -0
- package/dist/internal/resource-types.js +1 -0
- package/dist/internal/server-types.d.ts +7 -0
- package/dist/internal/server-types.js +20 -0
- package/dist/internal/tool-types.d.ts +2 -0
- package/dist/{shared/@outfitter/mcp-9m5hs2z0.js → internal/tool-types.js} +4 -16
- package/dist/internal/uri-template.d.ts +8 -0
- package/dist/internal/uri-template.js +7 -0
- package/dist/progress.d.ts +2 -0
- package/dist/progress.js +7 -0
- package/dist/server.d.ts +7 -2
- package/dist/server.js +5 -2
- package/dist/shared/@outfitter/{mcp-knq080yt.d.ts → mcp-3hxaatj9.d.ts} +37 -6
- package/dist/shared/@outfitter/{mcp-s6afm4ff.d.ts → mcp-4s22693j.d.ts} +1 -1
- package/dist/shared/@outfitter/mcp-7btcghjj.d.ts +304 -0
- package/dist/shared/@outfitter/mcp-9ry52yg3.d.ts +187 -0
- package/dist/shared/@outfitter/mcp-dgwj3jna.d.ts +103 -0
- package/dist/shared/@outfitter/{mcp-d8vs6vry.d.ts → mcp-f67dnr72.d.ts} +1 -1
- package/dist/shared/@outfitter/mcp-knc1gq0g.d.ts +130 -0
- package/dist/shared/@outfitter/mcp-n9vzcp37.js +55 -0
- package/dist/shared/@outfitter/mcp-q5hr7227.d.ts +24 -0
- package/dist/shared/@outfitter/mcp-q70dtfj6.js +53 -0
- package/dist/shared/@outfitter/mcp-r27vbpc1.d.ts +45 -0
- package/dist/shared/@outfitter/mcp-s2vnhzav.js +2 -0
- package/dist/shared/@outfitter/{mcp-7kcw2814.d.ts → mcp-yf0w5cgh.d.ts} +1 -1
- package/dist/shared/@outfitter/{mcp-b502y16n.js → mcp-yf1n85e9.js} +76 -116
- package/dist/shared/@outfitter/mcp-zt2s3r38.js +33 -0
- package/dist/transport.d.ts +7 -2
- package/dist/types.d.ts +7 -2
- package/dist/types.js +1 -1
- package/package.json +26 -20
- package/dist/shared/@outfitter/mcp-gqjg15f5.d.ts +0 -669
package/README.md
CHANGED
|
@@ -237,6 +237,47 @@ server.registerResource(configResource);
|
|
|
237
237
|
const contentResult = await server.readResource("file:///etc/app/config.json");
|
|
238
238
|
```
|
|
239
239
|
|
|
240
|
+
### defineResourceTemplate(definition)
|
|
241
|
+
|
|
242
|
+
Helper for defining MCP resource templates with URI pattern matching and optional Zod validation.
|
|
243
|
+
|
|
244
|
+
```typescript
|
|
245
|
+
import { defineResourceTemplate } from "@outfitter/mcp";
|
|
246
|
+
import { z } from "zod";
|
|
247
|
+
|
|
248
|
+
// Basic template with string variables
|
|
249
|
+
const userTemplate = defineResourceTemplate({
|
|
250
|
+
uriTemplate: "db:///users/{userId}/profile",
|
|
251
|
+
name: "User Profile",
|
|
252
|
+
handler: async (uri, variables, ctx) => {
|
|
253
|
+
const profile = await getProfile(variables.userId);
|
|
254
|
+
return Result.ok([
|
|
255
|
+
{ uri, text: JSON.stringify(profile), mimeType: "application/json" },
|
|
256
|
+
]);
|
|
257
|
+
},
|
|
258
|
+
});
|
|
259
|
+
|
|
260
|
+
// Typed template with Zod validation and coercion
|
|
261
|
+
const postTemplate = defineResourceTemplate({
|
|
262
|
+
uriTemplate: "db:///users/{userId}/posts/{postId}",
|
|
263
|
+
name: "User Post",
|
|
264
|
+
paramSchema: z.object({
|
|
265
|
+
userId: z.string().min(1),
|
|
266
|
+
postId: z.coerce.number().int().positive(),
|
|
267
|
+
}),
|
|
268
|
+
handler: async (uri, params, ctx) => {
|
|
269
|
+
// params is { userId: string; postId: number } — validated and coerced
|
|
270
|
+
const post = await getPost(params.userId, params.postId);
|
|
271
|
+
return Result.ok([{ uri, text: JSON.stringify(post) }]);
|
|
272
|
+
},
|
|
273
|
+
});
|
|
274
|
+
|
|
275
|
+
server.registerResourceTemplate(userTemplate);
|
|
276
|
+
server.registerResourceTemplate(postTemplate);
|
|
277
|
+
```
|
|
278
|
+
|
|
279
|
+
Templates use RFC 6570 Level 1 URI templates (`{param}` placeholders). Typed templates validate extracted variables against a Zod schema before handler invocation.
|
|
280
|
+
|
|
240
281
|
### Server Methods
|
|
241
282
|
|
|
242
283
|
```typescript
|
|
@@ -278,6 +319,57 @@ interface McpHandlerContext extends HandlerContext {
|
|
|
278
319
|
}
|
|
279
320
|
```
|
|
280
321
|
|
|
322
|
+
## Streaming and Progress (`@outfitter/mcp/progress`)
|
|
323
|
+
|
|
324
|
+
When an MCP client provides a `progressToken` in the tool call params, the server automatically creates a progress callback and injects it into the handler context as `ctx.progress`. Each call emits a `notifications/progress` notification.
|
|
325
|
+
|
|
326
|
+
```typescript
|
|
327
|
+
const tool = defineTool({
|
|
328
|
+
name: "index-files",
|
|
329
|
+
description: "Index workspace files",
|
|
330
|
+
inputSchema: z.object({ path: z.string() }),
|
|
331
|
+
handler: async (input, ctx) => {
|
|
332
|
+
const files = await listFiles(input.path);
|
|
333
|
+
|
|
334
|
+
for (let i = 0; i < files.length; i++) {
|
|
335
|
+
await indexFile(files[i]);
|
|
336
|
+
ctx.progress?.({ type: "progress", current: i + 1, total: files.length });
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
ctx.progress?.({
|
|
340
|
+
type: "step",
|
|
341
|
+
name: "complete",
|
|
342
|
+
status: "complete",
|
|
343
|
+
duration_ms: 150,
|
|
344
|
+
});
|
|
345
|
+
|
|
346
|
+
return Result.ok({ indexed: files.length });
|
|
347
|
+
},
|
|
348
|
+
});
|
|
349
|
+
```
|
|
350
|
+
|
|
351
|
+
Use optional chaining (`ctx.progress?.()`) so the handler works whether or not the client requested progress tracking. Without a `progressToken`, `ctx.progress` is `undefined` and no notifications are sent.
|
|
352
|
+
|
|
353
|
+
**Event mapping to MCP notifications:**
|
|
354
|
+
|
|
355
|
+
| StreamEvent type | MCP `progress` | MCP `total` | MCP `message` |
|
|
356
|
+
| ---------------- | -------------- | ----------- | ------------------------- |
|
|
357
|
+
| `start` | `0` | -- | `[start] {command}` |
|
|
358
|
+
| `step` | `0` | -- | `[step] {name}: {status}` |
|
|
359
|
+
| `progress` | `current` | `total` | `message` (if provided) |
|
|
360
|
+
|
|
361
|
+
The progress callback uses the same `StreamEvent` types from `@outfitter/contracts/stream` as the CLI NDJSON adapter, keeping handlers transport-agnostic.
|
|
362
|
+
|
|
363
|
+
**Programmatic usage** (for custom transport layers):
|
|
364
|
+
|
|
365
|
+
```typescript
|
|
366
|
+
import { createMcpProgressCallback } from "@outfitter/mcp/progress";
|
|
367
|
+
|
|
368
|
+
const progress = createMcpProgressCallback("tok-123", (notification) =>
|
|
369
|
+
sdkServer.notification(notification)
|
|
370
|
+
);
|
|
371
|
+
```
|
|
372
|
+
|
|
281
373
|
## Core Tools
|
|
282
374
|
|
|
283
375
|
Pre-built tools for common MCP patterns. These are marked with `deferLoading: false` for immediate availability.
|
package/dist/actions.d.ts
CHANGED
|
@@ -1,4 +1,9 @@
|
|
|
1
|
-
import { BuildMcpToolsOptions, buildMcpTools } from "./shared/@outfitter/mcp-
|
|
2
|
-
import "./shared/@outfitter/mcp-
|
|
1
|
+
import { BuildMcpToolsOptions, buildMcpTools } from "./shared/@outfitter/mcp-f67dnr72.js";
|
|
2
|
+
import "./shared/@outfitter/mcp-qmdmgxa1.js";
|
|
3
|
+
import "./shared/@outfitter/mcp-7btcghjj.js";
|
|
4
|
+
import "./shared/@outfitter/mcp-knc1gq0g.js";
|
|
5
|
+
import "./shared/@outfitter/mcp-9ry52yg3.js";
|
|
6
|
+
import "./shared/@outfitter/mcp-dgwj3jna.js";
|
|
7
|
+
import "./shared/@outfitter/mcp-q5hr7227.js";
|
|
3
8
|
import "./shared/@outfitter/mcp-cqpyer9m.js";
|
|
4
9
|
export { buildMcpTools, BuildMcpToolsOptions };
|
package/dist/actions.js
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
import {
|
|
3
3
|
defineTool
|
|
4
|
-
} from "./shared/@outfitter/mcp-
|
|
4
|
+
} from "./shared/@outfitter/mcp-yf1n85e9.js";
|
|
5
|
+
import"./shared/@outfitter/mcp-n9vzcp37.js";
|
|
6
|
+
import"./shared/@outfitter/mcp-zt2s3r38.js";
|
|
7
|
+
import"./shared/@outfitter/mcp-q70dtfj6.js";
|
|
5
8
|
import"./shared/@outfitter/mcp-fjtxsa0x.js";
|
|
6
|
-
import"./shared/@outfitter/mcp-
|
|
9
|
+
import"./shared/@outfitter/mcp-s2vnhzav.js";
|
|
7
10
|
import"./shared/@outfitter/mcp-hw5wz4gb.js";
|
|
8
11
|
|
|
9
12
|
// packages/mcp/src/actions.ts
|
|
@@ -11,6 +14,25 @@ import { DEFAULT_REGISTRY_SURFACES } from "@outfitter/contracts";
|
|
|
11
14
|
function isActionRegistry(source) {
|
|
12
15
|
return "list" in source;
|
|
13
16
|
}
|
|
17
|
+
function buildAnnotations(mcp) {
|
|
18
|
+
if (!mcp)
|
|
19
|
+
return;
|
|
20
|
+
const annotations = {};
|
|
21
|
+
let hasAnnotation = false;
|
|
22
|
+
if (mcp.readOnly === true) {
|
|
23
|
+
annotations["readOnlyHint"] = true;
|
|
24
|
+
hasAnnotation = true;
|
|
25
|
+
}
|
|
26
|
+
if (mcp.idempotent === true) {
|
|
27
|
+
annotations["idempotentHint"] = true;
|
|
28
|
+
hasAnnotation = true;
|
|
29
|
+
}
|
|
30
|
+
if (mcp.destructive === true) {
|
|
31
|
+
annotations["destructiveHint"] = true;
|
|
32
|
+
hasAnnotation = true;
|
|
33
|
+
}
|
|
34
|
+
return hasAnnotation ? annotations : undefined;
|
|
35
|
+
}
|
|
14
36
|
function buildMcpTools(source, options = {}) {
|
|
15
37
|
const actions = isActionRegistry(source) ? source.list() : source;
|
|
16
38
|
const includeSurfaces = options.includeSurfaces ?? [
|
|
@@ -19,13 +41,17 @@ function buildMcpTools(source, options = {}) {
|
|
|
19
41
|
return actions.filter((action) => {
|
|
20
42
|
const surfaces = action.surfaces ?? DEFAULT_REGISTRY_SURFACES;
|
|
21
43
|
return surfaces.some((surface) => includeSurfaces.includes(surface));
|
|
22
|
-
}).map((action) =>
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
44
|
+
}).map((action) => {
|
|
45
|
+
const annotations = buildAnnotations(action.mcp);
|
|
46
|
+
return defineTool({
|
|
47
|
+
name: action.mcp?.tool ?? action.id,
|
|
48
|
+
description: action.mcp?.description ?? action.description ?? action.id,
|
|
49
|
+
inputSchema: action.input,
|
|
50
|
+
handler: async (input, ctx) => action.handler(input, ctx),
|
|
51
|
+
...action.mcp?.deferLoading !== undefined ? { deferLoading: action.mcp.deferLoading } : {},
|
|
52
|
+
...annotations ? { annotations } : {}
|
|
53
|
+
});
|
|
54
|
+
});
|
|
29
55
|
}
|
|
30
56
|
export {
|
|
31
57
|
buildMcpTools
|
package/dist/core-tools.d.ts
CHANGED
|
@@ -1,4 +1,9 @@
|
|
|
1
|
-
import { ConfigAction, ConfigStore, ConfigToolInput, ConfigToolOptions, ConfigToolResponse, CoreToolDefinition, CoreToolsOptions, DocsSection, DocsToolEntry, DocsToolInput, DocsToolOptions, DocsToolResponse, NormalizedQueryInput, QueryToolInput, QueryToolOptions, QueryToolResponse, createCoreTools, defineConfigTool, defineDocsTool, defineQueryTool } from "./shared/@outfitter/mcp-
|
|
2
|
-
import "./shared/@outfitter/mcp-
|
|
1
|
+
import { ConfigAction, ConfigStore, ConfigToolInput, ConfigToolOptions, ConfigToolResponse, CoreToolDefinition, CoreToolsOptions, DocsSection, DocsToolEntry, DocsToolInput, DocsToolOptions, DocsToolResponse, NormalizedQueryInput, QueryToolInput, QueryToolOptions, QueryToolResponse, createCoreTools, defineConfigTool, defineDocsTool, defineQueryTool } from "./shared/@outfitter/mcp-4s22693j.js";
|
|
2
|
+
import "./shared/@outfitter/mcp-qmdmgxa1.js";
|
|
3
|
+
import "./shared/@outfitter/mcp-7btcghjj.js";
|
|
4
|
+
import "./shared/@outfitter/mcp-knc1gq0g.js";
|
|
5
|
+
import "./shared/@outfitter/mcp-9ry52yg3.js";
|
|
6
|
+
import "./shared/@outfitter/mcp-dgwj3jna.js";
|
|
7
|
+
import "./shared/@outfitter/mcp-q5hr7227.js";
|
|
3
8
|
import "./shared/@outfitter/mcp-cqpyer9m.js";
|
|
4
9
|
export { defineQueryTool, defineDocsTool, defineConfigTool, createCoreTools, QueryToolResponse, QueryToolOptions, QueryToolInput, NormalizedQueryInput, DocsToolResponse, DocsToolOptions, DocsToolInput, DocsToolEntry, DocsSection, CoreToolsOptions, CoreToolDefinition, ConfigToolResponse, ConfigToolOptions, ConfigToolInput, ConfigStore, ConfigAction };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,14 @@
|
|
|
1
|
-
import { McpToolResponse, connectStdio, createSdkServer, wrapToolError, wrapToolResult } from "./shared/@outfitter/mcp-
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
1
|
+
import { McpToolResponse, connectStdio, createSdkServer, wrapToolError, wrapToolResult } from "./shared/@outfitter/mcp-yf0w5cgh.js";
|
|
2
|
+
import { McpNotificationSender, McpProgressNotification, createMcpProgressCallback } from "./shared/@outfitter/mcp-r27vbpc1.js";
|
|
3
|
+
import { createMcpServer, definePrompt, defineResource, defineResourceTemplate, defineTool } from "./shared/@outfitter/mcp-3hxaatj9.js";
|
|
4
|
+
import { BuildMcpToolsOptions, buildMcpTools } from "./shared/@outfitter/mcp-f67dnr72.js";
|
|
5
|
+
import { ConfigAction, ConfigStore, ConfigToolInput, ConfigToolOptions, ConfigToolResponse, CoreToolsOptions, DocsSection, DocsToolEntry, DocsToolInput, DocsToolOptions, DocsToolResponse, QueryToolInput, QueryToolOptions, QueryToolResponse, createCoreTools, defineConfigTool, defineDocsTool, defineQueryTool } from "./shared/@outfitter/mcp-4s22693j.js";
|
|
6
|
+
import "./shared/@outfitter/mcp-qmdmgxa1.js";
|
|
7
|
+
import { InvokeToolOptions, McpError, McpHandlerContext, McpServer, McpServerOptions, ProgressReporter, adaptHandler } from "./shared/@outfitter/mcp-7btcghjj.js";
|
|
8
|
+
import { SerializedTool, TOOL_ANNOTATIONS, ToolAnnotations, ToolDefinition } from "./shared/@outfitter/mcp-knc1gq0g.js";
|
|
9
|
+
import { BlobResourceContent, ResourceContent, ResourceDefinition, ResourceReadHandler, ResourceTemplateDefinition, ResourceTemplateReadHandler, TextResourceContent, TypedResourceTemplateDefinition, TypedResourceTemplateReadHandler } from "./shared/@outfitter/mcp-9ry52yg3.js";
|
|
10
|
+
import { CompletionHandler, CompletionRef, CompletionResult, PromptArgument, PromptDefinition, PromptHandler, PromptMessage, PromptMessageContent, PromptResult } from "./shared/@outfitter/mcp-dgwj3jna.js";
|
|
11
|
+
import { ContentAnnotations } from "./shared/@outfitter/mcp-q5hr7227.js";
|
|
6
12
|
import { McpLogLevel, mapLogLevelToMcp, shouldEmitLog } from "./shared/@outfitter/mcp-cqpyer9m.js";
|
|
7
13
|
import { JsonSchema, zodToJsonSchema } from "./shared/@outfitter/mcp-83zvbna8.js";
|
|
8
|
-
export { zodToJsonSchema, wrapToolResult, wrapToolError, shouldEmitLog, mapLogLevelToMcp, defineTool, defineResourceTemplate, defineResource, defineQueryTool, definePrompt, defineDocsTool, defineConfigTool, createSdkServer, createMcpServer, createCoreTools, connectStdio, buildMcpTools, adaptHandler, ToolDefinition, ToolAnnotations, TextResourceContent, TOOL_ANNOTATIONS, SerializedTool, ResourceTemplateReadHandler, ResourceTemplateDefinition, ResourceReadHandler, ResourceDefinition, ResourceContent, QueryToolResponse, QueryToolOptions, QueryToolInput, PromptResult, PromptMessageContent, PromptMessage, PromptHandler, PromptDefinition, PromptArgument, ProgressReporter, McpToolResponse, McpServerOptions, McpServer, McpLogLevel, McpHandlerContext, McpError, JsonSchema, InvokeToolOptions, DocsToolResponse, DocsToolOptions, DocsToolInput, DocsToolEntry, DocsSection, CoreToolsOptions, ContentAnnotations, ConfigToolResponse, ConfigToolOptions, ConfigToolInput, ConfigStore, ConfigAction, CompletionResult, CompletionRef, CompletionHandler, BuildMcpToolsOptions, BlobResourceContent };
|
|
14
|
+
export { zodToJsonSchema, wrapToolResult, wrapToolError, shouldEmitLog, mapLogLevelToMcp, defineTool, defineResourceTemplate, defineResource, defineQueryTool, definePrompt, defineDocsTool, defineConfigTool, createSdkServer, createMcpServer, createMcpProgressCallback, createCoreTools, connectStdio, buildMcpTools, adaptHandler, TypedResourceTemplateReadHandler, TypedResourceTemplateDefinition, ToolDefinition, ToolAnnotations, TextResourceContent, TOOL_ANNOTATIONS, SerializedTool, ResourceTemplateReadHandler, ResourceTemplateDefinition, ResourceReadHandler, ResourceDefinition, ResourceContent, QueryToolResponse, QueryToolOptions, QueryToolInput, PromptResult, PromptMessageContent, PromptMessage, PromptHandler, PromptDefinition, PromptArgument, ProgressReporter, McpToolResponse, McpServerOptions, McpServer, McpProgressNotification, McpNotificationSender, McpLogLevel, McpHandlerContext, McpError, JsonSchema, InvokeToolOptions, DocsToolResponse, DocsToolOptions, DocsToolInput, DocsToolEntry, DocsSection, CoreToolsOptions, ContentAnnotations, ConfigToolResponse, ConfigToolOptions, ConfigToolInput, ConfigStore, ConfigAction, CompletionResult, CompletionRef, CompletionHandler, BuildMcpToolsOptions, BlobResourceContent };
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export { buildMcpTools } from "./actions.js";
|
|
2
2
|
export { createCoreTools, defineConfigTool, defineDocsTool, defineQueryTool } from "./core-tools.js";
|
|
3
3
|
export { mapLogLevelToMcp, shouldEmitLog } from "./logging.js";
|
|
4
|
+
export { createMcpProgressCallback } from "./progress.js";
|
|
4
5
|
export { zodToJsonSchema } from "./schema.js";
|
|
5
6
|
export { createMcpServer, definePrompt, defineResource, defineResourceTemplate, defineTool } from "./server.js";
|
|
6
7
|
export { connectStdio, createSdkServer, wrapToolError, wrapToolResult } from "./transport.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
// @bun
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { McpServerOptions } from "../shared/@outfitter/mcp-7btcghjj.js";
|
|
2
|
+
import "../shared/@outfitter/mcp-knc1gq0g.js";
|
|
3
|
+
import "../shared/@outfitter/mcp-9ry52yg3.js";
|
|
4
|
+
import "../shared/@outfitter/mcp-dgwj3jna.js";
|
|
5
|
+
import "../shared/@outfitter/mcp-q5hr7227.js";
|
|
6
|
+
import { McpLogLevel } from "../shared/@outfitter/mcp-cqpyer9m.js";
|
|
7
|
+
import { Sink } from "@outfitter/logging";
|
|
8
|
+
/** Valid MCP log levels for env var and option validation. */
|
|
9
|
+
declare const VALID_MCP_LOG_LEVELS: ReadonlySet<string>;
|
|
10
|
+
/** Map from EnvironmentDefaults logLevel to McpLogLevel. */
|
|
11
|
+
declare const DEFAULTS_TO_MCP: Readonly<Record<string, McpLogLevel>>;
|
|
12
|
+
/** Create a stderr sink with plain-text formatting for fallback logging. */
|
|
13
|
+
declare function createDefaultMcpSink(): Sink;
|
|
14
|
+
/**
|
|
15
|
+
* Resolve the default client log level from the precedence chain.
|
|
16
|
+
*
|
|
17
|
+
* Precedence (highest wins):
|
|
18
|
+
* 1. `OUTFITTER_LOG_LEVEL` environment variable
|
|
19
|
+
* 2. `options.defaultLogLevel` (validated against MCP levels)
|
|
20
|
+
* 3. Environment profile (`OUTFITTER_ENV`)
|
|
21
|
+
* 4. `null` (no forwarding)
|
|
22
|
+
*/
|
|
23
|
+
declare function resolveDefaultLogLevel(options: McpServerOptions): McpLogLevel | null;
|
|
24
|
+
export { resolveDefaultLogLevel, createDefaultMcpSink, VALID_MCP_LOG_LEVELS, DEFAULTS_TO_MCP };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import {
|
|
3
|
+
DEFAULTS_TO_MCP,
|
|
4
|
+
VALID_MCP_LOG_LEVELS,
|
|
5
|
+
createDefaultMcpSink,
|
|
6
|
+
resolveDefaultLogLevel
|
|
7
|
+
} from "../shared/@outfitter/mcp-n9vzcp37.js";
|
|
8
|
+
export {
|
|
9
|
+
resolveDefaultLogLevel,
|
|
10
|
+
createDefaultMcpSink,
|
|
11
|
+
VALID_MCP_LOG_LEVELS,
|
|
12
|
+
DEFAULTS_TO_MCP
|
|
13
|
+
};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { CompletionHandler, CompletionRef, CompletionResult, PromptArgument, PromptDefinition, PromptHandler, PromptMessage, PromptMessageContent, PromptResult } from "../shared/@outfitter/mcp-dgwj3jna.js";
|
|
2
|
+
import "../shared/@outfitter/mcp-q5hr7227.js";
|
|
3
|
+
export { PromptResult, PromptMessageContent, PromptMessage, PromptHandler, PromptDefinition, PromptArgument, CompletionResult, CompletionRef, CompletionHandler };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
// @bun
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { BlobResourceContent, ResourceContent, ResourceDefinition, ResourceReadHandler, ResourceTemplateDefinition, ResourceTemplateReadHandler, TextResourceContent, TypedResourceTemplateDefinition, TypedResourceTemplateReadHandler } from "../shared/@outfitter/mcp-9ry52yg3.js";
|
|
2
|
+
import "../shared/@outfitter/mcp-dgwj3jna.js";
|
|
3
|
+
import { ContentAnnotations } from "../shared/@outfitter/mcp-q5hr7227.js";
|
|
4
|
+
export { TypedResourceTemplateReadHandler, TypedResourceTemplateDefinition, TextResourceContent, ResourceTemplateReadHandler, ResourceTemplateDefinition, ResourceReadHandler, ResourceDefinition, ResourceContent, ContentAnnotations, BlobResourceContent };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
// @bun
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { InvokeToolOptions, McpError, McpHandlerContext, McpServer, McpServerOptions, ProgressReporter, Result, TaggedError, adaptHandler } from "../shared/@outfitter/mcp-7btcghjj.js";
|
|
2
|
+
import "../shared/@outfitter/mcp-knc1gq0g.js";
|
|
3
|
+
import "../shared/@outfitter/mcp-9ry52yg3.js";
|
|
4
|
+
import "../shared/@outfitter/mcp-dgwj3jna.js";
|
|
5
|
+
import "../shared/@outfitter/mcp-q5hr7227.js";
|
|
6
|
+
import "../shared/@outfitter/mcp-cqpyer9m.js";
|
|
7
|
+
export { adaptHandler, TaggedError, Result, ProgressReporter, McpServerOptions, McpServer, McpHandlerContext, McpError, InvokeToolOptions };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
// packages/mcp/src/internal/server-types.ts
|
|
3
|
+
import {
|
|
4
|
+
TaggedError as TaggedErrorImpl
|
|
5
|
+
} from "@outfitter/contracts";
|
|
6
|
+
import { TaggedError } from "@outfitter/contracts";
|
|
7
|
+
var TaggedError2 = TaggedErrorImpl;
|
|
8
|
+
var McpErrorBase = TaggedError2("McpError")();
|
|
9
|
+
|
|
10
|
+
class McpError extends McpErrorBase {
|
|
11
|
+
category = "internal";
|
|
12
|
+
}
|
|
13
|
+
function adaptHandler(handler) {
|
|
14
|
+
return handler;
|
|
15
|
+
}
|
|
16
|
+
export {
|
|
17
|
+
adaptHandler,
|
|
18
|
+
TaggedError,
|
|
19
|
+
McpError
|
|
20
|
+
};
|
|
@@ -1,10 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
// packages/mcp/src/types.ts
|
|
3
|
-
import {
|
|
4
|
-
TaggedError as TaggedErrorImpl
|
|
5
|
-
} from "@outfitter/contracts";
|
|
6
|
-
import { TaggedError } from "@outfitter/contracts";
|
|
7
|
-
var TaggedError2 = TaggedErrorImpl;
|
|
2
|
+
// packages/mcp/src/internal/tool-types.ts
|
|
8
3
|
var TOOL_ANNOTATIONS = {
|
|
9
4
|
readOnly: {
|
|
10
5
|
readOnlyHint: true,
|
|
@@ -37,13 +32,6 @@ var TOOL_ANNOTATIONS = {
|
|
|
37
32
|
openWorldHint: true
|
|
38
33
|
}
|
|
39
34
|
};
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
category = "internal";
|
|
44
|
-
}
|
|
45
|
-
function adaptHandler(handler) {
|
|
46
|
-
return handler;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
export { TOOL_ANNOTATIONS, McpError, adaptHandler, TaggedError };
|
|
35
|
+
export {
|
|
36
|
+
TOOL_ANNOTATIONS
|
|
37
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Match a URI against a RFC 6570 Level 1 URI template.
|
|
3
|
+
*
|
|
4
|
+
* Extracts named variables from `{param}` segments.
|
|
5
|
+
* Returns null if the URI doesn't match the template.
|
|
6
|
+
*/
|
|
7
|
+
declare function matchUriTemplate(template: string, uri: string): Record<string, string> | null;
|
|
8
|
+
export { matchUriTemplate };
|
package/dist/progress.js
ADDED
package/dist/server.d.ts
CHANGED
|
@@ -1,4 +1,9 @@
|
|
|
1
|
-
import { createMcpServer, definePrompt, defineResource, defineResourceTemplate, defineTool } from "./shared/@outfitter/mcp-
|
|
2
|
-
import "./shared/@outfitter/mcp-
|
|
1
|
+
import { createMcpServer, definePrompt, defineResource, defineResourceTemplate, defineTool } from "./shared/@outfitter/mcp-3hxaatj9.js";
|
|
2
|
+
import "./shared/@outfitter/mcp-qmdmgxa1.js";
|
|
3
|
+
import "./shared/@outfitter/mcp-7btcghjj.js";
|
|
4
|
+
import "./shared/@outfitter/mcp-knc1gq0g.js";
|
|
5
|
+
import "./shared/@outfitter/mcp-9ry52yg3.js";
|
|
6
|
+
import "./shared/@outfitter/mcp-dgwj3jna.js";
|
|
7
|
+
import "./shared/@outfitter/mcp-q5hr7227.js";
|
|
3
8
|
import "./shared/@outfitter/mcp-cqpyer9m.js";
|
|
4
9
|
export { defineTool, defineResourceTemplate, defineResource, definePrompt, createMcpServer };
|
package/dist/server.js
CHANGED
|
@@ -5,9 +5,12 @@ import {
|
|
|
5
5
|
defineResource,
|
|
6
6
|
defineResourceTemplate,
|
|
7
7
|
defineTool
|
|
8
|
-
} from "./shared/@outfitter/mcp-
|
|
8
|
+
} from "./shared/@outfitter/mcp-yf1n85e9.js";
|
|
9
|
+
import"./shared/@outfitter/mcp-n9vzcp37.js";
|
|
10
|
+
import"./shared/@outfitter/mcp-zt2s3r38.js";
|
|
11
|
+
import"./shared/@outfitter/mcp-q70dtfj6.js";
|
|
9
12
|
import"./shared/@outfitter/mcp-fjtxsa0x.js";
|
|
10
|
-
import"./shared/@outfitter/mcp-
|
|
13
|
+
import"./shared/@outfitter/mcp-s2vnhzav.js";
|
|
11
14
|
import"./shared/@outfitter/mcp-hw5wz4gb.js";
|
|
12
15
|
export {
|
|
13
16
|
defineTool,
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
import { McpServer, McpServerOptions
|
|
1
|
+
import { McpServer, McpServerOptions } from "./mcp-7btcghjj.js";
|
|
2
|
+
import { ToolDefinition } from "./mcp-knc1gq0g.js";
|
|
3
|
+
import { ResourceDefinition, ResourceTemplateDefinition, TypedResourceTemplateDefinition } from "./mcp-9ry52yg3.js";
|
|
4
|
+
import { PromptDefinition } from "./mcp-dgwj3jna.js";
|
|
2
5
|
import { OutfitterError } from "@outfitter/contracts";
|
|
3
6
|
/**
|
|
4
7
|
* Create an MCP server instance.
|
|
@@ -82,14 +85,42 @@ declare function defineTool<
|
|
|
82
85
|
*/
|
|
83
86
|
declare function defineResource(definition: ResourceDefinition): ResourceDefinition;
|
|
84
87
|
/**
|
|
85
|
-
* Define a resource template.
|
|
88
|
+
* Define a resource template with optional Zod schema validation.
|
|
86
89
|
*
|
|
87
|
-
*
|
|
88
|
-
*
|
|
90
|
+
* When `paramSchema` is provided, URI template variables are validated
|
|
91
|
+
* and coerced before handler invocation — parallel to how `defineTool()`
|
|
92
|
+
* validates input via `inputSchema`. Invalid parameters produce an
|
|
93
|
+
* McpError with code -32602 (Invalid params) and the handler is never called.
|
|
89
94
|
*
|
|
90
|
-
* @param definition - Resource template definition
|
|
91
|
-
* @returns
|
|
95
|
+
* @param definition - Resource template definition with optional `paramSchema`
|
|
96
|
+
* @returns A `ResourceTemplateDefinition` compatible with `registerResourceTemplate()`
|
|
97
|
+
*
|
|
98
|
+
* @example
|
|
99
|
+
* ```typescript
|
|
100
|
+
* // With Zod schema validation (recommended for typed params)
|
|
101
|
+
* const userTemplate = defineResourceTemplate({
|
|
102
|
+
* uriTemplate: "db:///users/{userId}/posts/{postId}",
|
|
103
|
+
* name: "User Post",
|
|
104
|
+
* paramSchema: z.object({
|
|
105
|
+
* userId: z.string().min(1),
|
|
106
|
+
* postId: z.coerce.number().int().positive(),
|
|
107
|
+
* }),
|
|
108
|
+
* handler: async (uri, params, ctx) => {
|
|
109
|
+
* // params is typed as { userId: string; postId: number }
|
|
110
|
+
* return Result.ok([{ uri, text: JSON.stringify(params) }]);
|
|
111
|
+
* },
|
|
112
|
+
* });
|
|
113
|
+
*
|
|
114
|
+
* // Without schema (backward compatible)
|
|
115
|
+
* const simpleTemplate = defineResourceTemplate({
|
|
116
|
+
* uriTemplate: "db:///items/{itemId}",
|
|
117
|
+
* name: "Item",
|
|
118
|
+
* handler: async (uri, variables) =>
|
|
119
|
+
* Result.ok([{ uri, text: variables.itemId }]),
|
|
120
|
+
* });
|
|
121
|
+
* ```
|
|
92
122
|
*/
|
|
123
|
+
declare function defineResourceTemplate<TParams>(definition: TypedResourceTemplateDefinition<TParams>): ResourceTemplateDefinition;
|
|
93
124
|
declare function defineResourceTemplate(definition: ResourceTemplateDefinition): ResourceTemplateDefinition;
|
|
94
125
|
/**
|
|
95
126
|
* Define a prompt.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ToolDefinition } from "./mcp-
|
|
1
|
+
import { ToolDefinition } from "./mcp-knc1gq0g.js";
|
|
2
2
|
import { HandlerContext, OutfitterError } from "@outfitter/contracts";
|
|
3
3
|
import { Result } from "@outfitter/contracts";
|
|
4
4
|
type DocsSection = "overview" | "tools" | "examples" | "schemas";
|