Skip to content

Commit 7ed3d1a

Browse files
Update Desktop API Stainless config
1 parent 3145ba8 commit 7ed3d1a

2 files changed

Lines changed: 3 additions & 42 deletions

File tree

.stats.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 72
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/beeper/beeper-desktop-api-81a39fdda33b337c5047b92f24bb2216150cba5507f9b66d3ef6a324e2b08e92.yml
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/beeper/beeper-desktop-api-8ba2755730c4180ec88f92a300948445d7917898abfc912ca3fa6adc766a7520.yml
33
openapi_spec_hash: 30b435d7585d8b6951610e7147369779
4-
config_hash: 6b409dea8089a8bfc72ed9919dc1d0bb
4+
config_hash: a53888715ed00d433e5a5dafab9f7b9f

packages/mcp-server/src/http.ts

Lines changed: 1 addition & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp';
44
import { StreamableHTTPServerTransport } from '@modelcontextprotocol/sdk/server/streamableHttp.js';
55
import { ClientOptions } from '@beeper/desktop-api';
6-
import cors from 'cors';
76
import express from 'express';
87
import pino from 'pino';
98
import pinoHttp from 'pino-http';
@@ -12,11 +11,6 @@ import { getLogger } from './logger';
1211
import { McpOptions } from './options';
1312
import { initMcpServer, newMcpServer } from './server';
1413

15-
const oauthResourceIdentifier = (req: express.Request): string => {
16-
const protocol = req.headers['x-forwarded-proto'] ?? req.protocol;
17-
return `${protocol}://${req.get('host')}/`;
18-
};
19-
2014
const newServer = async ({
2115
clientOptions,
2216
mcpOptions,
@@ -32,28 +26,7 @@ const newServer = async ({
3226
const customInstructionsPath = mcpOptions.customInstructionsPath;
3327
const server = await newMcpServer({ stainlessApiKey, customInstructionsPath });
3428

35-
// parseClientAuthHeaders throws if the Authorization header uses an unsupported
36-
// scheme, or (when the second arg is true) if the header is missing entirely.
37-
// On error, we return 401 with WWW-Authenticate pointing to the OAuth metadata
38-
// endpoint so clients know how to authenticate (RFC 9728).
39-
let authOptions: Partial<ClientOptions>;
40-
try {
41-
authOptions = parseClientAuthHeaders(req, true);
42-
} catch (error) {
43-
const resourceIdentifier = oauthResourceIdentifier(req);
44-
res.set(
45-
'WWW-Authenticate',
46-
`Bearer resource_metadata="${resourceIdentifier}.well-known/oauth-protected-resource"`,
47-
);
48-
res.status(401).json({
49-
jsonrpc: '2.0',
50-
error: {
51-
code: -32000,
52-
message: `Unauthorized: ${error instanceof Error ? error.message : error}`,
53-
},
54-
});
55-
return null;
56-
}
29+
const authOptions = parseClientAuthHeaders(req, true);
5730

5831
let upstreamClientEnvs: Record<string, string> | undefined;
5932
const clientEnvsHeader = req.headers['x-stainless-mcp-client-envs'];
@@ -152,16 +125,6 @@ const del = async (req: express.Request, res: express.Response) => {
152125
});
153126
};
154127

155-
const oauthMetadata = (req: express.Request, res: express.Response) => {
156-
const resourceIdentifier = oauthResourceIdentifier(req);
157-
res.json({
158-
resource: resourceIdentifier,
159-
authorization_servers: ['http://localhost:23373'],
160-
bearer_methods_supported: ['header'],
161-
scopes_supported: 'read write',
162-
});
163-
};
164-
165128
const redactHeaders = (headers: Record<string, any>) => {
166129
const hiddenHeaders = /auth|cookie|key|token|x-stainless-mcp-client-envs/i;
167130
const filtered = { ...headers };
@@ -231,8 +194,6 @@ export const streamableHTTPApp = ({
231194
}),
232195
);
233196

234-
app.get('/.well-known/oauth-protected-resource', cors(), oauthMetadata);
235-
236197
app.get('/health', async (req: express.Request, res: express.Response) => {
237198
res.status(200).send('OK');
238199
});

0 commit comments

Comments
 (0)