Skip to content

Commit 8e10b27

Browse files
chore(mcp): forward STAINLESS_API_KEY to docs search endpoint
1 parent 060795b commit 8e10b27

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

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

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

33
import { Metadata, asTextContentResult } from './types';
4+
import { readEnv } from './server';
45

56
import { Tool } from '@modelcontextprotocol/sdk/types.js';
67

@@ -45,7 +46,12 @@ const docsSearchURL =
4546
export const handler = async (_: unknown, args: Record<string, unknown> | undefined) => {
4647
const body = args as any;
4748
const query = new URLSearchParams(body).toString();
48-
const result = await fetch(`${docsSearchURL}?${query}`);
49+
const stainlessAPIKey = readEnv('STAINLESS_API_KEY');
50+
const result = await fetch(`${docsSearchURL}?${query}`, {
51+
headers: {
52+
...(stainlessAPIKey && { Authorization: stainlessAPIKey }),
53+
},
54+
});
4955

5056
if (!result.ok) {
5157
throw new Error(

0 commit comments

Comments
 (0)