@codeqr/ts-mcp 0.24.1 → 0.25.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 +1 -1
- package/README.md +14 -5
- package/code-tool-worker.js +4 -4
- package/code-tool-worker.mjs +5 -5
- package/code-tool.js +1 -1
- package/code-tool.mjs +1 -1
- package/local-docs-search.d.mts.map +1 -1
- package/local-docs-search.d.ts.map +1 -1
- package/local-docs-search.js +79 -70
- package/local-docs-search.js.map +1 -1
- package/local-docs-search.mjs +79 -70
- package/local-docs-search.mjs.map +1 -1
- package/methods.js +30 -30
- package/methods.js.map +1 -1
- package/methods.mjs +30 -30
- package/methods.mjs.map +1 -1
- package/package.json +2 -2
- package/server.js +1 -1
- package/server.mjs +3 -3
- package/src/code-tool-worker.ts +5 -5
- package/src/code-tool.ts +1 -1
- package/src/local-docs-search.ts +79 -70
- package/src/methods.ts +30 -30
- package/src/server.ts +6 -6
- package/src/types.ts +2 -2
- package/types.d.mts +2 -2
- package/types.d.ts +2 -2
package/LICENSE
CHANGED
|
@@ -186,7 +186,7 @@
|
|
|
186
186
|
same "printed page" as the copyright notice for easier
|
|
187
187
|
identification within third-party archives.
|
|
188
188
|
|
|
189
|
-
Copyright 2026
|
|
189
|
+
Copyright 2026 CodeQR
|
|
190
190
|
|
|
191
191
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
192
|
you may not use this file except in compliance with the License.
|
package/README.md
CHANGED
|
@@ -60,20 +60,29 @@ claude mcp add codeqr_ts_mcp_api --env CODEQR_API_KEY="My API Key" -- npx -y @co
|
|
|
60
60
|
## Code Mode
|
|
61
61
|
|
|
62
62
|
This MCP server is built on the "Code Mode" tool scheme. In this MCP Server,
|
|
63
|
-
your agent will write code against the TypeScript SDK, which will then be executed in
|
|
64
|
-
|
|
63
|
+
your agent will write code against the TypeScript SDK, which will then be executed in a
|
|
64
|
+
sandbox. To accomplish this, the server will expose two tools to your agent:
|
|
65
65
|
|
|
66
66
|
- The first tool is a docs search tool, which can be used to generically query for
|
|
67
67
|
documentation about your API/SDK.
|
|
68
68
|
|
|
69
69
|
- The second tool is a code tool, where the agent can write code against the TypeScript SDK.
|
|
70
|
-
The code
|
|
71
|
-
|
|
72
|
-
tool call.
|
|
70
|
+
The code is executed in a sandbox whose filesystem and network access are restricted to
|
|
71
|
+
what the SDK needs — see "Where code runs" below. Then, anything the code returns or
|
|
72
|
+
prints will be returned to the agent as the result of the tool call.
|
|
73
73
|
|
|
74
74
|
Using this scheme, agents are capable of performing very complex tasks deterministically
|
|
75
75
|
and repeatably.
|
|
76
76
|
|
|
77
|
+
### Where code runs
|
|
78
|
+
|
|
79
|
+
This server runs code locally. Each code tool call is executed in a Deno subprocess on the
|
|
80
|
+
same machine as the MCP server, restricted to reading the server's own files and to making
|
|
81
|
+
network requests to your API host.
|
|
82
|
+
|
|
83
|
+
Deno must be installed for the code tool to work. Install it from https://deno.land, or add it
|
|
84
|
+
to the MCP server's dependencies with `npm install deno`.
|
|
85
|
+
|
|
77
86
|
## Running remotely
|
|
78
87
|
|
|
79
88
|
Launching the client with `--transport=http` launches the server as a remote server using Streamable HTTP transport. The `--port` setting can choose the port it will run on, and the `--socket` setting allows it to run on a Unix socket.
|
package/code-tool-worker.js
CHANGED
|
@@ -81,10 +81,10 @@ function getRunFunctionSource(code) {
|
|
|
81
81
|
function getTSDiagnostics(code) {
|
|
82
82
|
const functionSource = getRunFunctionSource(code);
|
|
83
83
|
const codeWithImport = [
|
|
84
|
-
'import {
|
|
84
|
+
'import { CodeQR } from "@codeqr/ts";',
|
|
85
85
|
functionSource.type === 'declaration' ?
|
|
86
|
-
`async function run(${functionSource.client}:
|
|
87
|
-
: `const run: (${functionSource.client}:
|
|
86
|
+
`async function run(${functionSource.client}: CodeQR)`
|
|
87
|
+
: `const run: (${functionSource.client}: CodeQR) => Promise<unknown> =`,
|
|
88
88
|
functionSource.code,
|
|
89
89
|
].join('\n');
|
|
90
90
|
const sourcePath = node_path_1.default.resolve('code.ts');
|
|
@@ -249,7 +249,7 @@ const fetch = async (req) => {
|
|
|
249
249
|
err_lines: [],
|
|
250
250
|
}, { status: 400, statusText: 'Code execution error' });
|
|
251
251
|
}
|
|
252
|
-
const client = new ts_1.
|
|
252
|
+
const client = new ts_1.CodeQR({
|
|
253
253
|
...opts,
|
|
254
254
|
});
|
|
255
255
|
const log_lines = [];
|
package/code-tool-worker.mjs
CHANGED
|
@@ -3,7 +3,7 @@ import path from 'node:path';
|
|
|
3
3
|
import util from 'node:util';
|
|
4
4
|
import Fuse from 'fuse.js';
|
|
5
5
|
import ts from 'typescript';
|
|
6
|
-
import {
|
|
6
|
+
import { CodeQR } from '@codeqr/ts';
|
|
7
7
|
async function tseval(code) {
|
|
8
8
|
return import('data:application/typescript;charset=utf-8;base64,' + Buffer.from(code).toString('base64'));
|
|
9
9
|
}
|
|
@@ -43,10 +43,10 @@ function getRunFunctionSource(code) {
|
|
|
43
43
|
function getTSDiagnostics(code) {
|
|
44
44
|
const functionSource = getRunFunctionSource(code);
|
|
45
45
|
const codeWithImport = [
|
|
46
|
-
'import {
|
|
46
|
+
'import { CodeQR } from "@codeqr/ts";',
|
|
47
47
|
functionSource.type === 'declaration' ?
|
|
48
|
-
`async function run(${functionSource.client}:
|
|
49
|
-
: `const run: (${functionSource.client}:
|
|
48
|
+
`async function run(${functionSource.client}: CodeQR)`
|
|
49
|
+
: `const run: (${functionSource.client}: CodeQR) => Promise<unknown> =`,
|
|
50
50
|
functionSource.code,
|
|
51
51
|
].join('\n');
|
|
52
52
|
const sourcePath = path.resolve('code.ts');
|
|
@@ -211,7 +211,7 @@ const fetch = async (req) => {
|
|
|
211
211
|
err_lines: [],
|
|
212
212
|
}, { status: 400, statusText: 'Code execution error' });
|
|
213
213
|
}
|
|
214
|
-
const client = new
|
|
214
|
+
const client = new CodeQR({
|
|
215
215
|
...opts,
|
|
216
216
|
});
|
|
217
217
|
const log_lines = [];
|
package/code-tool.js
CHANGED
|
@@ -37,7 +37,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
37
37
|
exports.codeTool = codeTool;
|
|
38
38
|
const types_1 = require("./types.js");
|
|
39
39
|
const logger_1 = require("./logger.js");
|
|
40
|
-
const prompt = `Runs JavaScript code to interact with the
|
|
40
|
+
const prompt = `Runs JavaScript code to interact with the CodeQR API.
|
|
41
41
|
|
|
42
42
|
You are a skilled TypeScript programmer writing code to interface with the service.
|
|
43
43
|
Define an async function named "run" that takes a single parameter of an initialized SDK client and it will be run.
|
package/code-tool.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
2
|
import { asErrorResult } from "./types.mjs";
|
|
3
3
|
import { getLogger } from "./logger.mjs";
|
|
4
|
-
const prompt = `Runs JavaScript code to interact with the
|
|
4
|
+
const prompt = `Runs JavaScript code to interact with the CodeQR API.
|
|
5
5
|
|
|
6
6
|
You are a skilled TypeScript programmer writing code to interface with the service.
|
|
7
7
|
Define an async function named "run" that takes a single parameter of an initialized SDK client and it will be run.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"local-docs-search.d.mts","sourceRoot":"","sources":["src/local-docs-search.ts"],"names":[],"mappings":"AA+CA,KAAK,YAAY,GAAG;IAClB,OAAO,EAAE,CAAC,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,EAAE,CAAC;CAC/C,CAAC;
|
|
1
|
+
{"version":3,"file":"local-docs-search.d.mts","sourceRoot":"","sources":["src/local-docs-search.ts"],"names":[],"mappings":"AA+CA,KAAK,YAAY,GAAG;IAClB,OAAO,EAAE,CAAC,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,EAAE,CAAC;CAC/C,CAAC;AAyjCF;;;;GAIG;AACH,qBAAa,eAAe;IAC1B,OAAO,CAAC,WAAW,CAAiC;IACpD,OAAO,CAAC,UAAU,CAAiC;IAEnD,OAAO;WAKM,MAAM,CAAC,IAAI,CAAC,EAAE;QAAE,OAAO,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,eAAe,CAAC;IAY1E,MAAM,CAAC,KAAK,EAAE;QACZ,KAAK,EAAE,MAAM,CAAC;QACd,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,SAAS,CAAC,EAAE,MAAM,CAAC;KACpB,GAAG,YAAY;IA2EhB,OAAO,CAAC,YAAY;YAiBN,iBAAiB;IA4C/B,OAAO,CAAC,UAAU;CAgBnB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"local-docs-search.d.ts","sourceRoot":"","sources":["src/local-docs-search.ts"],"names":[],"mappings":"AA+CA,KAAK,YAAY,GAAG;IAClB,OAAO,EAAE,CAAC,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,EAAE,CAAC;CAC/C,CAAC;
|
|
1
|
+
{"version":3,"file":"local-docs-search.d.ts","sourceRoot":"","sources":["src/local-docs-search.ts"],"names":[],"mappings":"AA+CA,KAAK,YAAY,GAAG;IAClB,OAAO,EAAE,CAAC,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,EAAE,CAAC;CAC/C,CAAC;AAyjCF;;;;GAIG;AACH,qBAAa,eAAe;IAC1B,OAAO,CAAC,WAAW,CAAiC;IACpD,OAAO,CAAC,UAAU,CAAiC;IAEnD,OAAO;WAKM,MAAM,CAAC,IAAI,CAAC,EAAE;QAAE,OAAO,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,eAAe,CAAC;IAY1E,MAAM,CAAC,KAAK,EAAE;QACZ,KAAK,EAAE,MAAM,CAAC;QACd,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,SAAS,CAAC,EAAE,MAAM,CAAC;KACpB,GAAG,YAAY;IA2EhB,OAAO,CAAC,YAAY;YAiBN,iBAAiB;IA4C/B,OAAO,CAAC,UAAU;CAgBnB"}
|