toolcraft 0.0.4 → 0.0.6
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/dist/cli.js +5 -3
- package/dist/index.d.ts +2 -0
- package/dist/index.js +1 -0
- package/dist/mcp.d.ts +1 -1
- package/dist/mcp.js +10 -1
- package/dist/package-metadata.d.ts +10 -0
- package/dist/package-metadata.js +62 -0
- package/node_modules/@poe-code/agent-defs/dist/agents/claude-code.d.ts +2 -0
- package/node_modules/@poe-code/agent-defs/dist/agents/claude-code.js +15 -0
- package/node_modules/@poe-code/agent-defs/dist/agents/claude-desktop.d.ts +2 -0
- package/node_modules/@poe-code/agent-defs/dist/agents/claude-desktop.js +13 -0
- package/node_modules/@poe-code/agent-defs/dist/agents/codex.d.ts +2 -0
- package/node_modules/@poe-code/agent-defs/dist/agents/codex.js +14 -0
- package/node_modules/@poe-code/agent-defs/dist/agents/goose.d.ts +2 -0
- package/node_modules/@poe-code/agent-defs/dist/agents/goose.js +14 -0
- package/node_modules/@poe-code/agent-defs/dist/agents/index.d.ts +7 -0
- package/node_modules/@poe-code/agent-defs/dist/agents/index.js +7 -0
- package/node_modules/@poe-code/agent-defs/dist/agents/kimi.d.ts +2 -0
- package/node_modules/@poe-code/agent-defs/dist/agents/kimi.js +15 -0
- package/node_modules/@poe-code/agent-defs/dist/agents/opencode.d.ts +2 -0
- package/node_modules/@poe-code/agent-defs/dist/agents/opencode.js +14 -0
- package/node_modules/@poe-code/agent-defs/dist/agents/poe-agent.d.ts +2 -0
- package/node_modules/@poe-code/agent-defs/dist/agents/poe-agent.js +13 -0
- package/node_modules/@poe-code/agent-defs/dist/index.d.ts +5 -0
- package/node_modules/@poe-code/agent-defs/dist/index.js +3 -0
- package/node_modules/@poe-code/agent-defs/dist/registry.d.ts +3 -0
- package/node_modules/@poe-code/agent-defs/dist/registry.js +26 -0
- package/node_modules/@poe-code/agent-defs/dist/specifier.d.ts +7 -0
- package/node_modules/@poe-code/agent-defs/dist/specifier.js +27 -0
- package/node_modules/@poe-code/agent-defs/dist/types.d.ts +16 -0
- package/node_modules/@poe-code/agent-defs/dist/types.js +1 -0
- package/node_modules/@poe-code/agent-defs/package.json +20 -0
- package/node_modules/@poe-code/config-mutations/dist/execution/apply-mutation.d.ts +5 -0
- package/node_modules/@poe-code/config-mutations/dist/execution/apply-mutation.js +552 -0
- package/node_modules/@poe-code/config-mutations/dist/execution/path-utils.d.ts +17 -0
- package/node_modules/@poe-code/config-mutations/dist/execution/path-utils.js +58 -0
- package/node_modules/@poe-code/config-mutations/dist/execution/run-mutations.d.ts +7 -0
- package/node_modules/@poe-code/config-mutations/dist/execution/run-mutations.js +46 -0
- package/node_modules/@poe-code/config-mutations/dist/formats/index.d.ts +13 -0
- package/node_modules/@poe-code/config-mutations/dist/formats/index.js +49 -0
- package/node_modules/@poe-code/config-mutations/dist/formats/json.d.ts +31 -0
- package/node_modules/@poe-code/config-mutations/dist/formats/json.js +140 -0
- package/node_modules/@poe-code/config-mutations/dist/formats/toml.d.ts +2 -0
- package/node_modules/@poe-code/config-mutations/dist/formats/toml.js +72 -0
- package/node_modules/@poe-code/config-mutations/dist/formats/yaml.d.ts +2 -0
- package/node_modules/@poe-code/config-mutations/dist/formats/yaml.js +73 -0
- package/node_modules/@poe-code/config-mutations/dist/fs-utils.d.ts +18 -0
- package/node_modules/@poe-code/config-mutations/dist/fs-utils.js +45 -0
- package/node_modules/@poe-code/config-mutations/dist/index.d.ts +8 -0
- package/node_modules/@poe-code/config-mutations/dist/index.js +8 -0
- package/node_modules/@poe-code/config-mutations/dist/mutations/config-mutation.d.ts +47 -0
- package/node_modules/@poe-code/config-mutations/dist/mutations/config-mutation.js +34 -0
- package/node_modules/@poe-code/config-mutations/dist/mutations/file-mutation.d.ts +52 -0
- package/node_modules/@poe-code/config-mutations/dist/mutations/file-mutation.js +46 -0
- package/node_modules/@poe-code/config-mutations/dist/mutations/template-mutation.d.ts +40 -0
- package/node_modules/@poe-code/config-mutations/dist/mutations/template-mutation.js +32 -0
- package/node_modules/@poe-code/config-mutations/dist/template/render.d.ts +7 -0
- package/node_modules/@poe-code/config-mutations/dist/template/render.js +28 -0
- package/node_modules/@poe-code/config-mutations/dist/testing/format-utils.d.ts +7 -0
- package/node_modules/@poe-code/config-mutations/dist/testing/format-utils.js +21 -0
- package/node_modules/@poe-code/config-mutations/dist/testing/index.d.ts +3 -0
- package/node_modules/@poe-code/config-mutations/dist/testing/index.js +2 -0
- package/node_modules/@poe-code/config-mutations/dist/testing/mock-fs.d.ts +25 -0
- package/node_modules/@poe-code/config-mutations/dist/testing/mock-fs.js +170 -0
- package/node_modules/@poe-code/config-mutations/dist/types.d.ts +156 -0
- package/node_modules/@poe-code/config-mutations/dist/types.js +6 -0
- package/node_modules/@poe-code/config-mutations/package.json +33 -0
- package/node_modules/@poe-code/file-lock/README.md +52 -0
- package/node_modules/@poe-code/file-lock/dist/index.d.ts +1 -0
- package/node_modules/@poe-code/file-lock/dist/index.js +1 -0
- package/node_modules/@poe-code/file-lock/dist/lock.d.ts +27 -0
- package/node_modules/@poe-code/file-lock/dist/lock.js +203 -0
- package/node_modules/@poe-code/file-lock/package.json +23 -0
- package/node_modules/auth-store/README.md +47 -0
- package/node_modules/auth-store/dist/create-secret-store.d.ts +2 -0
- package/node_modules/auth-store/dist/create-secret-store.js +35 -0
- package/node_modules/auth-store/dist/encrypted-file-store.d.ts +39 -0
- package/node_modules/auth-store/dist/encrypted-file-store.js +156 -0
- package/node_modules/auth-store/dist/index.d.ts +7 -0
- package/node_modules/auth-store/dist/index.js +4 -0
- package/node_modules/auth-store/dist/keychain-store.d.ts +22 -0
- package/node_modules/auth-store/dist/keychain-store.js +111 -0
- package/node_modules/auth-store/dist/provider-store.d.ts +10 -0
- package/node_modules/auth-store/dist/provider-store.js +28 -0
- package/node_modules/auth-store/dist/types.d.ts +20 -0
- package/node_modules/auth-store/dist/types.js +1 -0
- package/node_modules/auth-store/package.json +25 -0
- package/node_modules/mcp-oauth/README.md +31 -0
- package/node_modules/mcp-oauth/dist/client/auth-store-session-store.d.ts +14 -0
- package/node_modules/mcp-oauth/dist/client/auth-store-session-store.js +97 -0
- package/node_modules/mcp-oauth/dist/client/authorization-state.d.ts +8 -0
- package/node_modules/mcp-oauth/dist/client/authorization-state.js +34 -0
- package/node_modules/mcp-oauth/dist/client/default-oauth-client-provider.d.ts +3 -0
- package/node_modules/mcp-oauth/dist/client/default-oauth-client-provider.js +491 -0
- package/node_modules/mcp-oauth/dist/client/loopback-authorization.d.ts +20 -0
- package/node_modules/mcp-oauth/dist/client/loopback-authorization.js +169 -0
- package/node_modules/mcp-oauth/dist/client/pkce.d.ts +2 -0
- package/node_modules/mcp-oauth/dist/client/pkce.js +7 -0
- package/node_modules/mcp-oauth/dist/client/token-endpoint.d.ts +40 -0
- package/node_modules/mcp-oauth/dist/client/token-endpoint.js +143 -0
- package/node_modules/mcp-oauth/dist/client/types.d.ts +113 -0
- package/node_modules/mcp-oauth/dist/client/types.js +1 -0
- package/node_modules/mcp-oauth/dist/index.d.ts +10 -0
- package/node_modules/mcp-oauth/dist/index.js +7 -0
- package/node_modules/mcp-oauth/dist/resource-indicator.d.ts +1 -0
- package/node_modules/mcp-oauth/dist/resource-indicator.js +11 -0
- package/node_modules/mcp-oauth/dist/server/jwks-token-verifier.d.ts +27 -0
- package/node_modules/mcp-oauth/dist/server/jwks-token-verifier.js +259 -0
- package/node_modules/mcp-oauth/dist/types.compile-check.d.ts +1 -0
- package/node_modules/mcp-oauth/dist/types.compile-check.js +22 -0
- package/node_modules/mcp-oauth/package.json +31 -0
- package/node_modules/tiny-mcp-client/.turbo/turbo-build.log +4 -0
- package/node_modules/tiny-mcp-client/dist/index.d.ts +2 -0
- package/node_modules/tiny-mcp-client/dist/index.js +1 -0
- package/node_modules/tiny-mcp-client/dist/internal.d.ts +547 -0
- package/node_modules/tiny-mcp-client/dist/internal.js +2404 -0
- package/node_modules/tiny-mcp-client/dist/jsonrpc-types.compile-check.d.ts +1 -0
- package/node_modules/tiny-mcp-client/dist/jsonrpc-types.compile-check.js +37 -0
- package/node_modules/tiny-mcp-client/dist/mcp-lifecycle-types.compile-check.d.ts +1 -0
- package/node_modules/tiny-mcp-client/dist/mcp-lifecycle-types.compile-check.js +50 -0
- package/node_modules/tiny-mcp-client/dist/mcp-prompt-types.compile-check.d.ts +1 -0
- package/node_modules/tiny-mcp-client/dist/mcp-prompt-types.compile-check.js +50 -0
- package/node_modules/tiny-mcp-client/dist/mcp-resource-types.compile-check.d.ts +1 -0
- package/node_modules/tiny-mcp-client/dist/mcp-resource-types.compile-check.js +51 -0
- package/node_modules/tiny-mcp-client/dist/mcp-tool-types.compile-check.d.ts +1 -0
- package/node_modules/tiny-mcp-client/dist/mcp-tool-types.compile-check.js +89 -0
- package/node_modules/tiny-mcp-client/dist/mcp-transport-types.compile-check.d.ts +1 -0
- package/node_modules/tiny-mcp-client/dist/mcp-transport-types.compile-check.js +56 -0
- package/node_modules/tiny-mcp-client/dist/mcp-utility-types.compile-check.d.ts +1 -0
- package/node_modules/tiny-mcp-client/dist/mcp-utility-types.compile-check.js +145 -0
- package/node_modules/tiny-mcp-client/dist/oauth-discovery.d.ts +24 -0
- package/node_modules/tiny-mcp-client/dist/oauth-discovery.js +385 -0
- package/node_modules/tiny-mcp-client/package.json +22 -0
- package/node_modules/tiny-mcp-client/src/http-oauth.integration.test.ts +823 -0
- package/node_modules/tiny-mcp-client/src/http-oauth.test.ts +882 -0
- package/node_modules/tiny-mcp-client/src/index.ts +94 -0
- package/node_modules/tiny-mcp-client/src/internal.ts +3566 -0
- package/node_modules/tiny-mcp-client/src/jsonrpc-types.compile-check.ts +66 -0
- package/node_modules/tiny-mcp-client/src/mcp-client-http-transport.integration.test.ts +222 -0
- package/node_modules/tiny-mcp-client/src/mcp-client-sdk.test.ts +1294 -0
- package/node_modules/tiny-mcp-client/src/mcp-client-tiny-stdio-test-server-tools.test.ts +143 -0
- package/node_modules/tiny-mcp-client/src/mcp-lifecycle-types.compile-check.ts +65 -0
- package/node_modules/tiny-mcp-client/src/mcp-prompt-types.compile-check.ts +66 -0
- package/node_modules/tiny-mcp-client/src/mcp-resource-types.compile-check.ts +70 -0
- package/node_modules/tiny-mcp-client/src/mcp-tool-types.compile-check.ts +117 -0
- package/node_modules/tiny-mcp-client/src/mcp-transport-types.compile-check.ts +75 -0
- package/node_modules/tiny-mcp-client/src/mcp-utility-types.compile-check.ts +181 -0
- package/node_modules/tiny-mcp-client/src/mock-servers.test.ts +980 -0
- package/node_modules/tiny-mcp-client/src/oauth-discovery.ts +583 -0
- package/node_modules/tiny-mcp-client/src/transports.test.ts +8139 -0
- package/node_modules/tiny-mcp-client/src/utilities.test.ts +372 -0
- package/node_modules/tiny-mcp-client/tsconfig.json +11 -0
- package/package.json +24 -11
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
const requestIdFromNumber = 1;
|
|
2
|
+
const requestIdFromString = "request-1";
|
|
3
|
+
// @ts-expect-error MCP does not allow null request ids.
|
|
4
|
+
const requestIdFromNull = null;
|
|
5
|
+
const request = {
|
|
6
|
+
jsonrpc: "2.0",
|
|
7
|
+
id: requestIdFromNumber,
|
|
8
|
+
method: "tools/list",
|
|
9
|
+
params: { cursor: "next" },
|
|
10
|
+
};
|
|
11
|
+
const notification = {
|
|
12
|
+
jsonrpc: "2.0",
|
|
13
|
+
method: "notifications/initialized",
|
|
14
|
+
};
|
|
15
|
+
// @ts-expect-error Notifications must not define an id.
|
|
16
|
+
const notificationWithId = { jsonrpc: "2.0", id: requestIdFromString, method: "notifications/initialized" };
|
|
17
|
+
const successResponse = {
|
|
18
|
+
jsonrpc: "2.0",
|
|
19
|
+
id: requestIdFromNumber,
|
|
20
|
+
result: { tools: [] },
|
|
21
|
+
};
|
|
22
|
+
const errorObject = {
|
|
23
|
+
code: -32601,
|
|
24
|
+
message: "Method not found",
|
|
25
|
+
data: { method: request.method },
|
|
26
|
+
};
|
|
27
|
+
const errorResponse = {
|
|
28
|
+
jsonrpc: "2.0",
|
|
29
|
+
id: requestIdFromString,
|
|
30
|
+
error: errorObject,
|
|
31
|
+
};
|
|
32
|
+
const responses = [successResponse, errorResponse];
|
|
33
|
+
void requestIdFromNull;
|
|
34
|
+
void notification;
|
|
35
|
+
void notificationWithId;
|
|
36
|
+
void responses;
|
|
37
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
const implementation = {
|
|
2
|
+
name: "tiny-mcp-client",
|
|
3
|
+
version: "0.1.0",
|
|
4
|
+
};
|
|
5
|
+
const clientCapabilities = {
|
|
6
|
+
roots: {},
|
|
7
|
+
sampling: {},
|
|
8
|
+
experimental: {
|
|
9
|
+
supportsFastPath: true,
|
|
10
|
+
},
|
|
11
|
+
};
|
|
12
|
+
const serverCapabilities = {
|
|
13
|
+
prompts: {},
|
|
14
|
+
resources: {},
|
|
15
|
+
tools: {},
|
|
16
|
+
logging: {},
|
|
17
|
+
completions: {},
|
|
18
|
+
experimental: {
|
|
19
|
+
rollout: "beta",
|
|
20
|
+
},
|
|
21
|
+
};
|
|
22
|
+
const initializeParams = {
|
|
23
|
+
protocolVersion: "2025-03-26",
|
|
24
|
+
capabilities: clientCapabilities,
|
|
25
|
+
clientInfo: implementation,
|
|
26
|
+
};
|
|
27
|
+
const initializeResult = {
|
|
28
|
+
protocolVersion: "2025-03-26",
|
|
29
|
+
capabilities: serverCapabilities,
|
|
30
|
+
serverInfo: implementation,
|
|
31
|
+
instructions: "Do not execute destructive tools without confirmation.",
|
|
32
|
+
};
|
|
33
|
+
// @ts-expect-error Implementation.version is required.
|
|
34
|
+
const implementationMissingVersion = { name: "tiny-mcp-client" };
|
|
35
|
+
// @ts-expect-error InitializeParams.protocolVersion is required.
|
|
36
|
+
const initializeParamsMissingProtocolVersion = {
|
|
37
|
+
capabilities: clientCapabilities,
|
|
38
|
+
clientInfo: implementation,
|
|
39
|
+
};
|
|
40
|
+
// @ts-expect-error InitializeResult.capabilities is required.
|
|
41
|
+
const initializeResultMissingCapabilities = {
|
|
42
|
+
protocolVersion: "2025-03-26",
|
|
43
|
+
serverInfo: implementation,
|
|
44
|
+
};
|
|
45
|
+
void implementationMissingVersion;
|
|
46
|
+
void initializeParamsMissingProtocolVersion;
|
|
47
|
+
void initializeResultMissingCapabilities;
|
|
48
|
+
void initializeParams;
|
|
49
|
+
void initializeResult;
|
|
50
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
const promptArgument = {
|
|
2
|
+
name: "topic",
|
|
3
|
+
description: "Topic to generate a prompt for",
|
|
4
|
+
required: true,
|
|
5
|
+
};
|
|
6
|
+
const prompt = {
|
|
7
|
+
name: "summarize",
|
|
8
|
+
description: "Summarize provided text",
|
|
9
|
+
arguments: [promptArgument],
|
|
10
|
+
};
|
|
11
|
+
const promptMessage = {
|
|
12
|
+
role: "user",
|
|
13
|
+
content: {
|
|
14
|
+
type: "text",
|
|
15
|
+
text: "Summarize this text.",
|
|
16
|
+
},
|
|
17
|
+
};
|
|
18
|
+
const promptResult = {
|
|
19
|
+
description: "Prompt for summarizing text",
|
|
20
|
+
messages: [promptMessage],
|
|
21
|
+
};
|
|
22
|
+
const contentItems = [promptMessage.content];
|
|
23
|
+
// @ts-expect-error Prompt.name is required.
|
|
24
|
+
const promptMissingName = {
|
|
25
|
+
description: "missing name",
|
|
26
|
+
};
|
|
27
|
+
// @ts-expect-error PromptArgument.name is required.
|
|
28
|
+
const promptArgumentMissingName = {
|
|
29
|
+
description: "missing name",
|
|
30
|
+
};
|
|
31
|
+
const invalidPromptMessageRole = {
|
|
32
|
+
// @ts-expect-error PromptMessage.role must be "user" | "assistant".
|
|
33
|
+
role: "system",
|
|
34
|
+
content: {
|
|
35
|
+
type: "text",
|
|
36
|
+
text: "nope",
|
|
37
|
+
},
|
|
38
|
+
};
|
|
39
|
+
// @ts-expect-error GetPromptResult.messages is required.
|
|
40
|
+
const promptResultMissingMessages = {
|
|
41
|
+
description: "missing messages",
|
|
42
|
+
};
|
|
43
|
+
void contentItems;
|
|
44
|
+
void prompt;
|
|
45
|
+
void promptResult;
|
|
46
|
+
void promptMissingName;
|
|
47
|
+
void promptArgumentMissingName;
|
|
48
|
+
void invalidPromptMessageRole;
|
|
49
|
+
void promptResultMissingMessages;
|
|
50
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
const resource = {
|
|
2
|
+
uri: "file:///tmp/readme.md",
|
|
3
|
+
name: "README",
|
|
4
|
+
description: "Project readme",
|
|
5
|
+
mimeType: "text/markdown",
|
|
6
|
+
size: 1024,
|
|
7
|
+
};
|
|
8
|
+
const resourceTemplate = {
|
|
9
|
+
uriTemplate: "file:///tmp/{filename}",
|
|
10
|
+
name: "Project file",
|
|
11
|
+
description: "Template for project files",
|
|
12
|
+
mimeType: "text/plain",
|
|
13
|
+
};
|
|
14
|
+
const paginatedParams = {
|
|
15
|
+
cursor: "next-page",
|
|
16
|
+
};
|
|
17
|
+
const paginatedResult = {
|
|
18
|
+
nextCursor: "cursor-2",
|
|
19
|
+
};
|
|
20
|
+
const textResourceContents = {
|
|
21
|
+
uri: resource.uri,
|
|
22
|
+
mimeType: "text/plain",
|
|
23
|
+
text: "hello",
|
|
24
|
+
};
|
|
25
|
+
const blobResourceContents = {
|
|
26
|
+
uri: resource.uri,
|
|
27
|
+
mimeType: "application/octet-stream",
|
|
28
|
+
blob: "aGVsbG8=",
|
|
29
|
+
};
|
|
30
|
+
const resourceContentsItems = [textResourceContents, blobResourceContents];
|
|
31
|
+
// @ts-expect-error Resource.uri is required.
|
|
32
|
+
const resourceMissingUri = {
|
|
33
|
+
name: "README",
|
|
34
|
+
};
|
|
35
|
+
// @ts-expect-error ResourceTemplate.uriTemplate is required.
|
|
36
|
+
const resourceTemplateMissingUriTemplate = {
|
|
37
|
+
name: "Project file",
|
|
38
|
+
};
|
|
39
|
+
// @ts-expect-error ResourceContents must include text or blob.
|
|
40
|
+
const invalidResourceContents = {
|
|
41
|
+
uri: resource.uri,
|
|
42
|
+
mimeType: "text/plain",
|
|
43
|
+
};
|
|
44
|
+
void resourceMissingUri;
|
|
45
|
+
void resourceTemplateMissingUriTemplate;
|
|
46
|
+
void invalidResourceContents;
|
|
47
|
+
void resourceContentsItems;
|
|
48
|
+
void paginatedParams;
|
|
49
|
+
void paginatedResult;
|
|
50
|
+
void resourceTemplate;
|
|
51
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
const annotations = {
|
|
2
|
+
title: "Word of the day",
|
|
3
|
+
readOnlyHint: true,
|
|
4
|
+
destructiveHint: false,
|
|
5
|
+
idempotentHint: true,
|
|
6
|
+
openWorldHint: false,
|
|
7
|
+
};
|
|
8
|
+
const tool = {
|
|
9
|
+
name: "word_of_the_day",
|
|
10
|
+
description: "Returns a random word.",
|
|
11
|
+
inputSchema: {
|
|
12
|
+
type: "object",
|
|
13
|
+
properties: {
|
|
14
|
+
locale: { type: "string" },
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
annotations,
|
|
18
|
+
};
|
|
19
|
+
const callToolParams = {
|
|
20
|
+
name: tool.name,
|
|
21
|
+
arguments: {
|
|
22
|
+
locale: "en-US",
|
|
23
|
+
},
|
|
24
|
+
};
|
|
25
|
+
const resourceContents = {
|
|
26
|
+
uri: "file:///tmp/word.txt",
|
|
27
|
+
text: "quotidian",
|
|
28
|
+
};
|
|
29
|
+
const textContent = {
|
|
30
|
+
type: "text",
|
|
31
|
+
text: "quotidian",
|
|
32
|
+
};
|
|
33
|
+
const imageContent = {
|
|
34
|
+
type: "image",
|
|
35
|
+
data: "YmFzZTY0",
|
|
36
|
+
mimeType: "image/png",
|
|
37
|
+
};
|
|
38
|
+
const audioContent = {
|
|
39
|
+
type: "audio",
|
|
40
|
+
data: "YmFzZTY0",
|
|
41
|
+
mimeType: "audio/wav",
|
|
42
|
+
};
|
|
43
|
+
const embeddedResource = {
|
|
44
|
+
type: "resource",
|
|
45
|
+
resource: resourceContents,
|
|
46
|
+
};
|
|
47
|
+
const contentItems = [
|
|
48
|
+
textContent,
|
|
49
|
+
imageContent,
|
|
50
|
+
audioContent,
|
|
51
|
+
embeddedResource,
|
|
52
|
+
];
|
|
53
|
+
const callToolResult = {
|
|
54
|
+
content: contentItems,
|
|
55
|
+
};
|
|
56
|
+
const callToolErrorResult = {
|
|
57
|
+
content: [textContent],
|
|
58
|
+
isError: true,
|
|
59
|
+
};
|
|
60
|
+
// @ts-expect-error Tool.name is required.
|
|
61
|
+
const toolMissingName = {
|
|
62
|
+
inputSchema: {},
|
|
63
|
+
};
|
|
64
|
+
// @ts-expect-error Tool.inputSchema is required.
|
|
65
|
+
const toolMissingInputSchema = {
|
|
66
|
+
name: "word_of_the_day",
|
|
67
|
+
};
|
|
68
|
+
// @ts-expect-error CallToolParams.name is required.
|
|
69
|
+
const callToolParamsMissingName = {
|
|
70
|
+
arguments: {},
|
|
71
|
+
};
|
|
72
|
+
const invalidTextContent = {
|
|
73
|
+
// @ts-expect-error TextContent.type must be "text".
|
|
74
|
+
type: "image",
|
|
75
|
+
text: "oops",
|
|
76
|
+
};
|
|
77
|
+
// @ts-expect-error EmbeddedResource.resource is required.
|
|
78
|
+
const embeddedResourceMissingResource = {
|
|
79
|
+
type: "resource",
|
|
80
|
+
};
|
|
81
|
+
void toolMissingName;
|
|
82
|
+
void toolMissingInputSchema;
|
|
83
|
+
void callToolParamsMissingName;
|
|
84
|
+
void invalidTextContent;
|
|
85
|
+
void embeddedResourceMissingResource;
|
|
86
|
+
void callToolParams;
|
|
87
|
+
void callToolResult;
|
|
88
|
+
void callToolErrorResult;
|
|
89
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { HttpTransport, } from "./index.js";
|
|
2
|
+
const closedEvent = {
|
|
3
|
+
reason: new Error("transport closed"),
|
|
4
|
+
};
|
|
5
|
+
const transport = {
|
|
6
|
+
readable,
|
|
7
|
+
writable,
|
|
8
|
+
closed: Promise.resolve(closedEvent),
|
|
9
|
+
dispose(reason) {
|
|
10
|
+
void reason;
|
|
11
|
+
},
|
|
12
|
+
};
|
|
13
|
+
const closed = transport.closed;
|
|
14
|
+
const customFetch = async () => new Response(null, { status: 202 });
|
|
15
|
+
const oauthProvider = {
|
|
16
|
+
authorizeRequest: async () => { },
|
|
17
|
+
handleUnauthorized: async () => ({ action: "retry" }),
|
|
18
|
+
};
|
|
19
|
+
const oauthOptions = {
|
|
20
|
+
provider: oauthProvider,
|
|
21
|
+
};
|
|
22
|
+
const oauthDiscoveryResult = {
|
|
23
|
+
resource: "https://example.com/mcp",
|
|
24
|
+
resourceMetadataUrl: "https://example.com/.well-known/oauth-protected-resource/mcp",
|
|
25
|
+
resourceMetadata: {
|
|
26
|
+
resource: "https://example.com/mcp",
|
|
27
|
+
authorization_servers: ["https://auth.example.com"],
|
|
28
|
+
},
|
|
29
|
+
authorizationServer: "https://auth.example.com",
|
|
30
|
+
authorizationServerMetadataUrl: "https://auth.example.com/.well-known/oauth-authorization-server",
|
|
31
|
+
authorizationServerMetadata: {
|
|
32
|
+
issuer: "https://auth.example.com",
|
|
33
|
+
authorization_endpoint: "https://auth.example.com/authorize",
|
|
34
|
+
token_endpoint: "https://auth.example.com/token",
|
|
35
|
+
response_types_supported: ["code"],
|
|
36
|
+
code_challenge_methods_supported: ["S256"],
|
|
37
|
+
},
|
|
38
|
+
};
|
|
39
|
+
const oauthDiscoveryCache = {
|
|
40
|
+
get: () => oauthDiscoveryResult,
|
|
41
|
+
set: () => { },
|
|
42
|
+
};
|
|
43
|
+
const httpTransport = new HttpTransport({
|
|
44
|
+
url: "https://example.com/mcp",
|
|
45
|
+
headers: {
|
|
46
|
+
Authorization: "Bearer test",
|
|
47
|
+
},
|
|
48
|
+
fetch: customFetch,
|
|
49
|
+
oauth: oauthOptions,
|
|
50
|
+
oauthDiscoveryCache,
|
|
51
|
+
});
|
|
52
|
+
// @ts-expect-error reason must be an Error.
|
|
53
|
+
const invalidClosedEvent = { reason: "closed" };
|
|
54
|
+
void closed;
|
|
55
|
+
void httpTransport;
|
|
56
|
+
void invalidClosedEvent;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
const root = {
|
|
2
|
+
uri: "file:///workspace",
|
|
3
|
+
name: "workspace",
|
|
4
|
+
};
|
|
5
|
+
const logLevel = "info";
|
|
6
|
+
const logMessage = {
|
|
7
|
+
level: logLevel,
|
|
8
|
+
logger: "tiny-mcp-client",
|
|
9
|
+
data: {
|
|
10
|
+
message: "connected",
|
|
11
|
+
},
|
|
12
|
+
};
|
|
13
|
+
const progress = {
|
|
14
|
+
progressToken: "request-1",
|
|
15
|
+
progress: 40,
|
|
16
|
+
total: 100,
|
|
17
|
+
message: "Processing",
|
|
18
|
+
};
|
|
19
|
+
const samplingMessage = {
|
|
20
|
+
role: "user",
|
|
21
|
+
content: {
|
|
22
|
+
type: "text",
|
|
23
|
+
text: "Generate a summary.",
|
|
24
|
+
},
|
|
25
|
+
};
|
|
26
|
+
const modelPreferences = {
|
|
27
|
+
hints: [{ name: "claude" }],
|
|
28
|
+
costPriority: 0.5,
|
|
29
|
+
speedPriority: 0.6,
|
|
30
|
+
intelligencePriority: 0.9,
|
|
31
|
+
};
|
|
32
|
+
const createMessageParams = {
|
|
33
|
+
messages: [samplingMessage],
|
|
34
|
+
modelPreferences,
|
|
35
|
+
systemPrompt: "Be concise.",
|
|
36
|
+
includeContext: "none",
|
|
37
|
+
temperature: 0.3,
|
|
38
|
+
maxTokens: 512,
|
|
39
|
+
stopSequences: ["\n\n"],
|
|
40
|
+
metadata: {
|
|
41
|
+
traceId: "trace-1",
|
|
42
|
+
},
|
|
43
|
+
};
|
|
44
|
+
const createMessageResult = {
|
|
45
|
+
model: "claude-sonnet-4.5",
|
|
46
|
+
role: "assistant",
|
|
47
|
+
content: {
|
|
48
|
+
type: "text",
|
|
49
|
+
text: "Here is the summary.",
|
|
50
|
+
},
|
|
51
|
+
stopReason: "endTurn",
|
|
52
|
+
};
|
|
53
|
+
const promptReference = {
|
|
54
|
+
type: "ref/prompt",
|
|
55
|
+
name: "summarize",
|
|
56
|
+
};
|
|
57
|
+
const resourceReference = {
|
|
58
|
+
type: "ref/resource",
|
|
59
|
+
uri: "file:///workspace/{path}",
|
|
60
|
+
};
|
|
61
|
+
const completePromptParams = {
|
|
62
|
+
ref: promptReference,
|
|
63
|
+
argument: {
|
|
64
|
+
name: "topic",
|
|
65
|
+
value: "machine learning",
|
|
66
|
+
},
|
|
67
|
+
};
|
|
68
|
+
const completeResourceParams = {
|
|
69
|
+
ref: resourceReference,
|
|
70
|
+
argument: {
|
|
71
|
+
name: "path",
|
|
72
|
+
value: "docs/",
|
|
73
|
+
},
|
|
74
|
+
};
|
|
75
|
+
const completeResult = {
|
|
76
|
+
completion: {
|
|
77
|
+
values: ["docs/guide.md", "docs/api.md"],
|
|
78
|
+
hasMore: true,
|
|
79
|
+
total: 10,
|
|
80
|
+
},
|
|
81
|
+
};
|
|
82
|
+
// @ts-expect-error Root.uri is required.
|
|
83
|
+
const rootMissingUri = {
|
|
84
|
+
name: "workspace",
|
|
85
|
+
};
|
|
86
|
+
// @ts-expect-error LogLevel must be one of syslog severities.
|
|
87
|
+
const invalidLogLevel = "trace";
|
|
88
|
+
// @ts-expect-error LogMessage.data is required.
|
|
89
|
+
const logMessageMissingData = {
|
|
90
|
+
level: "info",
|
|
91
|
+
};
|
|
92
|
+
// @ts-expect-error ProgressParams.progressToken is required.
|
|
93
|
+
const progressMissingToken = {
|
|
94
|
+
progress: 1,
|
|
95
|
+
};
|
|
96
|
+
// @ts-expect-error CreateMessageParams.maxTokens is required.
|
|
97
|
+
const createMessageParamsMissingMaxTokens = {
|
|
98
|
+
messages: [samplingMessage],
|
|
99
|
+
};
|
|
100
|
+
const invalidSamplingRole = {
|
|
101
|
+
// @ts-expect-error SamplingMessage.role must be "user" | "assistant".
|
|
102
|
+
role: "system",
|
|
103
|
+
content: {
|
|
104
|
+
type: "text",
|
|
105
|
+
text: "invalid",
|
|
106
|
+
},
|
|
107
|
+
};
|
|
108
|
+
// @ts-expect-error CreateMessageResult.model is required.
|
|
109
|
+
const createMessageResultMissingModel = {
|
|
110
|
+
role: "assistant",
|
|
111
|
+
content: {
|
|
112
|
+
type: "text",
|
|
113
|
+
text: "missing model",
|
|
114
|
+
},
|
|
115
|
+
stopReason: "endTurn",
|
|
116
|
+
};
|
|
117
|
+
const invalidCompleteParams = {
|
|
118
|
+
ref:
|
|
119
|
+
// @ts-expect-error CompleteParams.ref.type must be "ref/prompt" | "ref/resource".
|
|
120
|
+
{ type: "prompt", name: "summarize" },
|
|
121
|
+
argument: {
|
|
122
|
+
name: "topic",
|
|
123
|
+
value: "a",
|
|
124
|
+
},
|
|
125
|
+
};
|
|
126
|
+
// @ts-expect-error CompleteResult.completion is required.
|
|
127
|
+
const completeResultMissingCompletion = {};
|
|
128
|
+
void rootMissingUri;
|
|
129
|
+
void invalidLogLevel;
|
|
130
|
+
void logMessageMissingData;
|
|
131
|
+
void progressMissingToken;
|
|
132
|
+
void createMessageParamsMissingMaxTokens;
|
|
133
|
+
void invalidSamplingRole;
|
|
134
|
+
void createMessageResultMissingModel;
|
|
135
|
+
void invalidCompleteParams;
|
|
136
|
+
void completeResultMissingCompletion;
|
|
137
|
+
void root;
|
|
138
|
+
void logMessage;
|
|
139
|
+
void progress;
|
|
140
|
+
void createMessageParams;
|
|
141
|
+
void createMessageResult;
|
|
142
|
+
void completePromptParams;
|
|
143
|
+
void completeResourceParams;
|
|
144
|
+
void completeResult;
|
|
145
|
+
export {};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { OAuthAuthorizationServerMetadata, OAuthDiscoveryResult, OAuthMetadataFetch, OAuthProtectedResourceMetadata, OAuthUnauthorizedChallenge } from "mcp-oauth";
|
|
2
|
+
export type { OAuthAuthorizationServerMetadata, OAuthDiscoveryResult, OAuthMetadataFetch, OAuthProtectedResourceMetadata, OAuthUnauthorizedChallenge, };
|
|
3
|
+
export interface OAuthDiscoveryCache {
|
|
4
|
+
get(resourceUrl: string): OAuthDiscoveryResult | null | undefined | Promise<OAuthDiscoveryResult | null | undefined>;
|
|
5
|
+
set(resourceUrl: string, value: OAuthDiscoveryResult): void | Promise<void>;
|
|
6
|
+
}
|
|
7
|
+
export interface OAuthMetadataDiscoveryOptions {
|
|
8
|
+
fetch?: OAuthMetadataFetch;
|
|
9
|
+
cache?: OAuthDiscoveryCache;
|
|
10
|
+
}
|
|
11
|
+
export interface OAuthMetadataLookupOptions {
|
|
12
|
+
resourceMetadataUrl?: string | URL;
|
|
13
|
+
}
|
|
14
|
+
export declare function resolveProtectedResourceMetadataUrl(resourceUrl: string | URL, resourceMetadataUrl?: string | URL): string;
|
|
15
|
+
export declare function resolveAuthorizationServerMetadataUrl(issuer: string | URL): string;
|
|
16
|
+
export declare class OAuthMetadataDiscovery {
|
|
17
|
+
private readonly fetchImpl;
|
|
18
|
+
private readonly cache;
|
|
19
|
+
private readonly memoryCache;
|
|
20
|
+
constructor({ fetch, cache }?: OAuthMetadataDiscoveryOptions);
|
|
21
|
+
discover(resourceUrl: string | URL, { resourceMetadataUrl }?: OAuthMetadataLookupOptions): Promise<OAuthDiscoveryResult>;
|
|
22
|
+
}
|
|
23
|
+
export declare function discoverOAuthMetadata(resourceUrl: string | URL, options?: OAuthMetadataDiscoveryOptions & OAuthMetadataLookupOptions): Promise<OAuthDiscoveryResult>;
|
|
24
|
+
export declare function parseBearerWwwAuthenticateHeader(headerValue: string | null): OAuthUnauthorizedChallenge | null;
|