@vymalo/opencode-devtools-mcp 0.12.0 → 0.14.1
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/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/mcp.d.ts +0 -1
- package/dist/mcp.js +17 -16
- package/dist/mcp.js.map +1 -1
- package/dist/render.d.ts +8 -8
- package/dist/render.js +17 -7
- package/dist/render.js.map +1 -1
- package/dist/server.d.ts +5 -5
- package/dist/server.js +36 -38
- package/dist/server.js.map +1 -1
- package/package.json +4 -4
package/dist/index.js
CHANGED
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"
|
|
1
|
+
{"mappings":"AAAA,SAA8C,cAAc,kBAAkB;AAC9E,SAAS,iBAAiB,eAAmC,mBAAmB","names":[],"sources":["../src/index.ts"],"version":3,"file":"index.js","sourceRoot":""}
|
package/dist/mcp.d.ts
CHANGED
package/dist/mcp.js
CHANGED
|
@@ -3,23 +3,24 @@ import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js"
|
|
|
3
3
|
import { DEFAULT_GROUPS, resolveOptions, TOOL_GROUPS } from "@vymalo/opencode-devtools/lib";
|
|
4
4
|
import { createMcpServer, groupsFromEnv } from "./server.js";
|
|
5
5
|
async function main() {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
6
|
+
const groups = groupsFromEnv(process.env.OCD_GROUPS, TOOL_GROUPS, DEFAULT_GROUPS);
|
|
7
|
+
const options = resolveOptions({
|
|
8
|
+
groups,
|
|
9
|
+
http: {
|
|
10
|
+
allowPrivateNetwork: /^(1|true|yes|on)$/i.test(process.env.OCD_HTTP_ALLOW_PRIVATE ?? ""),
|
|
11
|
+
timeoutMs: Number(process.env.OCD_HTTP_TIMEOUT ?? 3e4)
|
|
12
|
+
}
|
|
13
|
+
});
|
|
14
|
+
process.stderr.write(`opencode-devtools-mcp: groups ${options.groups.join(", ")}\n`);
|
|
15
|
+
if (options.groups.includes("http")) {
|
|
16
|
+
process.stderr.write(`opencode-devtools-mcp: http egress enabled (allowPrivateNetwork=${options.http.allowPrivateNetwork})\n`);
|
|
17
|
+
}
|
|
18
|
+
const server = createMcpServer(options);
|
|
19
|
+
await server.connect(new StdioServerTransport());
|
|
20
20
|
}
|
|
21
21
|
main().catch((err) => {
|
|
22
|
-
|
|
23
|
-
|
|
22
|
+
process.stderr.write(`opencode-devtools-mcp fatal: ${err instanceof Error ? err.message : String(err)}\n`);
|
|
23
|
+
process.exit(1);
|
|
24
24
|
});
|
|
25
|
+
|
|
25
26
|
//# sourceMappingURL=mcp.js.map
|
package/dist/mcp.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"
|
|
1
|
+
{"mappings":";AACA,SAAS,4BAA4B;AACrC,SAAS,gBAAgB,gBAAgB,mBAAmB;AAE5D,SAAS,iBAAiB,qBAAqB;AAE/C,eAAe,OAAsB;CACnC,MAAM,SAAS,cAAc,QAAQ,IAAI,YAAY,aAAa,cAAc;CAChF,MAAM,UAAU,eAAe;EAC7B;EACA,MAAM;GACJ,qBAAqB,qBAAqB,KAAK,QAAQ,IAAI,0BAA0B,EAAE;GACvF,WAAW,OAAO,QAAQ,IAAI,oBAAoB,GAAM;EAC1D;CACF,CAAC;CAED,QAAQ,OAAO,MAAM,iCAAiC,QAAQ,OAAO,KAAK,IAAI,EAAE,GAAG;CACnF,IAAI,QAAQ,OAAO,SAAS,MAAM,GAAG;EACnC,QAAQ,OAAO,MACb,mEAAmE,QAAQ,KAAK,oBAAoB,IACtG;CACF;CAEA,MAAM,SAAS,gBAAgB,OAAO;CACtC,MAAM,OAAO,QAAQ,IAAI,qBAAqB,CAAC;AACjD;AAEA,KAAK,CAAC,CAAC,OAAO,QAAQ;CACpB,QAAQ,OAAO,MACb,gCAAgC,eAAe,QAAQ,IAAI,UAAU,OAAO,GAAG,EAAE,GACnF;CACA,QAAQ,KAAK,CAAC;AAChB,CAAC","names":[],"sources":["../src/mcp.ts"],"version":3,"file":"mcp.js","sourceRoot":""}
|
package/dist/render.d.ts
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import type { NeutralResult } from "@vymalo/opencode-devtools/lib";
|
|
2
2
|
/** An MCP tool-result content block. Devtools results are text-only. */
|
|
3
3
|
export type McpContent = {
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
type: "text";
|
|
5
|
+
text: string;
|
|
6
6
|
};
|
|
7
7
|
export interface McpToolResult {
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
content: McpContent[];
|
|
9
|
+
isError?: boolean;
|
|
10
10
|
}
|
|
11
11
|
/**
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
12
|
+
* Render an adapter-neutral result into MCP tool-result content. Devtools tools
|
|
13
|
+
* never return images, so both `text` and `json` results map to a TextContent
|
|
14
|
+
* (the neutral result's `text` is always self-sufficient).
|
|
15
|
+
*/
|
|
16
16
|
export declare function toMcpContent(result: NeutralResult): McpToolResult;
|
|
17
17
|
/** Render a thrown error as an MCP tool error result (so the model sees it). */
|
|
18
18
|
export declare function toMcpError(err: unknown): McpToolResult;
|
package/dist/render.js
CHANGED
|
@@ -1,14 +1,24 @@
|
|
|
1
1
|
/**
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
* Render an adapter-neutral result into MCP tool-result content. Devtools tools
|
|
3
|
+
* never return images, so both `text` and `json` results map to a TextContent
|
|
4
|
+
* (the neutral result's `text` is always self-sufficient).
|
|
5
|
+
*/
|
|
6
6
|
export function toMcpContent(result) {
|
|
7
|
-
|
|
7
|
+
return { content: [{
|
|
8
|
+
type: "text",
|
|
9
|
+
text: result.text
|
|
10
|
+
}] };
|
|
8
11
|
}
|
|
9
12
|
/** Render a thrown error as an MCP tool error result (so the model sees it). */
|
|
10
13
|
export function toMcpError(err) {
|
|
11
|
-
|
|
12
|
-
|
|
14
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
15
|
+
return {
|
|
16
|
+
content: [{
|
|
17
|
+
type: "text",
|
|
18
|
+
text: message
|
|
19
|
+
}],
|
|
20
|
+
isError: true
|
|
21
|
+
};
|
|
13
22
|
}
|
|
23
|
+
|
|
14
24
|
//# sourceMappingURL=render.js.map
|
package/dist/render.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"
|
|
1
|
+
{"mappings":";;;;;AAeA,OAAO,SAAS,aAAa,QAAsC;CACjE,OAAO,EAAE,SAAS,CAAC;EAAE,MAAM;EAAQ,MAAM,OAAO;CAAK,CAAC,EAAE;AAC1D;;AAGA,OAAO,SAAS,WAAW,KAA6B;CACtD,MAAM,UAAU,eAAe,QAAQ,IAAI,UAAU,OAAO,GAAG;CAC/D,OAAO;EAAE,SAAS,CAAC;GAAE,MAAM;GAAQ,MAAM;EAAQ,CAAC;EAAG,SAAS;CAAK;AACrE","names":[],"sources":["../src/render.ts"],"version":3,"file":"render.js","sourceRoot":""}
|
package/dist/server.d.ts
CHANGED
|
@@ -2,13 +2,13 @@ import { Server } from "@modelcontextprotocol/sdk/server/index.js";
|
|
|
2
2
|
import { selectTools, type ToolContext, type ToolGroup, type ResolvedDevtoolsOptions } from "@vymalo/opencode-devtools/lib";
|
|
3
3
|
export { selectTools };
|
|
4
4
|
export interface McpServerDeps {
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
/** Inject the execution context (clock / randomness / fetch) for tests. */
|
|
6
|
+
context?: Partial<Omit<ToolContext, "options">>;
|
|
7
7
|
}
|
|
8
8
|
/**
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
* Build an MCP server that exposes the group-filtered devtools catalog and runs
|
|
10
|
+
* each tool's handler locally (no bridge — these are pure compute tools).
|
|
11
|
+
*/
|
|
12
12
|
export declare function createMcpServer(options: ResolvedDevtoolsOptions, deps?: McpServerDeps): Server;
|
|
13
13
|
/** Selected group ids from a comma-separated env string, falling back to defaults. */
|
|
14
14
|
export declare function groupsFromEnv(raw: string | undefined, all: readonly ToolGroup[], fallback: readonly ToolGroup[]): ToolGroup[];
|
package/dist/server.js
CHANGED
|
@@ -4,47 +4,45 @@ import { buildContext, selectTools, toJsonSchema } from "@vymalo/opencode-devtoo
|
|
|
4
4
|
import { toMcpContent, toMcpError } from "./render.js";
|
|
5
5
|
export { selectTools };
|
|
6
6
|
/**
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
* Build an MCP server that exposes the group-filtered devtools catalog and runs
|
|
8
|
+
* each tool's handler locally (no bridge — these are pure compute tools).
|
|
9
|
+
*/
|
|
10
10
|
export function createMcpServer(options, deps = {}) {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
11
|
+
const specs = selectTools(options.groups);
|
|
12
|
+
const byName = new Map(specs.map((spec) => [spec.name, spec]));
|
|
13
|
+
const ctx = buildContext(options, deps.context);
|
|
14
|
+
const server = new Server({
|
|
15
|
+
name: "opencode-devtools",
|
|
16
|
+
version: "0.9.0"
|
|
17
|
+
}, { capabilities: { tools: {} } });
|
|
18
|
+
server.setRequestHandler(ListToolsRequestSchema, async () => ({ tools: specs.map((spec) => ({
|
|
19
|
+
name: spec.name,
|
|
20
|
+
description: spec.description,
|
|
21
|
+
inputSchema: toJsonSchema(spec.input)
|
|
22
|
+
})) }));
|
|
23
|
+
server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
24
|
+
const render = (r) => r;
|
|
25
|
+
const spec = byName.get(request.params.name);
|
|
26
|
+
if (!spec) {
|
|
27
|
+
return render(toMcpError(new Error(`unknown tool: ${request.params.name}`)));
|
|
28
|
+
}
|
|
29
|
+
const args = request.params.arguments ?? {};
|
|
30
|
+
try {
|
|
31
|
+
const result = await spec.handler(args, ctx);
|
|
32
|
+
return render(toMcpContent(result));
|
|
33
|
+
} catch (err) {
|
|
34
|
+
return render(toMcpError(err));
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
return server;
|
|
38
38
|
}
|
|
39
39
|
/** Selected group ids from a comma-separated env string, falling back to defaults. */
|
|
40
40
|
export function groupsFromEnv(raw, all, fallback) {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
.map((s) => s.trim())
|
|
47
|
-
.filter((g) => all.includes(g));
|
|
48
|
-
return parts.length > 0 ? parts : [...fallback];
|
|
41
|
+
if (!raw) {
|
|
42
|
+
return [...fallback];
|
|
43
|
+
}
|
|
44
|
+
const parts = raw.split(",").map((s) => s.trim()).filter((g) => all.includes(g));
|
|
45
|
+
return parts.length > 0 ? parts : [...fallback];
|
|
49
46
|
}
|
|
47
|
+
|
|
50
48
|
//# sourceMappingURL=server.js.map
|
package/dist/server.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"
|
|
1
|
+
{"mappings":"AAAA,SAAS,cAAc;AACvB,SACE,uBAEA,8BACK;AACP,SACE,cAEA,aACA,oBAIK;AAEP,SAA6B,cAAc,kBAAkB;AAE7D,SAAS;;;;;AAWT,OAAO,SAAS,gBACd,SACA,OAAsB,CAAC,GACf;CACR,MAAM,QAAQ,YAAY,QAAQ,MAAM;CACxC,MAAM,SAAS,IAAI,IAAI,MAAM,KAAK,SAAS,CAAC,KAAK,MAAM,IAAI,CAAC,CAAC;CAC7D,MAAM,MAAM,aAAa,SAAS,KAAK,OAAO;CAE9C,MAAM,SAAS,IAAI,OACjB;EAAE,MAAM;EAAqB,SAAS;CAAQ,GAC9C,EAAE,cAAc,EAAE,OAAO,CAAC,EAAE,EAAE,CAChC;CAEA,OAAO,kBAAkB,wBAAwB,aAAa,EAC5D,OAAO,MAAM,KAAK,UAAU;EAC1B,MAAM,KAAK;EACX,aAAa,KAAK;EAClB,aAAa,aAAa,KAAK,KAAK;CACtC,EAAE,EACJ,EAAE;CAEF,OAAO,kBAAkB,uBAAuB,OAAO,YAAqC;EAC1F,MAAM,UAAU,MAAqC;EACrD,MAAM,OAAO,OAAO,IAAI,QAAQ,OAAO,IAAI;EAC3C,IAAI,CAAC,MAAM;GACT,OAAO,OAAO,WAAW,IAAI,MAAM,iBAAiB,QAAQ,OAAO,MAAM,CAAC,CAAC;EAC7E;EACA,MAAM,OAAQ,QAAQ,OAAO,aAAa,CAAC;EAC3C,IAAI;GACF,MAAM,SAAwB,MAAM,KAAK,QAAQ,MAAM,GAAG;GAC1D,OAAO,OAAO,aAAa,MAAM,CAAC;EACpC,SAAS,KAAK;GACZ,OAAO,OAAO,WAAW,GAAG,CAAC;EAC/B;CACF,CAAC;CAED,OAAO;AACT;;AAGA,OAAO,SAAS,cACd,KACA,KACA,UACa;CACb,IAAI,CAAC,KAAK;EACR,OAAO,CAAC,GAAG,QAAQ;CACrB;CACA,MAAM,QAAQ,IACX,MAAM,GAAG,CAAC,CACV,KAAK,MAAM,EAAE,KAAK,CAAC,CAAC,CACpB,QAAQ,MAAsB,IAAI,SAAS,CAAc,CAAC;CAC7D,OAAO,MAAM,SAAS,IAAI,QAAQ,CAAC,GAAG,QAAQ;AAChD","names":[],"sources":["../src/server.ts"],"version":3,"file":"server.js","sourceRoot":""}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vymalo/opencode-devtools-mcp",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.14.1",
|
|
4
4
|
"description": "MCP server for @vymalo/opencode-devtools — exposes the same local developer utilities (math, codec, crypto, datetime, convert, http) over the Model Context Protocol so any MCP client (Claude Code, Cursor, Cline, …) can call them. No bridge, no auth — pure deterministic compute.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "vymalo contributors",
|
|
@@ -47,14 +47,14 @@
|
|
|
47
47
|
},
|
|
48
48
|
"dependencies": {
|
|
49
49
|
"@modelcontextprotocol/sdk": "^1.29.0",
|
|
50
|
-
"@vymalo/opencode-devtools": "0.
|
|
50
|
+
"@vymalo/opencode-devtools": "0.14.1"
|
|
51
51
|
},
|
|
52
52
|
"devDependencies": {
|
|
53
|
-
"vite": "^8.
|
|
53
|
+
"vite": "^8.2.1",
|
|
54
54
|
"vitest": "^4.1.7"
|
|
55
55
|
},
|
|
56
56
|
"scripts": {
|
|
57
|
-
"build": "
|
|
57
|
+
"build": "node ../../scripts/build-package.mjs",
|
|
58
58
|
"lint": "biome lint .",
|
|
59
59
|
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
60
60
|
"test": "vitest run",
|