protect-mcp 0.4.3 → 0.4.5

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,136 +1,8 @@
1
1
  #!/usr/bin/env node
2
-
3
- // src/demo-server.ts
4
- import { createInterface } from "readline";
5
- var TOOLS = [
6
- {
7
- name: "read_file",
8
- description: "Read the contents of a file",
9
- inputSchema: {
10
- type: "object",
11
- properties: { path: { type: "string", description: "File path to read" } },
12
- required: ["path"]
13
- }
14
- },
15
- {
16
- name: "write_file",
17
- description: "Write content to a file",
18
- inputSchema: {
19
- type: "object",
20
- properties: {
21
- path: { type: "string", description: "File path to write" },
22
- content: { type: "string", description: "Content to write" }
23
- },
24
- required: ["path", "content"]
25
- }
26
- },
27
- {
28
- name: "delete_file",
29
- description: "Delete a file from the filesystem",
30
- inputSchema: {
31
- type: "object",
32
- properties: { path: { type: "string", description: "File path to delete" } },
33
- required: ["path"]
34
- }
35
- },
36
- {
37
- name: "web_search",
38
- description: "Search the web for information",
39
- inputSchema: {
40
- type: "object",
41
- properties: { query: { type: "string", description: "Search query" } },
42
- required: ["query"]
43
- }
44
- },
45
- {
46
- name: "deploy",
47
- description: "Deploy the application to production",
48
- inputSchema: {
49
- type: "object",
50
- properties: {
51
- environment: { type: "string", description: "Target environment", enum: ["staging", "production"] },
52
- reason: { type: "string", description: "Deployment reason" }
53
- },
54
- required: ["environment"]
55
- }
56
- }
57
- ];
58
- function handleRequest(request) {
59
- if (request.method === "initialize") {
60
- return JSON.stringify({
61
- jsonrpc: "2.0",
62
- id: request.id,
63
- result: {
64
- protocolVersion: "2024-11-05",
65
- serverInfo: { name: "protect-mcp-demo", version: "0.2.0" },
66
- capabilities: { tools: {} }
67
- }
68
- });
69
- }
70
- if (request.method === "notifications/initialized") {
71
- return "";
72
- }
73
- if (request.method === "tools/list") {
74
- return JSON.stringify({
75
- jsonrpc: "2.0",
76
- id: request.id,
77
- result: { tools: TOOLS }
78
- });
79
- }
80
- if (request.method === "tools/call") {
81
- const toolName = request.params?.name || "unknown";
82
- const args = request.params?.arguments || {};
83
- let resultText;
84
- switch (toolName) {
85
- case "read_file":
86
- resultText = `[demo] Read file: ${args.path || "/example.txt"}
87
- Contents: Hello from protect-mcp demo server!`;
88
- break;
89
- case "write_file":
90
- resultText = `[demo] Wrote ${String(args.content || "").length} bytes to ${args.path || "/example.txt"}`;
91
- break;
92
- case "delete_file":
93
- resultText = `[demo] Deleted file: ${args.path || "/example.txt"}`;
94
- break;
95
- case "web_search":
96
- resultText = `[demo] Search results for "${args.query || "test"}":
97
- 1. Example result \u2014 scopeblind.com
98
- 2. MCP security \u2014 modelcontextprotocol.io`;
99
- break;
100
- case "deploy":
101
- resultText = `[demo] Deployed to ${args.environment || "staging"}${args.reason ? ` (reason: ${args.reason})` : ""}`;
102
- break;
103
- default:
104
- resultText = `[demo] Unknown tool: ${toolName}`;
105
- }
106
- return JSON.stringify({
107
- jsonrpc: "2.0",
108
- id: request.id,
109
- result: {
110
- content: [{ type: "text", text: resultText }]
111
- }
112
- });
113
- }
114
- if (request.id !== void 0) {
115
- return JSON.stringify({
116
- jsonrpc: "2.0",
117
- id: request.id,
118
- error: { code: -32601, message: `Method not found: ${request.method}` }
119
- });
120
- }
121
- return "";
122
- }
123
- var rl = createInterface({ input: process.stdin, crlfDelay: Infinity });
124
- rl.on("line", (line) => {
125
- const trimmed = line.trim();
126
- if (!trimmed) return;
127
- try {
128
- const request = JSON.parse(trimmed);
129
- const response = handleRequest(request);
130
- if (response) {
131
- process.stdout.write(response + "\n");
132
- }
133
- } catch {
134
- }
135
- });
136
- process.stderr.write("[DEMO_SERVER] protect-mcp demo server started \u2014 5 tools registered\n");
2
+ import {
3
+ createSandboxServer
4
+ } from "./chunk-SU2FZH7U.mjs";
5
+ import "./chunk-PQJP2ZCI.mjs";
6
+ export {
7
+ createSandboxServer
8
+ };
@@ -15,6 +15,7 @@ import {
15
15
  toBytes,
16
16
  utf8ToBytes
17
17
  } from "./chunk-D733KAPG.mjs";
18
+ import "./chunk-PQJP2ZCI.mjs";
18
19
 
19
20
  // node_modules/@noble/hashes/esm/_md.js
20
21
  function setBigUint64(view, byteOffset, value, isLE) {
@@ -1,6 +1,7 @@
1
1
  import {
2
2
  ProtectGateway
3
3
  } from "./chunk-VF3OCG4D.mjs";
4
+ import "./chunk-PQJP2ZCI.mjs";
4
5
 
5
6
  // src/http-transport.ts
6
7
  import { createServer } from "http";
package/dist/index.d.mts CHANGED
@@ -1,3 +1,5 @@
1
+ export { createSandboxServer } from './demo-server.mjs';
2
+
1
3
  interface ProtectPolicy {
2
4
  tools: Record<string, ToolPolicy>;
3
5
  /** Default trust tier for unidentified agents (default: "unknown") */
package/dist/index.d.ts CHANGED
@@ -1,3 +1,5 @@
1
+ export { createSandboxServer } from './demo-server.js';
2
+
1
3
  interface ProtectPolicy {
2
4
  tools: Record<string, ToolPolicy>;
3
5
  /** Default trust tier for unidentified agents (default: "unknown") */