@agentbadge/webmcp 0.3.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/LICENSE +21 -0
- package/dist/declarative.d.ts +20 -0
- package/dist/declarative.js +101 -0
- package/dist/discovery.d.ts +19 -0
- package/dist/discovery.js +10 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.js +4 -0
- package/dist/inject.d.ts +3 -0
- package/dist/inject.js +42 -0
- package/dist/tools/badge.d.ts +2 -0
- package/dist/tools/badge.js +25 -0
- package/dist/tools/index.d.ts +8 -0
- package/dist/tools/index.js +20 -0
- package/dist/tools/passport-issue.d.ts +2 -0
- package/dist/tools/passport-issue.js +26 -0
- package/dist/tools/passport-verify.d.ts +2 -0
- package/dist/tools/passport-verify.js +26 -0
- package/dist/tools/rules.d.ts +2 -0
- package/dist/tools/rules.js +26 -0
- package/dist/tools/scan.d.ts +2 -0
- package/dist/tools/scan.js +20 -0
- package/dist/tools/score.d.ts +2 -0
- package/dist/tools/score.js +20 -0
- package/dist/types.d.ts +23 -0
- package/dist/types.js +1 -0
- package/package.json +37 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 AgentBadge
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export interface DeclarativeInput {
|
|
2
|
+
name: string;
|
|
3
|
+
type: string;
|
|
4
|
+
id: string;
|
|
5
|
+
label: string;
|
|
6
|
+
required?: boolean;
|
|
7
|
+
toolparamdescription?: string;
|
|
8
|
+
placeholder?: string;
|
|
9
|
+
}
|
|
10
|
+
export interface DeclarativeFormConfig {
|
|
11
|
+
toolname: string;
|
|
12
|
+
tooldescription: string;
|
|
13
|
+
action: string;
|
|
14
|
+
method: string;
|
|
15
|
+
toolautosubmit?: boolean;
|
|
16
|
+
inputs: DeclarativeInput[];
|
|
17
|
+
}
|
|
18
|
+
export declare function generateDeclarativeForm(config: DeclarativeFormConfig): string;
|
|
19
|
+
export declare function generateDeclarativeScript(): string;
|
|
20
|
+
export declare function generateDeclarativeStyles(): string;
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
export function generateDeclarativeForm(config) {
|
|
2
|
+
const autosubmit = config.toolautosubmit ? " toolautosubmit" : "";
|
|
3
|
+
const inputsHtml = config.inputs
|
|
4
|
+
.map((input) => {
|
|
5
|
+
const required = input.required ? " required" : "";
|
|
6
|
+
const paramDesc = input.toolparamdescription
|
|
7
|
+
? ` toolparamdescription="${escapeAttr(input.toolparamdescription)}"`
|
|
8
|
+
: "";
|
|
9
|
+
const placeholder = input.placeholder
|
|
10
|
+
? ` placeholder="${escapeAttr(input.placeholder)}"`
|
|
11
|
+
: "";
|
|
12
|
+
return ` <label for="${escapeAttr(input.id)}">${escapeText(input.label)}</label>
|
|
13
|
+
<input type="${escapeAttr(input.type)}" id="${escapeAttr(input.id)}" name="${escapeAttr(input.name)}"${required}${paramDesc}${placeholder}>`;
|
|
14
|
+
})
|
|
15
|
+
.join("\n");
|
|
16
|
+
return `<form toolname="${escapeAttr(config.toolname)}" tooldescription="${escapeAttr(config.tooldescription)}" action="${escapeAttr(config.action)}" method="${escapeAttr(config.method)}"${autosubmit}>
|
|
17
|
+
${inputsHtml}
|
|
18
|
+
<button type="submit">Scan</button>
|
|
19
|
+
</form>`;
|
|
20
|
+
}
|
|
21
|
+
export function generateDeclarativeScript() {
|
|
22
|
+
return `<script>
|
|
23
|
+
(function() {
|
|
24
|
+
var form = document.querySelector('form[toolname="submitScanRequest"]');
|
|
25
|
+
if (!form) return;
|
|
26
|
+
|
|
27
|
+
form.addEventListener('submit', function(e) {
|
|
28
|
+
if (e.agentInvoked) {
|
|
29
|
+
e.preventDefault();
|
|
30
|
+
try {
|
|
31
|
+
var formData = new FormData(form);
|
|
32
|
+
var params = new URLSearchParams();
|
|
33
|
+
formData.forEach(function(value, key) {
|
|
34
|
+
params.append(key, value);
|
|
35
|
+
});
|
|
36
|
+
var url = form.getAttribute('action') + '?' + params.toString();
|
|
37
|
+
e.respondWith(
|
|
38
|
+
fetch(url, { signal: AbortSignal.timeout(30000) })
|
|
39
|
+
.then(function(res) { return res.json(); })
|
|
40
|
+
.catch(function(err) { return { error: err.message }; })
|
|
41
|
+
);
|
|
42
|
+
} catch (err) {
|
|
43
|
+
e.respondWith(Promise.resolve({ error: err.message }));
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
window.addEventListener('toolactivated', function(e) {
|
|
49
|
+
try {
|
|
50
|
+
form.classList.add('tool-form-active');
|
|
51
|
+
var button = form.querySelector('button[type="submit"]');
|
|
52
|
+
if (button) {
|
|
53
|
+
button.disabled = true;
|
|
54
|
+
button.textContent = 'Scanning...';
|
|
55
|
+
}
|
|
56
|
+
} catch (err) {
|
|
57
|
+
console.error('[WebMCP] toolactivated error:', err);
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
window.addEventListener('toolcancel', function(e) {
|
|
62
|
+
try {
|
|
63
|
+
form.classList.remove('tool-form-active');
|
|
64
|
+
var button = form.querySelector('button[type="submit"]');
|
|
65
|
+
if (button) {
|
|
66
|
+
button.disabled = false;
|
|
67
|
+
button.textContent = 'Scan';
|
|
68
|
+
}
|
|
69
|
+
} catch (err) {
|
|
70
|
+
console.error('[WebMCP] toolcancel error:', err);
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
})();
|
|
74
|
+
</script>`;
|
|
75
|
+
}
|
|
76
|
+
export function generateDeclarativeStyles() {
|
|
77
|
+
return `<style>
|
|
78
|
+
form:tool-form-active {
|
|
79
|
+
border-color: rgb(99 102 241 / 0.6);
|
|
80
|
+
box-shadow: 0 0 0 3px rgb(99 102 241 / 0.15);
|
|
81
|
+
}
|
|
82
|
+
form:tool-submit-active {
|
|
83
|
+
opacity: 0.7;
|
|
84
|
+
pointer-events: none;
|
|
85
|
+
}
|
|
86
|
+
@media (prefers-reduced-motion: reduce) {
|
|
87
|
+
form:tool-form-active {
|
|
88
|
+
transition: none;
|
|
89
|
+
}
|
|
90
|
+
form:tool-submit-active {
|
|
91
|
+
transition: none;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
</style>`;
|
|
95
|
+
}
|
|
96
|
+
function escapeAttr(value) {
|
|
97
|
+
return value.replace(/&/g, "&").replace(/"/g, """).replace(/</g, "<").replace(/>/g, ">");
|
|
98
|
+
}
|
|
99
|
+
function escapeText(value) {
|
|
100
|
+
return value.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">");
|
|
101
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { ToolDefinition } from "./types";
|
|
2
|
+
export interface DiscoveryTool {
|
|
3
|
+
name: string;
|
|
4
|
+
description: string;
|
|
5
|
+
inputSchema: {
|
|
6
|
+
type: "object";
|
|
7
|
+
properties: Record<string, unknown>;
|
|
8
|
+
required: string[];
|
|
9
|
+
};
|
|
10
|
+
annotations: {
|
|
11
|
+
readOnlyHint: boolean;
|
|
12
|
+
untrustedContentHint: boolean;
|
|
13
|
+
title?: string;
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
export interface DiscoveryJson {
|
|
17
|
+
tools: DiscoveryTool[];
|
|
18
|
+
}
|
|
19
|
+
export declare function buildDiscoveryJson(tools: ToolDefinition[]): DiscoveryJson;
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { injectWebMCP, unregisterAllTools } from "./inject";
|
|
2
|
+
export type { ToolDefinition, WebMCPConfig, ToolAnnotations, ToolExecuteCallbackOptions } from "./types";
|
|
3
|
+
export { allTools, scanTool, badgeTool, passportIssueTool, passportVerifyTool, scoreTool, rulesTool } from "./tools";
|
|
4
|
+
export { generateDeclarativeForm, generateDeclarativeScript, generateDeclarativeStyles } from "./declarative";
|
|
5
|
+
export type { DeclarativeInput, DeclarativeFormConfig } from "./declarative";
|
|
6
|
+
export { buildDiscoveryJson } from "./discovery";
|
|
7
|
+
export type { DiscoveryTool, DiscoveryJson } from "./discovery";
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { injectWebMCP, unregisterAllTools } from "./inject";
|
|
2
|
+
export { allTools, scanTool, badgeTool, passportIssueTool, passportVerifyTool, scoreTool, rulesTool } from "./tools";
|
|
3
|
+
export { generateDeclarativeForm, generateDeclarativeScript, generateDeclarativeStyles } from "./declarative";
|
|
4
|
+
export { buildDiscoveryJson } from "./discovery";
|
package/dist/inject.d.ts
ADDED
package/dist/inject.js
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
export function injectWebMCP(tools) {
|
|
2
|
+
const toolCalls = tools.map((tool, i) => generateToolCall(tool, i)).join("\n");
|
|
3
|
+
return `<script>
|
|
4
|
+
if ('modelContext' in document) {
|
|
5
|
+
var _webmcpControllers = [];
|
|
6
|
+
(async () => {
|
|
7
|
+
try {
|
|
8
|
+
${toolCalls}
|
|
9
|
+
document.modelContext.ontoolchange = function(event) {
|
|
10
|
+
console.log('[WebMCP] toolchange event:', event);
|
|
11
|
+
};
|
|
12
|
+
console.log('[WebMCP] All tools registered successfully');
|
|
13
|
+
} catch (err) {
|
|
14
|
+
console.error('[WebMCP] Tool registration failed:', err);
|
|
15
|
+
}
|
|
16
|
+
})();
|
|
17
|
+
}
|
|
18
|
+
</script>`;
|
|
19
|
+
}
|
|
20
|
+
function generateToolCall(tool, index) {
|
|
21
|
+
const inputSchemaJson = JSON.stringify(tool.inputSchema);
|
|
22
|
+
const annotationsJson = JSON.stringify(tool.annotations);
|
|
23
|
+
const executeFn = tool.execute.toString();
|
|
24
|
+
return ` const _controller${index} = new AbortController();
|
|
25
|
+
_webmcpControllers.push(_controller${index});
|
|
26
|
+
await document.modelContext.registerTool({
|
|
27
|
+
name: ${JSON.stringify(tool.name)},
|
|
28
|
+
description: ${JSON.stringify(tool.description)},
|
|
29
|
+
inputSchema: ${inputSchemaJson},
|
|
30
|
+
annotations: ${annotationsJson},
|
|
31
|
+
execute: ${executeFn}
|
|
32
|
+
}, { signal: _controller${index}.signal });
|
|
33
|
+
console.log('[WebMCP] Registered tool: ${tool.name}');`;
|
|
34
|
+
}
|
|
35
|
+
export function unregisterAllTools() {
|
|
36
|
+
return `<script>
|
|
37
|
+
if (typeof _webmcpControllers !== 'undefined') {
|
|
38
|
+
_webmcpControllers.forEach(function(c) { c.abort(); });
|
|
39
|
+
console.log('[WebMCP] All tools unregistered');
|
|
40
|
+
}
|
|
41
|
+
</script>`;
|
|
42
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export const badgeTool = {
|
|
2
|
+
name: "badge-generate",
|
|
3
|
+
description: "Generate a compliance badge SVG for a given URL and score.",
|
|
4
|
+
inputSchema: {
|
|
5
|
+
type: "object",
|
|
6
|
+
properties: {
|
|
7
|
+
url: { type: "string", description: "The URL to generate a badge for" },
|
|
8
|
+
format: { type: "string", description: "Output format (svg or png, defaults to svg)" },
|
|
9
|
+
},
|
|
10
|
+
required: ["url"],
|
|
11
|
+
},
|
|
12
|
+
execute: async (args, opts) => {
|
|
13
|
+
const params = new URLSearchParams();
|
|
14
|
+
params.set("url", String(args.url));
|
|
15
|
+
if (args.format)
|
|
16
|
+
params.set("format", String(args.format));
|
|
17
|
+
const res = await fetch("/api/badge?" + params.toString(), { signal: opts.signal });
|
|
18
|
+
return await res.text();
|
|
19
|
+
},
|
|
20
|
+
annotations: {
|
|
21
|
+
readOnlyHint: true,
|
|
22
|
+
untrustedContentHint: false,
|
|
23
|
+
title: "Badge Generate",
|
|
24
|
+
},
|
|
25
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { ToolDefinition } from "../types";
|
|
2
|
+
export { scanTool } from "./scan";
|
|
3
|
+
export { badgeTool } from "./badge";
|
|
4
|
+
export { passportIssueTool } from "./passport-issue";
|
|
5
|
+
export { passportVerifyTool } from "./passport-verify";
|
|
6
|
+
export { scoreTool } from "./score";
|
|
7
|
+
export { rulesTool } from "./rules";
|
|
8
|
+
export declare const allTools: ToolDefinition[];
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { scanTool } from "./scan";
|
|
2
|
+
import { badgeTool } from "./badge";
|
|
3
|
+
import { passportIssueTool } from "./passport-issue";
|
|
4
|
+
import { passportVerifyTool } from "./passport-verify";
|
|
5
|
+
import { scoreTool } from "./score";
|
|
6
|
+
import { rulesTool } from "./rules";
|
|
7
|
+
export { scanTool } from "./scan";
|
|
8
|
+
export { badgeTool } from "./badge";
|
|
9
|
+
export { passportIssueTool } from "./passport-issue";
|
|
10
|
+
export { passportVerifyTool } from "./passport-verify";
|
|
11
|
+
export { scoreTool } from "./score";
|
|
12
|
+
export { rulesTool } from "./rules";
|
|
13
|
+
export const allTools = [
|
|
14
|
+
scanTool,
|
|
15
|
+
badgeTool,
|
|
16
|
+
passportIssueTool,
|
|
17
|
+
passportVerifyTool,
|
|
18
|
+
scoreTool,
|
|
19
|
+
rulesTool,
|
|
20
|
+
];
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export const passportIssueTool = {
|
|
2
|
+
name: "passport-issue",
|
|
3
|
+
description: "Issue an AgentBadge passport NFT for a given account address on Hedera. Response includes webmcp metadata with toolsAvailable, discoveryUrl, complianceScore, and lastScanned.",
|
|
4
|
+
inputSchema: {
|
|
5
|
+
type: "object",
|
|
6
|
+
properties: {
|
|
7
|
+
address: { type: "string", description: "Hedera account address (e.g. 0.0.123)" },
|
|
8
|
+
tier: { type: "string", description: "Passport tier (bronze, silver, or gold)" },
|
|
9
|
+
},
|
|
10
|
+
required: ["address"],
|
|
11
|
+
},
|
|
12
|
+
execute: async (args, opts) => {
|
|
13
|
+
const res = await fetch("/passport/request", {
|
|
14
|
+
method: "POST",
|
|
15
|
+
headers: { "Content-Type": "application/json" },
|
|
16
|
+
body: JSON.stringify({ address: args.address, tier: args.tier || "bronze" }),
|
|
17
|
+
signal: opts.signal,
|
|
18
|
+
});
|
|
19
|
+
return await res.json();
|
|
20
|
+
},
|
|
21
|
+
annotations: {
|
|
22
|
+
readOnlyHint: false,
|
|
23
|
+
untrustedContentHint: false,
|
|
24
|
+
title: "Passport Issue",
|
|
25
|
+
},
|
|
26
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export const passportVerifyTool = {
|
|
2
|
+
name: "passport-verify",
|
|
3
|
+
description: "Verify an AgentBadge passport NFT by tokenId or DID. Returns validity, owner, tier, and webmcp metadata (toolsAvailable, discoveryUrl, complianceScore, lastScanned).",
|
|
4
|
+
inputSchema: {
|
|
5
|
+
type: "object",
|
|
6
|
+
properties: {
|
|
7
|
+
tokenId: { type: "string", description: "The NFT token ID to verify" },
|
|
8
|
+
did: { type: "string", description: "The decentralized identifier to look up" },
|
|
9
|
+
},
|
|
10
|
+
required: [],
|
|
11
|
+
},
|
|
12
|
+
execute: async (args, opts) => {
|
|
13
|
+
const params = new URLSearchParams();
|
|
14
|
+
if (args.tokenId)
|
|
15
|
+
params.set("tokenId", String(args.tokenId));
|
|
16
|
+
if (args.did)
|
|
17
|
+
params.set("did", String(args.did));
|
|
18
|
+
const res = await fetch("/api/passport/verify?" + params.toString(), { signal: opts.signal });
|
|
19
|
+
return await res.json();
|
|
20
|
+
},
|
|
21
|
+
annotations: {
|
|
22
|
+
readOnlyHint: true,
|
|
23
|
+
untrustedContentHint: false,
|
|
24
|
+
title: "Passport Verify",
|
|
25
|
+
},
|
|
26
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export const rulesTool = {
|
|
2
|
+
name: "search-rules",
|
|
3
|
+
description: "Search agent readiness rules by query string or category. Returns matching rule definitions.",
|
|
4
|
+
inputSchema: {
|
|
5
|
+
type: "object",
|
|
6
|
+
properties: {
|
|
7
|
+
query: { type: "string", description: "Search query to filter rules by title or description" },
|
|
8
|
+
category: { type: "string", description: "Filter rules by category (e.g. content, mcp, payments)" },
|
|
9
|
+
},
|
|
10
|
+
required: [],
|
|
11
|
+
},
|
|
12
|
+
execute: async (args, opts) => {
|
|
13
|
+
const params = new URLSearchParams();
|
|
14
|
+
if (args.query)
|
|
15
|
+
params.set("q", String(args.query));
|
|
16
|
+
if (args.category)
|
|
17
|
+
params.set("category", String(args.category));
|
|
18
|
+
const res = await fetch("/api/rules/search?" + params.toString(), { signal: opts.signal });
|
|
19
|
+
return await res.json();
|
|
20
|
+
},
|
|
21
|
+
annotations: {
|
|
22
|
+
readOnlyHint: true,
|
|
23
|
+
untrustedContentHint: false,
|
|
24
|
+
title: "Search Rules",
|
|
25
|
+
},
|
|
26
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export const scanTool = {
|
|
2
|
+
name: "agent-readiness-scan",
|
|
3
|
+
description: "Scan a website for AI agent readiness compliance. Returns a compliance score and list of checks.",
|
|
4
|
+
inputSchema: {
|
|
5
|
+
type: "object",
|
|
6
|
+
properties: {
|
|
7
|
+
url: { type: "string", description: "The URL to scan for agent readiness" },
|
|
8
|
+
},
|
|
9
|
+
required: ["url"],
|
|
10
|
+
},
|
|
11
|
+
execute: async (args, opts) => {
|
|
12
|
+
const res = await fetch("/api/scan?url=" + encodeURIComponent(String(args.url)), { signal: opts.signal });
|
|
13
|
+
return await res.json();
|
|
14
|
+
},
|
|
15
|
+
annotations: {
|
|
16
|
+
readOnlyHint: true,
|
|
17
|
+
untrustedContentHint: true,
|
|
18
|
+
title: "Agent Readiness Scan",
|
|
19
|
+
},
|
|
20
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export const scoreTool = {
|
|
2
|
+
name: "get-compliance-score",
|
|
3
|
+
description: "Get the agent readiness compliance score for a given URL. Returns score, grade, and summary.",
|
|
4
|
+
inputSchema: {
|
|
5
|
+
type: "object",
|
|
6
|
+
properties: {
|
|
7
|
+
url: { type: "string", description: "The URL to get the compliance score for" },
|
|
8
|
+
},
|
|
9
|
+
required: ["url"],
|
|
10
|
+
},
|
|
11
|
+
execute: async (args, opts) => {
|
|
12
|
+
const res = await fetch("/api/score?url=" + encodeURIComponent(String(args.url)), { signal: opts.signal });
|
|
13
|
+
return await res.json();
|
|
14
|
+
},
|
|
15
|
+
annotations: {
|
|
16
|
+
readOnlyHint: true,
|
|
17
|
+
untrustedContentHint: true,
|
|
18
|
+
title: "Get Compliance Score",
|
|
19
|
+
},
|
|
20
|
+
};
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export interface ToolAnnotations {
|
|
2
|
+
readOnlyHint: boolean;
|
|
3
|
+
untrustedContentHint: boolean;
|
|
4
|
+
title?: string;
|
|
5
|
+
}
|
|
6
|
+
export interface ToolExecuteCallbackOptions {
|
|
7
|
+
signal: AbortSignal;
|
|
8
|
+
}
|
|
9
|
+
export interface ToolDefinition {
|
|
10
|
+
name: string;
|
|
11
|
+
description: string;
|
|
12
|
+
inputSchema: {
|
|
13
|
+
type: "object";
|
|
14
|
+
properties: Record<string, unknown>;
|
|
15
|
+
required: string[];
|
|
16
|
+
};
|
|
17
|
+
execute: (args: Record<string, unknown>, opts: ToolExecuteCallbackOptions) => Promise<unknown>;
|
|
18
|
+
annotations: ToolAnnotations;
|
|
19
|
+
}
|
|
20
|
+
export interface WebMCPConfig {
|
|
21
|
+
tools: ToolDefinition[];
|
|
22
|
+
featureDetect?: boolean;
|
|
23
|
+
}
|
package/dist/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/package.json
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@agentbadge/webmcp",
|
|
3
|
+
"version": "0.3.0",
|
|
4
|
+
"description": "WebMCP tool injection helpers for AgentBadge",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "dist/index.js",
|
|
7
|
+
"types": "dist/index.d.ts",
|
|
8
|
+
"files": [
|
|
9
|
+
"dist"
|
|
10
|
+
],
|
|
11
|
+
"author": "AgentBadge",
|
|
12
|
+
"license": "MIT",
|
|
13
|
+
"keywords": [
|
|
14
|
+
"webmcp",
|
|
15
|
+
"model-context-protocol",
|
|
16
|
+
"agent",
|
|
17
|
+
"tools",
|
|
18
|
+
"browser"
|
|
19
|
+
],
|
|
20
|
+
"publishConfig": {
|
|
21
|
+
"access": "public"
|
|
22
|
+
},
|
|
23
|
+
"engines": {
|
|
24
|
+
"node": ">=18"
|
|
25
|
+
},
|
|
26
|
+
"scripts": {
|
|
27
|
+
"build": "tsc",
|
|
28
|
+
"prepublishOnly": "npm run build",
|
|
29
|
+
"test": "vitest run --run"
|
|
30
|
+
},
|
|
31
|
+
"devDependencies": {
|
|
32
|
+
"@vitest/coverage-v8": "^2.0.0",
|
|
33
|
+
"bun-types": "^1.3.14",
|
|
34
|
+
"typescript": "^5.9.0",
|
|
35
|
+
"vitest": "^2.0.0"
|
|
36
|
+
}
|
|
37
|
+
}
|