Skip to content

Commit cd1cd45

Browse files
Merge pull request #21 from CASParser/release-please--branches--main--changes--next--components--cas-parser-node
release: 1.10.3
2 parents 940d8bd + a48c6a3 commit cd1cd45

14 files changed

Lines changed: 74 additions & 25 deletions

File tree

.github/workflows/ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
timeout-minutes: 10
2020
name: lint
2121
runs-on: ${{ github.repository == 'stainless-sdks/cas-parser-typescript' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }}
22-
if: github.event_name == 'push' || github.event.pull_request.head.repo.fork
22+
if: (github.event_name == 'push' || github.event.pull_request.head.repo.fork) && (github.event_name != 'push' || github.event.head_commit.message != 'codegen metadata')
2323
steps:
2424
- uses: actions/checkout@v6
2525

@@ -43,7 +43,7 @@ jobs:
4343
timeout-minutes: 5
4444
name: build
4545
runs-on: ${{ github.repository == 'stainless-sdks/cas-parser-typescript' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }}
46-
if: github.event_name == 'push' || github.event.pull_request.head.repo.fork
46+
if: (github.event_name == 'push' || github.event.pull_request.head.repo.fork) && (github.event_name != 'push' || github.event.head_commit.message != 'codegen metadata')
4747
permissions:
4848
contents: read
4949
id-token: write

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
.prism.log
2+
.stdy.log
23
node_modules
34
yarn-error.log
45
codegen.log

.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.2"
2+
".": "1.10.3"
33
}

CHANGELOG.md

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

3+
## 1.10.3 (2026-03-27)
4+
5+
Full Changelog: [v1.10.2...v1.10.3](https://github.com/CASParser/cas-parser-node/compare/v1.10.2...v1.10.3)
6+
7+
### Chores
8+
9+
* **ci:** skip lint on metadata-only changes ([c586cc0](https://github.com/CASParser/cas-parser-node/commit/c586cc0ec3026afa1ebce62cd27df64c9324745d))
10+
* **internal:** fix MCP server TS errors that occur with required client options ([a284756](https://github.com/CASParser/cas-parser-node/commit/a284756cb83eb774ab2483a1581b7b180e474f94))
11+
* **internal:** support custom-instructions-path flag in MCP servers ([8089550](https://github.com/CASParser/cas-parser-node/commit/8089550962d4a008a8a39f6662576f792da4221a))
12+
* **internal:** update gitignore ([c3d5073](https://github.com/CASParser/cas-parser-node/commit/c3d50737ff158aa5dd43743005fb68ee23a7ea05))
13+
314
## 1.10.2 (2026-03-17)
415

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

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.2",
3+
"version": "1.10.3",
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.2",
4+
"version": "1.10.3",
55
"description": "The official MCP Server for the Cas Parser API",
66
"author": {
77
"name": "Cas Parser",

packages/mcp-server/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-mcp",
3-
"version": "1.10.2",
3+
"version": "1.10.3",
44
"description": "The official MCP Server for the Cas Parser API",
55
"author": "Cas Parser <sameer@casparser.in>",
66
"types": "dist/index.d.ts",

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

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -285,15 +285,13 @@ const localDenoHandler = async ({
285285

286286
// Strip null/undefined values so that the worker SDK client can fall back to
287287
// reading from environment variables (including any upstreamClientEnvs).
288-
const opts: ClientOptions = Object.fromEntries(
289-
Object.entries({
290-
baseURL: client.baseURL,
291-
apiKey: client.apiKey,
292-
defaultHeaders: {
293-
'X-Stainless-MCP': 'true',
294-
},
295-
}).filter(([_, v]) => v != null),
296-
) as ClientOptions;
288+
const opts = {
289+
...(client.baseURL != null ? { baseURL: client.baseURL } : undefined),
290+
...(client.apiKey != null ? { apiKey: client.apiKey } : undefined),
291+
defaultHeaders: {
292+
'X-Stainless-MCP': 'true',
293+
},
294+
} satisfies Partial<ClientOptions> as ClientOptions;
297295

298296
const req = worker.request(
299297
'http://localhost',

packages/mcp-server/src/http.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@ const newServer = async ({
2323
res: express.Response;
2424
}): Promise<McpServer | null> => {
2525
const stainlessApiKey = getStainlessApiKey(req, mcpOptions);
26-
const server = await newMcpServer(stainlessApiKey);
26+
const customInstructionsPath = mcpOptions.customInstructionsPath;
27+
const server = await newMcpServer({ stainlessApiKey, customInstructionsPath });
2728

2829
const authOptions = parseClientAuthHeaders(req, false);
2930

packages/mcp-server/src/instructions.ts

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
22

3+
import fs from 'fs/promises';
34
import { readEnv } from './util';
45
import { getLogger } from './logger';
56

@@ -12,9 +13,15 @@ interface InstructionsCacheEntry {
1213

1314
const instructionsCache = new Map<string, InstructionsCacheEntry>();
1415

15-
export async function getInstructions(stainlessApiKey: string | undefined): Promise<string> {
16+
export async function getInstructions({
17+
stainlessApiKey,
18+
customInstructionsPath,
19+
}: {
20+
stainlessApiKey?: string | undefined;
21+
customInstructionsPath?: string | undefined;
22+
}): Promise<string> {
1623
const now = Date.now();
17-
const cacheKey = stainlessApiKey ?? '';
24+
const cacheKey = customInstructionsPath ?? stainlessApiKey ?? '';
1825
const cached = instructionsCache.get(cacheKey);
1926

2027
if (cached && now - cached.fetchedAt <= INSTRUCTIONS_CACHE_TTL_MS) {
@@ -28,12 +35,28 @@ export async function getInstructions(stainlessApiKey: string | undefined): Prom
2835
}
2936
}
3037

31-
const fetchedInstructions = await fetchLatestInstructions(stainlessApiKey);
38+
let fetchedInstructions: string;
39+
40+
if (customInstructionsPath) {
41+
fetchedInstructions = await fetchLatestInstructionsFromFile(customInstructionsPath);
42+
} else {
43+
fetchedInstructions = await fetchLatestInstructionsFromApi(stainlessApiKey);
44+
}
45+
3246
instructionsCache.set(cacheKey, { fetchedInstructions, fetchedAt: now });
3347
return fetchedInstructions;
3448
}
3549

36-
async function fetchLatestInstructions(stainlessApiKey: string | undefined): Promise<string> {
50+
async function fetchLatestInstructionsFromFile(path: string): Promise<string> {
51+
try {
52+
return await fs.readFile(path, 'utf-8');
53+
} catch (error) {
54+
getLogger().error({ error, path }, 'Error fetching instructions from file');
55+
throw error;
56+
}
57+
}
58+
59+
async function fetchLatestInstructionsFromApi(stainlessApiKey: string | undefined): Promise<string> {
3760
// Setting the stainless API key is optional, but may be required
3861
// to authenticate requests to the Stainless API.
3962
const response = await fetch(

0 commit comments

Comments
 (0)