Skip to content

release: 0.33.0#84

Open
stainless-app[bot] wants to merge 8 commits intomainfrom
release-please--branches--main--changes--next--components--hyperspell
Open

release: 0.33.0#84
stainless-app[bot] wants to merge 8 commits intomainfrom
release-please--branches--main--changes--next--components--hyperspell

Conversation

@stainless-app
Copy link
Contributor

@stainless-app stainless-app bot commented Mar 3, 2026

Automated Release PR

0.33.0 (2026-03-07)

Full Changelog: v0.32.1...v0.33.0

Features

Chores

  • internal: codegen related update (c49250c)
  • internal: codegen related update (e7684c4)
  • internal: use x-stainless-mcp-client-envs header for MCP remote code tool calls (f8b4ea0)
  • mcp-server: return access instructions for 404 without API key (2750b02)
  • test: do not count install time for mock server timeout (1d19a8e)

This pull request is managed by Stainless's GitHub App.

The semver version number is based on included commit messages. Alternatively, you can manually set the version number in the title of this pull request.

For a better experience, it is recommended to use either rebase-merge or squash-merge when merging this pull request.

🔗 Stainless website
📚 Read the docs
🙋 Reach out for help or questions

@stainless-app
Copy link
Contributor Author

stainless-app bot commented Mar 3, 2026

🧪 Testing

To try out this version of the SDK:

npm install 'https://pkg.stainless.com/s/hyperspell-typescript/1d19a8e8ca7be9782a217c28f12c0329931a725d/dist.tar.gz'

Expires at: Mon, 06 Apr 2026 05:53:05 GMT
Updated at: Sat, 07 Mar 2026 05:53:05 GMT

@stainless-app stainless-app bot force-pushed the release-please--branches--main--changes--next--components--hyperspell branch from c7e6122 to 2505acc Compare March 4, 2026 06:39
Comment on lines +115 to +123
...req,
headers: redactHeaders(req.raw.headers),
};
}),
res: pino.stdSerializers.wrapResponseSerializer((res) => {
return {
...res,
headers: redactHeaders(res.headers),
};

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correctness: ⚠️ req.raw is undefined on the serialized request object, so req.raw.headers will throw a TypeError at runtime. Additionally, res.headers is not a property of the serialized response object. Use req.headers (which is already available) and access the raw response object to call getHeaders() for response redaction. 🛡️

🤖 AI Agent Prompt for Cursor/Windsurf

📋 Copy this prompt to your AI coding assistant (Cursor, Windsurf, etc.) to get help fixing this issue

In `packages/mcp-server/src/http.ts` around the pino serializers, replace direct access to `req.raw.headers` and `res.headers` with safe fallbacks (e.g., `req.raw?.headers ?? req.headers ?? {}` and `res.getHeaders?.() ?? res.headers ?? {}`) so `redactHeaders` never receives `undefined`.

@stainless-app stainless-app bot force-pushed the release-please--branches--main--changes--next--components--hyperspell branch from 2505acc to 6435522 Compare March 4, 2026 07:03
@stainless-app stainless-app bot force-pushed the release-please--branches--main--changes--next--components--hyperspell branch from 6435522 to 81ac8ff Compare March 5, 2026 05:46
@stainless-app stainless-app bot force-pushed the release-please--branches--main--changes--next--components--hyperspell branch from 81ac8ff to 0903fca Compare March 6, 2026 01:28
Comment on lines +69 to +92
query: body.query,
status: result.status,
statusText: result.statusText,
errorText,
},
'Got error response from docs search tool',
);

if (result.status === 404 && !reqContext.stainlessApiKey) {
throw new Error(
'Could not find docs for this project. You may need to provide a Stainless API key via the STAINLESS_API_KEY environment variable, the --stainless-api-key flag, or the x-stainless-api-key HTTP header.',
);
}

throw new Error(
`${result.status}: ${result.statusText} when using doc search tool. Details: ${await result.text()}`,
`${result.status}: ${result.statusText} when using doc search tool. Details: ${errorText}`,
);
}

return asTextContentResult(await result.json());
const resultBody = await result.json();
logger.info(
{
durationMs: Date.now() - startTime,
query: body.query,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correctness: 🚫 args can be undefined per the handler signature, so body.query will throw during logging. Use optional chaining or a default to avoid crashing the handler just for telemetry.

🤖 AI Agent Prompt for Cursor/Windsurf

📋 Copy this prompt to your AI coding assistant (Cursor, Windsurf, etc.) to get help fixing this issue

File: packages/mcp-server/src/docs-search-tool.ts. Lines 69-92. The new logging accesses body.query, but args can be undefined, causing a runtime error. Update both logger.warn and logger.info payloads to use optional chaining (body?.query) or a safe default so logging does not throw when args is missing.

Comment on lines 4 to 13
import { StreamableHTTPServerTransport } from '@modelcontextprotocol/sdk/server/streamableHttp.js';
import { ClientOptions } from 'hyperspell';
import express from 'express';
import morgan from 'morgan';
import morganBody from 'morgan-body';
import pino from 'pino';
import pinoHttp from 'pino-http';
import { getStainlessApiKey, parseClientAuthHeaders } from './auth';
import { getLogger } from './logger';
import { McpOptions } from './options';
import { initMcpServer, newMcpServer } from './server';

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correctness: The introduction of getLogger() in streamableHTTPApp and launchStreamableHTTPServer will cause a runtime crash. The getLogger() implementation in logger.ts is designed to throw an error if _logger is not initialized via configureLogger(). Since launchStreamableHTTPServer does not invoke configureLogger() before calling streamableHTTPApp, the server will fail to start. You must ensure the logger is configured at the start of the server lifecycle or provide a default logger instance.

@stainless-app stainless-app bot force-pushed the release-please--branches--main--changes--next--components--hyperspell branch from 0903fca to 23dbf39 Compare March 7, 2026 05:36
@stainless-app stainless-app bot force-pushed the release-please--branches--main--changes--next--components--hyperspell branch from 23dbf39 to 423c7ed Compare March 7, 2026 05:52
});

const logger = getLogger();

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correctness: Calling getLogger() introduces a reliability regression. Since getLogger() throws an error if the logger is not configured, this handler will now crash in environments where logging is not initialized, whereas it previously functioned correctly. Guard the logger call or provide a fallback to ensure the tool remains functional regardless of the logging state.

🤖 AI Agent Prompt for Cursor/Windsurf

📋 Copy this prompt to your AI coding assistant (Cursor, Windsurf, etc.) to get help fixing this issue

In packages/mcp-server/src/docs-search-tool.ts around the new logging additions (line ~63), guard getLogger() so the handler doesn’t throw if logging isn’t configured. Wrap getLogger() in try/catch and make logging calls optional (logger?.info/warn) or ensure configuration occurs before this handler runs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants