@titikaka2026/mcptools 0.1.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.
Files changed (47) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +328 -0
  3. package/dist/cli.d.ts +3 -0
  4. package/dist/cli.d.ts.map +1 -0
  5. package/dist/cli.js +17 -0
  6. package/dist/cli.js.map +1 -0
  7. package/dist/commands/create.d.ts +3 -0
  8. package/dist/commands/create.d.ts.map +1 -0
  9. package/dist/commands/create.js +564 -0
  10. package/dist/commands/create.js.map +1 -0
  11. package/dist/commands/inspect.d.ts +3 -0
  12. package/dist/commands/inspect.d.ts.map +1 -0
  13. package/dist/commands/inspect.js +140 -0
  14. package/dist/commands/inspect.js.map +1 -0
  15. package/dist/commands/test.d.ts +3 -0
  16. package/dist/commands/test.d.ts.map +1 -0
  17. package/dist/commands/test.js +125 -0
  18. package/dist/commands/test.js.map +1 -0
  19. package/dist/commands/wrap.d.ts +3 -0
  20. package/dist/commands/wrap.d.ts.map +1 -0
  21. package/dist/commands/wrap.js +114 -0
  22. package/dist/commands/wrap.js.map +1 -0
  23. package/dist/core/client.d.ts +21 -0
  24. package/dist/core/client.d.ts.map +1 -0
  25. package/dist/core/client.js +144 -0
  26. package/dist/core/client.js.map +1 -0
  27. package/dist/core/validator.d.ts +13 -0
  28. package/dist/core/validator.d.ts.map +1 -0
  29. package/dist/core/validator.js +120 -0
  30. package/dist/core/validator.js.map +1 -0
  31. package/dist/core/wrap-cli.d.ts +3 -0
  32. package/dist/core/wrap-cli.d.ts.map +1 -0
  33. package/dist/core/wrap-cli.js +144 -0
  34. package/dist/core/wrap-cli.js.map +1 -0
  35. package/dist/core/wrap-rest.d.ts +4 -0
  36. package/dist/core/wrap-rest.d.ts.map +1 -0
  37. package/dist/core/wrap-rest.js +157 -0
  38. package/dist/core/wrap-rest.js.map +1 -0
  39. package/dist/index.d.ts +6 -0
  40. package/dist/index.d.ts.map +1 -0
  41. package/dist/index.js +5 -0
  42. package/dist/index.js.map +1 -0
  43. package/dist/types.d.ts +93 -0
  44. package/dist/types.d.ts.map +1 -0
  45. package/dist/types.js +2 -0
  46. package/dist/types.js.map +1 -0
  47. package/package.json +62 -0
@@ -0,0 +1,120 @@
1
+ export class McpValidator {
2
+ validateMessage(data) {
3
+ const errors = [];
4
+ const warnings = [];
5
+ if (typeof data !== "object" || data === null) {
6
+ return { valid: false, errors: ["Message must be a JSON object"], warnings };
7
+ }
8
+ const msg = data;
9
+ // Check jsonrpc version
10
+ if (msg.jsonrpc !== "2.0") {
11
+ errors.push('Message must have "jsonrpc": "2.0"');
12
+ }
13
+ // Must have either method (request/notification) or result/error (response)
14
+ const isRequest = "method" in msg;
15
+ const isResponse = "result" in msg || "error" in msg;
16
+ if (!isRequest && !isResponse) {
17
+ errors.push("Message must have either 'method' (request) or 'result'/'error' (response)");
18
+ }
19
+ if (isRequest) {
20
+ this.validateRequest(msg, errors, warnings);
21
+ }
22
+ if (isResponse) {
23
+ this.validateResponse(msg, errors, warnings);
24
+ }
25
+ return { valid: errors.length === 0, errors, warnings };
26
+ }
27
+ validateToolDefinition(tool) {
28
+ const errors = [];
29
+ const warnings = [];
30
+ if (typeof tool !== "object" || tool === null) {
31
+ return { valid: false, errors: ["Tool must be a JSON object"], warnings };
32
+ }
33
+ const t = tool;
34
+ if (typeof t.name !== "string" || t.name.length === 0) {
35
+ errors.push("Tool must have a non-empty 'name' string");
36
+ }
37
+ if (typeof t.description !== "string" || t.description.length === 0) {
38
+ warnings.push("Tool should have a 'description' for better usability");
39
+ }
40
+ if (typeof t.inputSchema !== "object" || t.inputSchema === null) {
41
+ errors.push("Tool must have an 'inputSchema' object (JSON Schema)");
42
+ }
43
+ else {
44
+ const schema = t.inputSchema;
45
+ if (schema.type !== "object") {
46
+ errors.push("Tool inputSchema.type should be 'object'");
47
+ }
48
+ }
49
+ return { valid: errors.length === 0, errors, warnings };
50
+ }
51
+ validateResourceDefinition(resource) {
52
+ const errors = [];
53
+ const warnings = [];
54
+ if (typeof resource !== "object" || resource === null) {
55
+ return { valid: false, errors: ["Resource must be a JSON object"], warnings };
56
+ }
57
+ const r = resource;
58
+ if (typeof r.uri !== "string" || r.uri.length === 0) {
59
+ errors.push("Resource must have a non-empty 'uri' string");
60
+ }
61
+ if (typeof r.name !== "string" || r.name.length === 0) {
62
+ errors.push("Resource must have a non-empty 'name' string");
63
+ }
64
+ if (!r.mimeType) {
65
+ warnings.push("Resource should specify a 'mimeType'");
66
+ }
67
+ return { valid: errors.length === 0, errors, warnings };
68
+ }
69
+ validateRequest(msg, errors, warnings) {
70
+ if (typeof msg.method !== "string") {
71
+ errors.push("Request 'method' must be a string");
72
+ }
73
+ // If it has an id, it's a request (not notification) and expects a response
74
+ if ("id" in msg) {
75
+ if (typeof msg.id !== "string" && typeof msg.id !== "number") {
76
+ errors.push("Request 'id' must be a string or number");
77
+ }
78
+ }
79
+ if ("params" in msg && typeof msg.params !== "object") {
80
+ errors.push("Request 'params' must be an object if present");
81
+ }
82
+ // Check for known methods
83
+ const knownMethods = [
84
+ "initialize",
85
+ "tools/list",
86
+ "tools/call",
87
+ "resources/list",
88
+ "resources/read",
89
+ "prompts/list",
90
+ "prompts/get",
91
+ "notifications/initialized",
92
+ "notifications/cancelled",
93
+ ];
94
+ if (typeof msg.method === "string" &&
95
+ !knownMethods.includes(msg.method) &&
96
+ !msg.method.startsWith("$/")) {
97
+ warnings.push(`Unknown method '${msg.method}' — may be a custom extension`);
98
+ }
99
+ }
100
+ validateResponse(msg, errors, _warnings) {
101
+ if (!("id" in msg)) {
102
+ errors.push("Response must have an 'id'");
103
+ }
104
+ if ("error" in msg) {
105
+ const error = msg.error;
106
+ if (typeof error !== "object" || error === null) {
107
+ errors.push("Response 'error' must be an object");
108
+ }
109
+ else {
110
+ if (typeof error.code !== "number") {
111
+ errors.push("Error 'code' must be a number");
112
+ }
113
+ if (typeof error.message !== "string") {
114
+ errors.push("Error 'message' must be a string");
115
+ }
116
+ }
117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;YACH,CAAC;QACH,CAAC;IACH,CAAC;CACF"}
@@ -0,0 +1,3 @@
1
+ import type { WrapCliOptions } from "../types.js";
2
+ export declare function wrapCli(options: WrapCliOptions): string;
3
+ //# sourceMappingURL=wrap-cli.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"wrap-cli.d.ts","sourceRoot":"","sources":["../../src/core/wrap-cli.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAiB,MAAM,aAAa,CAAC;AAEjE,wBAAgB,OAAO,CAAC,OAAO,EAAE,cAAc,GAAG,MAAM,CA2GvD"}
@@ -0,0 +1,144 @@
1
+ export function wrapCli(options) {
2
+ const { command, name, description, subcommands } = options;
3
+ const toolDefinitions = subcommands
4
+ .map((sub) => generateCliToolDefinition(sub))
5
+ .join(",\n ");
6
+ const toolHandlers = subcommands
7
+ .map((sub) => generateCliToolHandler(sub, command))
8
+ .join("\n");
9
+ return `#!/usr/bin/env node
10
+ // Auto-generated MCP server wrapping CLI: ${command}
11
+ // ${description}
12
+ // Generated by mcptools
13
+
14
+ import { execFile } from "node:child_process";
15
+ import { promisify } from "node:util";
16
+
17
+ const execFileAsync = promisify(execFile);
18
+
19
+ const TOOLS = [
20
+ ${toolDefinitions}
21
+ ];
22
+
23
+ function handleRequest(request) {
24
+ const { method, id, params } = request;
25
+
26
+ switch (method) {
27
+ case "initialize":
28
+ return {
29
+ jsonrpc: "2.0",
30
+ id,
31
+ result: {
32
+ protocolVersion: "2024-11-05",
33
+ capabilities: { tools: {} },
34
+ serverInfo: { name: "${name}", version: "1.0.0" },
35
+ },
36
+ };
37
+
38
+ case "tools/list":
39
+ return { jsonrpc: "2.0", id, result: { tools: TOOLS } };
40
+
41
+ case "tools/call":
42
+ return handleToolCall(id, params?.name, params?.arguments ?? {});
43
+
44
+ default:
45
+ if (id !== undefined) {
46
+ return {
47
+ jsonrpc: "2.0",
48
+ id,
49
+ error: { code: -32601, message: "Method not found: " + method },
50
+ };
51
+ }
52
+ return null;
53
+ }
54
+ }
55
+
56
+ async function handleToolCall(id, toolName, args) {
57
+ try {
58
+ const result = await callTool(toolName, args);
59
+ return {
60
+ jsonrpc: "2.0",
61
+ id,
62
+ result: { content: [{ type: "text", text: result }] },
63
+ };
64
+ } catch (error) {
65
+ return {
66
+ jsonrpc: "2.0",
67
+ id,
68
+ result: {
69
+ content: [{ type: "text", text: "Error: " + error.message }],
70
+ isError: true,
71
+ },
72
+ };
73
+ }
74
+ }
75
+
76
+ async function callTool(name, args) {
77
+ switch (name) {
78
+ ${toolHandlers}
79
+ default:
80
+ throw new Error("Unknown tool: " + name);
81
+ }
82
+ }
83
+
84
+ let buffer = "";
85
+ process.stdin.setEncoding("utf-8");
86
+ process.stdin.on("data", async (chunk) => {
87
+ buffer += chunk;
88
+ const lines = buffer.split("\\n");
89
+ buffer = lines.pop() ?? "";
90
+
91
+ for (const line of lines) {
92
+ if (!line.trim()) continue;
93
+ try {
94
+ const request = JSON.parse(line);
95
+ const response = await handleRequest(request);
96
+ if (response) {
97
+ process.stdout.write(JSON.stringify(response) + "\\n");
98
+ }
99
+ } catch (e) {
100
+ // skip malformed input
101
+ }
102
+ }
103
+ });
104
+ `;
105
+ }
106
+ function generateCliToolDefinition(sub) {
107
+ const properties = {};
108
+ const required = [];
109
+ for (const arg of sub.args) {
110
+ properties[arg.name] = {
111
+ type: arg.type,
112
+ description: arg.description,
113
+ };
114
+ if (arg.required) {
115
+ required.push(arg.name);
116
+ }
117
+ }
118
+ return JSON.stringify({
119
+ name: sub.name,
120
+ description: sub.description,
121
+ inputSchema: {
122
+ type: "object",
123
+ properties,
124
+ required: required.length > 0 ? required : undefined,
125
+ },
126
+ }, null, 6);
127
+ }
128
+ function generateCliToolHandler(sub, command) {
129
+ const argMapping = sub.args
130
+ .map((arg) => {
131
+ if (arg.type === "boolean") {
132
+ return ` if (args.${arg.name}) cmdArgs.push("--${arg.name}");`;
133
+ }
134
+ return ` if (args.${arg.name} !== undefined) cmdArgs.push("--${arg.name}", String(args.${arg.name}));`;
135
+ })
136
+ .join("\n");
137
+ return ` case "${sub.name}": {
138
+ const cmdArgs = ["${sub.name}"];
139
+ ${argMapping}
140
+ const { stdout, stderr } = await execFileAsync("${command}", cmdArgs);
141
+ return stdout + (stderr ? "\\nSTDERR:\\n" + stderr : "");
142
+ }`;
143
+ }
144
+ //# sourceMappingURL=wrap-cli.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"wrap-cli.js","sourceRoot":"","sources":["../../src/core/wrap-cli.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,OAAO,CAAC,OAAuB;IAC7C,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,WAAW,EAAE,GAAG,OAAO,CAAC;IAE5D,MAAM,eAAe,GAAG,WAAW;SAChC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,yBAAyB,CAAC,GAAG,CAAC,CAAC;SAC5C,IAAI,CAAC,SAAS,CAAC,CAAC;IAEnB,MAAM,YAAY,GAAG,WAAW;SAC7B,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,sBAAsB,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;SAClD,IAAI,CAAC,IAAI,CAAC,CAAC;IAEd,OAAO;6CACoC,OAAO;KAC/C,WAAW;;;;;;;;;MASV,eAAe;;;;;;;;;;;;;;iCAcY,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA4CnC,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;CA0Bb,CAAC;AACF,CAAC;AAED,SAAS,yBAAyB,CAAC,GAAkB;IACnD,MAAM,UAAU,GAA4B,EAAE,CAAC;IAC/C,MAAM,QAAQ,GAAa,EAAE,CAAC;IAE9B,KAAK,MAAM,GAAG,IAAI,GAAG,CAAC,IAAI,EAAE,CAAC;QAC3B,UAAU,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG;YACrB,IAAI,EAAE,GAAG,CAAC,IAAI;YACd,WAAW,EAAE,GAAG,CAAC,WAAW;SAC7B,CAAC;QACF,IAAI,GAAG,CAAC,QAAQ,EAAE,CAAC;YACjB,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QAC1B,CAAC;IACH,CAAC;IAED,OAAO,IAAI,CAAC,SAAS,CACnB;QACE,IAAI,EAAE,GAAG,CAAC,IAAI;QACd,WAAW,EAAE,GAAG,CAAC,WAAW;QAC5B,WAAW,EAAE;YACX,IAAI,EAAE,QAAQ;YACd,UAAU;YACV,QAAQ,EAAE,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS;SACrD;KACF,EACD,IAAI,EACJ,CAAC,CACF,CAAC;AACJ,CAAC;AAED,SAAS,sBAAsB,CAAC,GAAkB,EAAE,OAAe;IACjE,MAAM,UAAU,GAAG,GAAG,CAAC,IAAI;SACxB,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE;QACX,IAAI,GAAG,CAAC,IAAI,KAAK,SAAS,EAAE,CAAC;YAC3B,OAAO,kBAAkB,GAAG,CAAC,IAAI,qBAAqB,GAAG,CAAC,IAAI,KAAK,CAAC;QACtE,CAAC;QACD,OAAO,kBAAkB,GAAG,CAAC,IAAI,mCAAmC,GAAG,CAAC,IAAI,kBAAkB,GAAG,CAAC,IAAI,KAAK,CAAC;IAC9G,CAAC,CAAC;SACD,IAAI,CAAC,IAAI,CAAC,CAAC;IAEd,OAAO,aAAa,GAAG,CAAC,IAAI;0BACJ,GAAG,CAAC,IAAI;EAChC,UAAU;wDAC4C,OAAO;;MAEzD,CAAC;AACP,CAAC"}
@@ -0,0 +1,4 @@
1
+ import type { WrapRestOptions, RestEndpoint } from "../types.js";
2
+ export declare function wrapRestApi(options: WrapRestOptions): string;
3
+ export declare function generateToolRouter(endpoints: RestEndpoint[]): string;
4
+ //# sourceMappingURL=wrap-rest.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"wrap-rest.d.ts","sourceRoot":"","sources":["../../src/core/wrap-rest.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,YAAY,EAAqB,MAAM,aAAa,CAAC;AAEpF,wBAAgB,WAAW,CAAC,OAAO,EAAE,eAAe,GAAG,MAAM,CAkG5D;AA8DD,wBAAgB,kBAAkB,CAAC,SAAS,EAAE,YAAY,EAAE,GAAG,MAAM,CAYpE"}
@@ -0,0 +1,157 @@
1
+ export function wrapRestApi(options) {
2
+ const { baseUrl, name, endpoints } = options;
3
+ const toolHandlers = endpoints
4
+ .map((ep) => generateToolHandler(ep, baseUrl))
5
+ .join("\n\n");
6
+ const toolDefinitions = endpoints
7
+ .map((ep) => generateToolDefinition(ep))
8
+ .join(",\n ");
9
+ return `#!/usr/bin/env node
10
+ // Auto-generated MCP server wrapping REST API: ${name}
11
+ // Generated by mcptools
12
+
13
+ import { createServer } from "node:http";
14
+
15
+ const TOOLS = [
16
+ ${toolDefinitions}
17
+ ];
18
+
19
+ function handleRequest(request) {
20
+ const { method, id, params } = request;
21
+
22
+ switch (method) {
23
+ case "initialize":
24
+ return {
25
+ jsonrpc: "2.0",
26
+ id,
27
+ result: {
28
+ protocolVersion: "2024-11-05",
29
+ capabilities: { tools: {} },
30
+ serverInfo: { name: "${name}", version: "1.0.0" },
31
+ },
32
+ };
33
+
34
+ case "tools/list":
35
+ return { jsonrpc: "2.0", id, result: { tools: TOOLS } };
36
+
37
+ case "tools/call":
38
+ return handleToolCall(id, params?.name, params?.arguments ?? {});
39
+
40
+ default:
41
+ if (id !== undefined) {
42
+ return {
43
+ jsonrpc: "2.0",
44
+ id,
45
+ error: { code: -32601, message: "Method not found: " + method },
46
+ };
47
+ }
48
+ return null; // notification, no response needed
49
+ }
50
+ }
51
+
52
+ ${toolHandlers}
53
+
54
+ async function handleToolCall(id, toolName, args) {
55
+ try {
56
+ const result = await callTool(toolName, args);
57
+ return {
58
+ jsonrpc: "2.0",
59
+ id,
60
+ result: { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] },
61
+ };
62
+ } catch (error) {
63
+ return {
64
+ jsonrpc: "2.0",
65
+ id,
66
+ result: {
67
+ content: [{ type: "text", text: "Error: " + error.message }],
68
+ isError: true,
69
+ },
70
+ };
71
+ }
72
+ }
73
+
74
+ // stdio transport
75
+ let buffer = "";
76
+ process.stdin.setEncoding("utf-8");
77
+ process.stdin.on("data", async (chunk) => {
78
+ buffer += chunk;
79
+ const lines = buffer.split("\\n");
80
+ buffer = lines.pop() ?? "";
81
+
82
+ for (const line of lines) {
83
+ if (!line.trim()) continue;
84
+ try {
85
+ const request = JSON.parse(line);
86
+ const response = await handleRequest(request);
87
+ if (response) {
88
+ process.stdout.write(JSON.stringify(response) + "\\n");
89
+ }
90
+ } catch (e) {
91
+ // skip malformed input
92
+ }
93
+ }
94
+ });
95
+ `;
96
+ }
97
+ function generateToolDefinition(ep) {
98
+ const properties = {};
99
+ const required = [];
100
+ for (const param of ep.parameters ?? []) {
101
+ properties[param.name] = {
102
+ type: param.type,
103
+ description: param.description,
104
+ };
105
+ if (param.required) {
106
+ required.push(param.name);
107
+ }
108
+ }
109
+ return JSON.stringify({
110
+ name: ep.name,
111
+ description: ep.description,
112
+ inputSchema: {
113
+ type: "object",
114
+ properties,
115
+ required: required.length > 0 ? required : undefined,
116
+ },
117
+ }, null, 6);
118
+ }
119
+ function generateToolHandler(ep, baseUrl) {
120
+ const pathParams = (ep.parameters ?? []).filter((p) => p.in === "path");
121
+ const queryParams = (ep.parameters ?? []).filter((p) => p.in === "query");
122
+ const bodyParams = (ep.parameters ?? []).filter((p) => p.in === "body");
123
+ let urlExpr = `"${baseUrl}${ep.path}"`;
124
+ for (const p of pathParams) {
125
+ urlExpr = urlExpr.replace(`{${p.name}}`, `\${args.${p.name}}`);
126
+ }
127
+ const queryParts = queryParams
128
+ .map((p) => `args.${p.name} !== undefined ? "${p.name}=" + encodeURIComponent(args.${p.name}) : ""`)
129
+ .join(", ");
130
+ const hasQuery = queryParams.length > 0;
131
+ const hasBody = bodyParams.length > 0 && ep.method !== "GET";
132
+ return `async function call_${ep.name}(args) {
133
+ let url = \`${urlExpr.replace(/"/g, "")}\`;
134
+ ${hasQuery ? `const query = [${queryParts}].filter(Boolean).join("&");
135
+ if (query) url += "?" + query;` : ""}
136
+ const response = await fetch(url, {
137
+ method: "${ep.method}",
138
+ headers: { "Content-Type": "application/json" },
139
+ ${hasBody ? `body: JSON.stringify({ ${bodyParams.map((p) => p.name).join(", ")} }),` : ""}
140
+ });
141
+ if (!response.ok) throw new Error(\`HTTP \${response.status}: \${await response.text()}\`);
142
+ return response.json();
143
+ }`;
144
+ }
145
+ export function generateToolRouter(endpoints) {
146
+ const cases = endpoints
147
+ .map((ep) => ` case "${ep.name}": return call_${ep.name}(args);`)
148
+ .join("\n");
149
+ return `async function callTool(name, args) {
150
+ switch (name) {
151
+ ${cases}
152
+ default:
153
+ throw new Error("Unknown tool: " + name);
154
+ }
155
+ }`;
156
+ }
157
+ //# sourceMappingURL=wrap-rest.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"wrap-rest.js","sourceRoot":"","sources":["../../src/core/wrap-rest.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,WAAW,CAAC,OAAwB;IAClD,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,GAAG,OAAO,CAAC;IAE7C,MAAM,YAAY,GAAG,SAAS;SAC3B,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,mBAAmB,CAAC,EAAE,EAAE,OAAO,CAAC,CAAC;SAC7C,IAAI,CAAC,MAAM,CAAC,CAAC;IAEhB,MAAM,eAAe,GAAG,SAAS;SAC9B,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,sBAAsB,CAAC,EAAE,CAAC,CAAC;SACvC,IAAI,CAAC,SAAS,CAAC,CAAC;IAEnB,OAAO;kDACyC,IAAI;;;;;;MAMhD,eAAe;;;;;;;;;;;;;;i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1D,MAAM,KAAK,GAAG,SAAS;SACpB,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,aAAa,EAAE,CAAC,IAAI,kBAAkB,EAAE,CAAC,IAAI,SAAS,CAAC;SACnE,IAAI,CAAC,IAAI,CAAC,CAAC;IAEd,OAAO;;EAEP,KAAK;;;;EAIL,CAAC;AACH,CAAC"}
@@ -0,0 +1,6 @@
1
+ export { McpClient } from "./core/client.js";
2
+ export { McpValidator } from "./core/validator.js";
3
+ export { wrapRestApi } from "./core/wrap-rest.js";
4
+ export { wrapCli } from "./core/wrap-cli.js";
5
+ export type { McpTool, McpResource, McpPrompt, McpServerConfig, McpMessage, McpRequest, McpResponse, } from "./types.js";
6
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAC7C,YAAY,EACV,OAAO,EACP,WAAW,EACX,SAAS,EACT,eAAe,EACf,UAAU,EACV,UAAU,EACV,WAAW,GACZ,MAAM,YAAY,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,5 @@
1
+ export { McpClient } from "./core/client.js";
2
+ export { McpValidator } from "./core/validator.js";
3
+ export { wrapRestApi } from "./core/wrap-rest.js";
4
+ export { wrapCli } from "./core/wrap-cli.js";
5
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC"}
@@ -0,0 +1,93 @@
1
+ export interface McpTool {
2
+ name: string;
3
+ description: string;
4
+ inputSchema: Record<string, unknown>;
5
+ }
6
+ export interface McpResource {
7
+ uri: string;
8
+ name: string;
9
+ description?: string;
10
+ mimeType?: string;
11
+ }
12
+ export interface McpPrompt {
13
+ name: string;
14
+ description?: string;
15
+ arguments?: McpPromptArgument[];
16
+ }
17
+ export interface McpPromptArgument {
18
+ name: string;
19
+ description?: string;
20
+ required?: boolean;
21
+ }
22
+ export interface McpServerConfig {
23
+ name: string;
24
+ command: string;
25
+ args?: string[];
26
+ env?: Record<string, string>;
27
+ transport?: "stdio" | "sse";
28
+ url?: string;
29
+ }
30
+ export interface McpMessage {
31
+ jsonrpc: "2.0";
32
+ id?: string | number;
33
+ method?: string;
34
+ params?: Record<string, unknown>;
35
+ result?: unknown;
36
+ error?: McpError;
37
+ }
38
+ export interface McpRequest {
39
+ jsonrpc: "2.0";
40
+ id: string | number;
41
+ method: string;
42
+ params?: Record<string, unknown>;
43
+ }
44
+ export interface McpResponse {
45
+ jsonrpc: "2.0";
46
+ id: string | number;
47
+ result?: unknown;
48
+ error?: McpError;
49
+ }
50
+ export interface McpError {
51
+ code: number;
52
+ message: string;
53
+ data?: unknown;
54
+ }
55
+ export interface WrapRestOptions {
56
+ baseUrl: string;
57
+ name: string;
58
+ endpoints: RestEndpoint[];
59
+ outputDir: string;
60
+ }
61
+ export interface RestEndpoint {
62
+ method: "GET" | "POST" | "PUT" | "DELETE" | "PATCH";
63
+ path: string;
64
+ name: string;
65
+ description: string;
66
+ parameters?: EndpointParameter[];
67
+ }
68
+ export interface EndpointParameter {
69
+ name: string;
70
+ type: "string" | "number" | "boolean";
71
+ description: string;
72
+ required?: boolean;
73
+ in: "query" | "path" | "body";
74
+ }
75
+ export interface WrapCliOptions {
76
+ command: string;
77
+ name: string;
78
+ description: string;
79
+ subcommands: CliSubcommand[];
80
+ outputDir: string;
81
+ }
82
+ export interface CliSubcommand {
83
+ name: string;
84
+ description: string;
85
+ args: CliArgument[];
86
+ }
87
+ export interface CliArgument {
88
+ name: string;
89
+ description: string;
90
+ type: "string" | "number" | "boolean";
91
+ required?: boolean;
92
+ }
93
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,OAAO;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACtC;AAED,MAAM,WAAW,WAAW;IAC1B,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,iBAAiB,EAAE,CAAC;CACjC;AAED,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAChB,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC7B,SAAS,CAAC,EAAE,OAAO,GAAG,KAAK,CAAC;IAC5B,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,UAAU;IACzB,OAAO,EAAE,KA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AS,CAAC;IACtC,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,EAAE,EAAE,OAAO,GAAG,MAAM,GAAG,MAAM,CAAC;CAC/B;AAED,MAAM,WAAW,cAAc;IAC7B,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,aAAa,EAAE,CAAC;IAC7B,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,WAAW,EAAE,CAAC;CACrB;AAED,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,QAAQ,GAAG,QAAQ,GAAG,SAAS,CAAC;IACtC,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB"}
package/dist/types.js ADDED
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":""}
package/package.json ADDED
@@ -0,0 +1,62 @@
1
+ {
2
+ "name": "@titikaka2026/mcptools",
3
+ "version": "0.1.0",
4
+ "description": "The Swiss Army knife for MCP (Model Context Protocol) — create, test, inspect, and wrap MCP servers with ease.",
5
+ "keywords": [
6
+ "mcp",
7
+ "model-context-protocol",
8
+ "ai",
9
+ "llm",
10
+ "claude",
11
+ "openai",
12
+ "tool",
13
+ "cli",
14
+ "developer-tools"
15
+ ],
16
+ "author": "titikaka2024",
17
+ "license": "MIT",
18
+ "repository": {
19
+ "type": "git",
20
+ "url": "git+https://github.com/titikaka2024/mcptools.git"
21
+ },
22
+ "homepage": "https://github.com/titikaka2024/mcptools",
23
+ "bugs": {
24
+ "url": "https://github.com/titikaka2024/mcptools/issues"
25
+ },
26
+ "type": "module",
27
+ "bin": {
28
+ "mcptools": "dist/cli.js"
29
+ },
30
+ "main": "./dist/index.js",
31
+ "types": "./dist/index.d.ts",
32
+ "files": [
33
+ "dist",
34
+ "templates"
35
+ ],
36
+ "scripts": {
37
+ "build": "tsc",
38
+ "dev": "tsc --watch",
39
+ "start": "node dist/cli.js",
40
+ "test": "vitest run",
41
+ "test:watch": "vitest",
42
+ "lint": "eslint src/",
43
+ "prepublishOnly": "npm run build"
44
+ },
45
+ "dependencies": {
46
+ "chalk": "^5.3.0",
47
+ "commander": "^12.1.0",
48
+ "enquirer": "^2.4.1",
49
+ "ora": "^8.1.0",
50
+ "ws": "^8.18.0",
51
+ "zod": "^3.23.0"
52
+ },
53
+ "devDependencies": {
54
+ "@types/node": "^22.0.0",
55
+ "@types/ws": "^8.5.12",
56
+ "typescript": "^5.6.0",
57
+ "vitest": "^2.1.0"
58
+ },
59
+ "engines": {
60
+ "node": ">=18.0.0"
61
+ }
62
+ }