File tree Expand file tree Collapse file tree 4 files changed +14
-3
lines changed
Expand file tree Collapse file tree 4 files changed +14
-3
lines changed Original file line number Diff line number Diff line change @@ -11,10 +11,12 @@ import { parseAuthHeaders } from './headers';
1111
1212const newServer = async ( {
1313 clientOptions,
14+ mcpOptions,
1415 req,
1516 res,
1617} : {
1718 clientOptions : ClientOptions ;
19+ mcpOptions : McpOptions ;
1820 req : express . Request ;
1921 res : express . Response ;
2022} ) : Promise < McpServer | null > => {
@@ -28,6 +30,7 @@ const newServer = async ({
2830 ...clientOptions ,
2931 ...authOptions ,
3032 } ,
33+ mcpOptions,
3134 } ) ;
3235 } catch ( error ) {
3336 res . status ( 401 ) . json ( {
Original file line number Diff line number Diff line change @@ -18,7 +18,7 @@ async function main() {
1818
1919 switch ( options . transport ) {
2020 case 'stdio' :
21- await launchStdioServer ( ) ;
21+ await launchStdioServer ( { mcpOptions : options } ) ;
2222 break ;
2323 case 'http' :
2424 await launchStreamableHTTPServer ( {
Original file line number Diff line number Diff line change @@ -17,7 +17,13 @@ import { HandlerFunction, McpTool } from './types';
1717export { McpOptions } from './options' ;
1818export { ClientOptions } from 'dedalus-labs' ;
1919
20+ let cachedInstructions : string | undefined ;
21+
2022async function getInstructions ( ) {
23+ if ( cachedInstructions !== undefined ) {
24+ return cachedInstructions ;
25+ }
26+
2127 // This API key is optional; providing it allows the server to fetch instructions for unreleased versions.
2228 const stainlessAPIKey = readEnv ( 'STAINLESS_API_KEY' ) ;
2329 const response = await fetch (
@@ -50,6 +56,7 @@ async function getInstructions() {
5056 ${ instructions }
5157 ` ;
5258
59+ cachedInstructions = instructions ;
5360 return instructions ;
5461}
5562
Original file line number Diff line number Diff line change 11import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js' ;
2+ import { McpOptions } from './options' ;
23import { initMcpServer , newMcpServer } from './server' ;
34
4- export const launchStdioServer = async ( ) => {
5+ export const launchStdioServer = async ( params : { mcpOptions : McpOptions } ) => {
56 const server = await newMcpServer ( ) ;
67
7- await initMcpServer ( { server } ) ;
8+ await initMcpServer ( { server, mcpOptions : params . mcpOptions } ) ;
89
910 const transport = new StdioServerTransport ( ) ;
1011 await server . connect ( transport ) ;
You can’t perform that action at this time.
0 commit comments