Conversation
|
🧪 Testing To try out this version of the SDK, run: Expires at: Wed, 11 Mar 2026 20:28:14 GMT |
e2f1f5a to
75460ab
Compare
75460ab to
5b23bcc
Compare
5b23bcc to
8174c95
Compare
8174c95 to
0659a21
Compare
0659a21 to
fab7b9d
Compare
fab7b9d to
778d927
Compare
778d927 to
990b768
Compare
990b768 to
1c2c521
Compare
Moves the code-mode execution to an endpoint in the Stainless API.
1c2c521 to
fc63120
Compare
fc63120 to
2b60546
Compare
2b60546 to
2c3af15
Compare
2c3af15 to
5c1e56b
Compare
Adds generated MCP server instructions, to help agents get easy tasks on the first try.
16e5b66 to
811e519
Compare
811e519 to
6818c49
Compare
| return null; | ||
| } | ||
| }): Promise<McpServer | null> => { | ||
| const server = await newMcpServer(); |
There was a problem hiding this comment.
Instructions fetched from remote API on every HTTP request
Medium Severity
In HTTP transport mode, newServer calls await newMcpServer() on every incoming POST request. newMcpServer now awaits getInstructions(), which makes an external HTTP fetch to the Stainless API. This adds a full network round-trip of latency to every single MCP tool invocation. The instructions are effectively static and don't change between requests, yet they're re-fetched each time. Previously, newMcpServer was synchronous and incurred no network overhead.
Additional Locations (1)
This comment has been minimized.
This comment has been minimized.
6818c49 to
a1f6ffe
Compare
…ssociated dependencies
a1f6ffe to
1e56388
Compare
1e56388 to
2c41bcf
Compare
2c41bcf to
fee0117
Compare
| `; | ||
|
|
||
| return instructions; | ||
| } |
There was a problem hiding this comment.
Network errors in instructions fetch crash the server
Medium Severity
getInstructions() gracefully handles HTTP error responses with a fallback (lines 33–44), indicating instructions are meant to be optional. However, the fetch call on line 24 has no try-catch, so a network-level error (DNS failure, timeout, connection refused) throws an unhandled exception that propagates up through newMcpServer. In stdio mode this prevents the server from starting at all; in HTTP mode every incoming request fails with a 500. Environments where the Stainless API is unreachable — air-gapped networks, corporate firewalls, or API outages — would be unable to use the MCP server despite the intended fallback.
This comment has been minimized.
This comment has been minimized.
fee0117 to
b61eef5
Compare
| : implementation.name.toLowerCase().includes('cursor') ? 'cursor' | ||
| : undefined; | ||
| mcpOptions.capabilities = { | ||
| ...(mcpOptions.client && knownClients[mcpOptions.client]), |
There was a problem hiding this comment.
Remote fetch on every HTTP request degrades performance
Medium Severity
newMcpServer() calls getInstructions() which makes a remote HTTP fetch to api.stainless.com on every invocation. In HTTP transport mode, newMcpServer() is called from newServer() on every single POST request. The old newMcpServer was synchronous and cheap. Now every MCP tool invocation in HTTP mode incurs an additional round-trip to a remote API for instructions that are essentially static, adding unnecessary latency to every request.
Additional Locations (1)
This comment has been minimized.
This comment has been minimized.
b61eef5 to
1eae9e5
Compare
1eae9e5 to
87e3c36
Compare
87e3c36 to
d99b35f
Compare
| } catch (error) { | ||
| res.status(400).json({ | ||
| jsonrpc: '2.0', | ||
| error: { |
There was a problem hiding this comment.
HTTP query options are no longer applied
Medium Severity
newServer now passes the default mcpOptions directly into initMcpServer and no longer parses request query params. Per-request URL options are silently ignored, so HTTP clients cannot override tool settings and invalid query options are never validated.
Additional Locations (1)
|
Bugbot Autofix prepared fixes for 1 of the 1 bugs found in the latest run.
Or push these changes by commenting: Preview (9788244317)diff --git a/packages/mcp-server/src/http.ts b/packages/mcp-server/src/http.ts
--- a/packages/mcp-server/src/http.ts
+++ b/packages/mcp-server/src/http.ts
@@ -6,13 +6,14 @@
import express from 'express';
import morgan from 'morgan';
import morganBody from 'morgan-body';
+import { fromError } from 'zod-validation-error/v3';
import { parseAuthHeaders } from './auth';
-import { McpOptions } from './options';
+import { McpOptions, parseQueryOptions } from './options';
import { initMcpServer, newMcpServer } from './server';
const newServer = async ({
clientOptions,
- mcpOptions,
+ mcpOptions: defaultMcpOptions,
req,
res,
}: {
@@ -23,7 +24,21 @@
}): Promise<McpServer | null> => {
const server = await newMcpServer();
+ let mcpOptions: McpOptions;
try {
+ mcpOptions = parseQueryOptions(defaultMcpOptions, req.query);
+ } catch (error) {
+ res.status(400).json({
+ jsonrpc: '2.0',
+ error: {
+ code: -32000,
+ message: `Invalid request: ${fromError(error)}`,
+ },
+ });
+ return null;
+ }
+
+ try {
const authOptions = parseAuthHeaders(req, false);
await initMcpServer({
server: server, |



Automated Release PR
0.1.0-alpha.10 (2026-02-13)
Full Changelog: v0.1.0-alpha.9...v0.1.0-alpha.10
⚠ BREAKING CHANGES
node /path/to/mcp/serverornpx package-namewill invoke code tools: changing your command to one of these is likely all you will need to do.Features
streamableHTTPApp(a033b07)Bug Fixes
jq_filterto base API (b41959f)Performance Improvements
Chores
actions/github-script(7ada191)compilerOptions.baseUrlfrom tsconfig.json (6e1f08a)actions/checkoutversion (76cea61)docs_searchtool at other URLs (efd6160)Documentation
Refactors
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