File tree 4 files changed +9
-8
lines changed
4 files changed +9
-8
lines changed Original file line number Diff line number Diff line change 1
- import { randomUUID } from 'node:crypto'
1
+ // maybe this'll get built-into the SDK: https://github.com/modelcontextprotocol/typescript-sdk/issues/260
2
2
import { type Transport } from '@modelcontextprotocol/sdk/shared/transport.js'
3
3
import {
4
4
type JSONRPCMessage ,
@@ -24,7 +24,7 @@ export class FetchSSEServerTransport implements Transport {
24
24
*/
25
25
constructor ( endpoint : string , sessionId ?: string | null ) {
26
26
this . #endpoint = endpoint
27
- this . #sessionId = sessionId ?? randomUUID ( )
27
+ this . #sessionId = sessionId ?? crypto . randomUUID ( )
28
28
}
29
29
30
30
/**
Original file line number Diff line number Diff line change
1
+ import { invariantResponse } from '@epic-web/invariant'
1
2
import { type Route } from './+types/index.ts'
2
3
import { connect , getTransport } from './mcp.server.ts'
3
4
@@ -11,12 +12,10 @@ export async function loader({ request }: Route.LoaderArgs) {
11
12
export async function action ( { request } : Route . ActionArgs ) {
12
13
const url = new URL ( request . url )
13
14
const sessionId = url . searchParams . get ( 'sessionId' )
14
- if ( ! sessionId ) {
15
- return new Response ( 'No session ID' , { status : 400 } )
16
- }
15
+ invariantResponse ( sessionId , 'No session ID' )
16
+
17
17
const transport = await getTransport ( sessionId )
18
- if ( ! transport ) {
19
- return new Response ( 'Not found' , { status : 404 } )
20
- }
18
+ invariantResponse ( transport , 'No transport' , { status : 404 } )
19
+
21
20
return transport . handlePostMessage ( request )
22
21
}
Original file line number Diff line number Diff line change @@ -20,6 +20,7 @@ export const server = new McpServer(
20
20
21
21
server . tool (
22
22
'Find User' ,
23
+ 'Search for users in the Epic Notes database by their name or username' ,
23
24
{ query : z . string ( ) . describe ( 'The query to search for' ) } ,
24
25
async ( { query } ) => {
25
26
const like = `%${ query ?? '' } %`
Original file line number Diff line number Diff line change 22
22
"setup" : " npm run build && prisma migrate deploy && prisma generate --sql && playwright install" ,
23
23
"start" : " cross-env NODE_ENV=production node ." ,
24
24
"start:mocks" : " cross-env NODE_ENV=production MOCKS=true tsx ." ,
25
+ "test:mcp" : " npx @modelcontextprotocol/inspector" ,
25
26
"test" : " vitest" ,
26
27
"coverage" : " vitest run --coverage" ,
27
28
"test:e2e" : " npm run test:e2e:dev --silent" ,
You can’t perform that action at this time.
0 commit comments