Skip to content

Commit 3e7f13d

Browse files
Merge pull request #22 from CASParser/release-please--branches--main--changes--next--components--cas-parser-node
release: 1.10.4
2 parents cd1cd45 + c3734c7 commit 3e7f13d

17 files changed

Lines changed: 1486 additions & 20 deletions

.github/workflows/publish-npm.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,14 @@ jobs:
3737
3838
- name: Publish to NPM
3939
run: |
40-
if [ -n "${{ github.event.inputs.path }}" ]; then
41-
PATHS_RELEASED='[\"${{ github.event.inputs.path }}\"]'
40+
if [ -n "$INPUT_PATH" ]; then
41+
PATHS_RELEASED="[\"$INPUT_PATH\"]"
4242
else
4343
PATHS_RELEASED='[\".\", \"packages/mcp-server\"]'
4444
fi
4545
pnpm tsn scripts/publish-packages.ts "{ \"paths_released\": \"$PATHS_RELEASED\" }"
46+
env:
47+
INPUT_PATH: ${{ github.event.inputs.path }}
4648

4749
- name: Upload MCP Server DXT GitHub release asset
4850
run: |

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,4 @@ dist-deno
1111
.eslintcache
1212
dist-bundle
1313
*.mcpb
14+
oidc

.release-please-manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
".": "1.10.3"
2+
".": "1.10.4"
33
}

.stats.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 21
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cas-parser%2Fcas-parser-d9763d006969b49a1473851069fdfa429eb13133b64103a62963bb70ddb22305.yml
3-
openapi_spec_hash: 6aee689b7a759b12c85c088c15e29bc0
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cas-parser%2Fcas-parser-d868ff00b7b07f6b6802b00f22fad531a91a76bb219a634f3f90fe488bd499ba.yml
3+
openapi_spec_hash: 20e9f2fc31feee78878cdf56e46dab60
44
config_hash: 5509bb7a961ae2e79114b24c381606d4

CHANGELOG.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,25 @@
11
# Changelog
22

3+
## 1.10.4 (2026-04-03)
4+
5+
Full Changelog: [v1.10.3...v1.10.4](https://github.com/CASParser/cas-parser-node/compare/v1.10.3...v1.10.4)
6+
7+
### Bug Fixes
8+
9+
* **internal:** gitignore generated `oidc` dir ([b1df6bc](https://github.com/CASParser/cas-parser-node/commit/b1df6bc1d207373ba90e1087250c4efc615b8ade))
10+
11+
12+
### Chores
13+
14+
* **ci:** escape input path in publish-npm workflow ([f795a47](https://github.com/CASParser/cas-parser-node/commit/f795a4790d772af4853ac232b9f23e1b325ea54c))
15+
* **internal:** codegen related update ([b032db4](https://github.com/CASParser/cas-parser-node/commit/b032db4ed25377b86ff33d36d6c9e38b9b486348))
16+
* **internal:** improve local docs search for MCP servers ([d83f66b](https://github.com/CASParser/cas-parser-node/commit/d83f66b9f8757aeb8023add6f1bba21e6e284475))
17+
* **internal:** improve local docs search for MCP servers ([8def340](https://github.com/CASParser/cas-parser-node/commit/8def34059bbf2620e2e85b115948e47e4fe6cfca))
18+
* **internal:** support local docs search in MCP servers ([e90f399](https://github.com/CASParser/cas-parser-node/commit/e90f399089d7e5cadd0892126834455ca6617ed4))
19+
* **internal:** support type annotations when running MCP in local execution mode ([8c230cf](https://github.com/CASParser/cas-parser-node/commit/8c230cfd7fdd9068a8475f239fc0cdaff329987d))
20+
* **mcp-server:** add support for session id, forward client info ([9908707](https://github.com/CASParser/cas-parser-node/commit/9908707d2c43b2ad1bf4ead7613ea952319587ff))
21+
* **mcp-server:** log client info ([a6f08fa](https://github.com/CASParser/cas-parser-node/commit/a6f08fa3e605b5c63d0a40aac854ef924cccaea2))
22+
323
## 1.10.3 (2026-03-27)
424

525
Full Changelog: [v1.10.2...v1.10.3](https://github.com/CASParser/cas-parser-node/compare/v1.10.2...v1.10.3)

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "cas-parser-node",
3-
"version": "1.10.3",
3+
"version": "1.10.4",
44
"description": "The official TypeScript library for the Cas Parser API",
55
"author": "Cas Parser <sameer@casparser.in>",
66
"types": "dist/index.d.ts",

packages/mcp-server/manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"dxt_version": "0.2",
33
"name": "cas-parser-node-mcp",
4-
"version": "1.10.3",
4+
"version": "1.10.4",
55
"description": "The official MCP Server for the Cas Parser API",
66
"author": {
77
"name": "Cas Parser",

packages/mcp-server/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "cas-parser-node-mcp",
3-
"version": "1.10.3",
3+
"version": "1.10.4",
44
"description": "The official MCP Server for the Cas Parser API",
55
"author": "Cas Parser <sameer@casparser.in>",
66
"types": "dist/index.d.ts",
@@ -40,6 +40,7 @@
4040
"cors": "^2.8.5",
4141
"express": "^5.1.0",
4242
"fuse.js": "^7.1.0",
43+
"minisearch": "^7.2.0",
4344
"jq-web": "https://github.com/stainless-api/jq-web/releases/download/v0.8.8/jq-web.tar.gz",
4445
"pino": "^10.3.1",
4546
"pino-http": "^11.0.0",

packages/mcp-server/src/code-tool-worker.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ import ts from 'typescript';
77
import { WorkerOutput } from './code-tool-types';
88
import { CasParser, ClientOptions } from 'cas-parser-node';
99

10+
async function tseval(code: string) {
11+
return import('data:application/typescript;charset=utf-8;base64,' + Buffer.from(code).toString('base64'));
12+
}
13+
1014
function getRunFunctionSource(code: string): {
1115
type: 'declaration' | 'expression';
1216
client: string | undefined;
@@ -257,7 +261,9 @@ const fetch = async (req: Request): Promise<Response> => {
257261

258262
const log_lines: string[] = [];
259263
const err_lines: string[] = [];
260-
const console = {
264+
const originalConsole = globalThis.console;
265+
globalThis.console = {
266+
...originalConsole,
261267
log: (...args: unknown[]) => {
262268
log_lines.push(util.format(...args));
263269
},
@@ -267,7 +273,7 @@ const fetch = async (req: Request): Promise<Response> => {
267273
};
268274
try {
269275
let run_ = async (client: any) => {};
270-
eval(`${code}\nrun_ = run;`);
276+
run_ = (await tseval(`${code}\nexport default run;`)).default;
271277
const result = await run_(makeSdkProxy(client, { path: ['client'] }));
272278
return Response.json({
273279
is_error: false,
@@ -285,6 +291,8 @@ const fetch = async (req: Request): Promise<Response> => {
285291
} satisfies WorkerOutput,
286292
{ status: 400, statusText: 'Code execution error' },
287293
);
294+
} finally {
295+
globalThis.console = originalConsole;
288296
}
289297
};
290298

packages/mcp-server/src/docs-search-tool.ts

Lines changed: 46 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import { Tool } from '@modelcontextprotocol/sdk/types.js';
44
import { Metadata, McpRequestContext, asTextContentResult } from './types';
55
import { getLogger } from './logger';
6+
import type { LocalDocsSearch } from './local-docs-search';
67

78
export const metadata: Metadata = {
89
resource: 'all',
@@ -43,20 +44,41 @@ export const tool: Tool = {
4344
const docsSearchURL =
4445
process.env['DOCS_SEARCH_URL'] || 'https://api.stainless.com/api/projects/cas-parser/docs/search';
4546

46-
export const handler = async ({
47-
reqContext,
48-
args,
49-
}: {
50-
reqContext: McpRequestContext;
51-
args: Record<string, unknown> | undefined;
52-
}) => {
47+
let _localSearch: LocalDocsSearch | undefined;
48+
49+
export function setLocalSearch(search: LocalDocsSearch): void {
50+
_localSearch = search;
51+
}
52+
53+
async function searchLocal(args: Record<string, unknown>): Promise<unknown> {
54+
if (!_localSearch) {
55+
throw new Error('Local search not initialized');
56+
}
57+
58+
const query = (args['query'] as string) ?? '';
59+
const language = (args['language'] as string) ?? 'typescript';
60+
const detail = (args['detail'] as string) ?? 'default';
61+
62+
return _localSearch.search({
63+
query,
64+
language,
65+
detail,
66+
maxResults: 5,
67+
}).results;
68+
}
69+
70+
async function searchRemote(args: Record<string, unknown>, reqContext: McpRequestContext): Promise<unknown> {
5371
const body = args as any;
5472
const query = new URLSearchParams(body).toString();
5573

5674
const startTime = Date.now();
5775
const result = await fetch(`${docsSearchURL}?${query}`, {
5876
headers: {
5977
...(reqContext.stainlessApiKey && { Authorization: reqContext.stainlessApiKey }),
78+
...(reqContext.mcpSessionId && { 'x-stainless-mcp-session-id': reqContext.mcpSessionId }),
79+
...(reqContext.mcpClientInfo && {
80+
'x-stainless-mcp-client-info': JSON.stringify(reqContext.mcpClientInfo),
81+
}),
6082
},
6183
});
6284

@@ -94,7 +116,23 @@ export const handler = async ({
94116
},
95117
'Got docs search result',
96118
);
97-
return asTextContentResult(resultBody);
119+
return resultBody;
120+
}
121+
122+
export const handler = async ({
123+
reqContext,
124+
args,
125+
}: {
126+
reqContext: McpRequestContext;
127+
args: Record<string, unknown> | undefined;
128+
}) => {
129+
const body = args ?? {};
130+
131+
if (_localSearch) {
132+
return asTextContentResult(await searchLocal(body));
133+
}
134+
135+
return asTextContentResult(await searchRemote(body, reqContext));
98136
};
99137

100138
export default { metadata, tool, handler };

0 commit comments

Comments
 (0)