The official TypeScript SDK for Model Context Protocol servers and clients
104 matches across 8 categories. Click a row to expand file-level details.
| Severity | File | Line | Snippet |
|---|---|---|---|
| LOW | test/integration/test/helpers/mcp.ts | 14 | export async function createInMemoryTaskEnvironment(options?: { |
| LOW | test/e2e/scenarios/client-auth.test.ts | 72 | function createMockAuthorizationServer(config: MockASConfig = {}) { |
| LOW | test/e2e/helpers/express.ts | 52 | export async function startExpressWithHostValidation(allowedHosts: string[], handler: RequestHandler): Promise<ExpressHo |
| LOW | test/helpers/src/helpers/http.ts | 32 | export function createExpressResponseMock(options: { trackRedirectUrl?: boolean } = {}): Response & { |
| LOW | test/helpers/src/helpers/http.ts | 87 | export function createNodeServerResponseMock(): ServerResponse { |
| LOW | test/conformance/src/everythingClient.ts | 238 | async function runClientCredentialsBasic(serverUrl: string): Promise<void> { |
| LOW | test/conformance/src/everythingClient.ts | 275 | async function runCrossAppAccessCompleteFlow(serverUrl: string): Promise<void> { |
| LOW | test/conformance/src/everythingClient.ts | 356 | async function runElicitationDefaultsClient(serverUrl: string): Promise<void> { |
| LOW | examples/server/src/elicitationUrlExample.ts | 158 | function generateTrackedElicitation(sessionId: string, createCompletionNotifier?: ElicitationCompletionNotifierFactory): |
| LOW | examples/shared/src/authServer.ts | 273 | export function createProtectedResourceMetadataRouter(resourcePath = '/mcp'): Router { |
| LOW | examples/client/src/elicitationUrlExample.ts | 111 | async function waitForElicitationsToComplete(): Promise<void> { |
| LOW | examples/client/src/elicitationUrlExample.ts | 302 | async function elicitationRequestHandler(request: ElicitRequest): Promise<ElicitResult> { |
| LOW | …ples/client/src/streamableHttpWithSseFallbackClient.ts | 67 | async function connectWithBackwardsCompatibility(url: string): Promise<{ |
| LOW | examples/client/src/simpleStreamableHttp.ts | 730 | async function runNotificationsToolWithResumability(interval: number, count: number): Promise<void> { |
| LOW | examples/client/src/parallelToolCallsClient.ts | 108 | async function startParallelNotificationTools(client: Client): Promise<Record<string, CallToolResult>> { |
| LOW | examples/client/src/dualModeAuth.ts | 39 | function createHostManagedTransport(serverUrl: URL, session: HostSessionStore, ui: HostUi): StreamableHTTPClientTranspor |
| LOW | examples/client/src/dualModeAuth.ts | 58 | function createUserConfiguredTransport(serverUrl: URL, clientId: string, clientSecret: string): StreamableHTTPClientTran |
| LOW | scripts/sync-snippets.ts | 299 | function getOrLoadRegion( |
| LOW | packages/middleware/express/src/auth/bearerAuth.ts | 31 | function buildWwwAuthenticateHeader( |
| LOW | packages/middleware/express/src/auth/metadataRouter.ts | 149 | export function getOAuthProtectedResourceMetadataUrl(serverUrl: URL): string { |
| LOW | packages/middleware/node/test/streamableHttp.test.ts | 3072 | async function createTestServerWithDnsProtection(config: { |
| LOW | packages/core/src/experimental/tasks/helpers.ts | 31 | export function assertToolsCallTaskCapability( |
| LOW | packages/core/src/experimental/tasks/helpers.ts | 69 | export function assertClientRequestTaskCapability( |
| LOW | packages/core/src/types/guards.ts | 98 | export function assertCompleteRequestPrompt(request: CompleteRequest): asserts request is CompleteRequestPrompt { |
| LOW | packages/core/src/types/guards.ts | 105 | export function assertCompleteRequestResourceTemplate(request: CompleteRequest): asserts request is CompleteRequestResou |
| LOW | packages/core/src/util/standardSchema.ts | 177 | export function standardSchemaToJsonSchema(schema: StandardJSONSchemaV1, io: 'input' | 'output' = 'input'): Record<strin |
| LOW | packages/core/src/util/standardSchema.ts | 239 | export function promptArgumentsFromStandardSchema( |
| LOW | packages/core/src/shared/toolNameValidation.ts | 109 | export function validateAndWarnToolName(name: string): boolean { |
| LOW | packages/core/src/shared/taskManager.ts | 193 | export function extractTaskManagerOptions(tasksCapability: TaskManagerOptions | undefined): TaskManagerOptions | undefin |
| LOW | …s/server/src/server/middleware/hostHeaderValidation.ts | 40 | export function localhostAllowedHostnames(): string[] { |
| LOW | …s/server/src/server/middleware/hostHeaderValidation.ts | 51 | export function hostHeaderValidationResponse(req: Request, allowedHostnames: string[]): Response | undefined { |
| LOW | packages/client/test/client/auth.test.ts | 55 | function withBrowserLikeEnvironment(): void { |
| LOW | packages/client/src/client/client.ts | 126 | export function getSupportedElicitationModes(capabilities: ClientCapabilities['elicitation']): { |
| LOW | packages/client/src/client/crossAppAccess.ts | 124 | export async function requestJwtAuthorizationGrant(options: RequestJwtAuthGrantOptions): Promise<JwtAuthGrantResult> { |
| LOW | packages/client/src/client/crossAppAccess.ts | 203 | export async function discoverAndRequestJwtAuthGrant(options: DiscoverAndRequestJwtAuthGrantOptions): Promise<JwtAuthGra |
| LOW | packages/client/src/client/auth.ts | 453 | export function applyClientAuthentication( |
| LOW | packages/client/src/client/auth.ts | 820 | export function validateClientMetadataUrl(url: string | undefined): void { |
| LOW | packages/client/src/client/auth.ts | 871 | export function extractWWWAuthenticateParams(res: Response): { resourceMetadataUrl?: URL; scope?: string; error?: string |
| LOW | packages/client/src/client/auth.ts | 934 | export function extractResourceMetadataUrl(res: Response): URL | undefined { |
| LOW | packages/client/src/client/auth.ts | 965 | export async function discoverOAuthProtectedResourceMetadata( |
| LOW | packages/client/src/client/auth.ts | 1068 | async function discoverMetadataWithFallback( |
| LOW | packages/client/src/client/auth.ts | 1225 | export async function discoverAuthorizationServerMetadata( |
| LOW | packages/client/src/client/auth.ts | 1444 | export function prepareAuthorizationCodeRequest( |
| LOW | packages/codemod/src/utils/importUtils.ts | 86 | export function isOriginalNameImportedFromMcp(sourceFile: SourceFile, exportName: string): boolean { |
| LOW | packages/codemod/src/utils/importUtils.ts | 105 | export function resolveOriginalImportName(sourceFile: SourceFile, localName: string): string | undefined { |
| Severity | File | Line | Snippet |
|---|---|---|---|
| LOW | test/e2e/scenarios/flow.test.ts | 240 | // Step 1: first call rejects with UrlElicitationRequiredError |
| LOW | test/e2e/scenarios/flow.test.ts | 252 | // Step 2: user "opens" the URL (out-of-band, simulated by marking complete) |
| LOW | test/e2e/scenarios/flow.test.ts | 255 | // Step 3: server emits notifications/elicitation/complete and the client receives it for that exact elicitation |
| LOW | test/e2e/scenarios/flow.test.ts | 260 | // Step 4: retry succeeds |
| LOW | test/e2e/scenarios/flow.test.ts | 462 | // Step 1: first connect fails with 401 → discovery + DCR + redirect to the authorization endpoint |
| LOW | test/e2e/scenarios/flow.test.ts | 480 | // Step 2: user completes redirect, finishAuth exchanges the code for tokens |
| LOW | test/e2e/scenarios/flow.test.ts | 492 | // Step 3: second connect with fresh transport succeeds and tools/list works |
| LOW | examples/server/src/elicitationFormExample.ts | 139 | // Step 1: Collect basic event information |
| LOW | examples/server/src/elicitationFormExample.ts | 168 | // Step 2: Collect date and time |
| LOW | …ples/client/src/streamableHttpWithSseFallbackClient.ts | 74 | // Step 1: Try Streamable HTTP transport first |
| LOW | …ples/client/src/streamableHttpWithSseFallbackClient.ts | 97 | // Step 2: If transport fails, try the older SSE transport |
| LOW | scripts/generate-multidoc.sh | 33 | # Step 1: Generate V1 docs from v1.x branch |
| LOW | scripts/generate-multidoc.sh | 95 | # Step 2: Generate V2 docs from main branch |
| LOW | packages/codemod/src/bin/batchTest.ts | 298 | // Step 1: Clone or reset |
| LOW | packages/codemod/src/bin/batchTest.ts | 314 | // Step 2: Detect package manager |
| LOW | packages/codemod/src/bin/batchTest.ts | 318 | // Step 3: Install |
| LOW | packages/codemod/src/bin/batchTest.ts | 339 | // Step 4: Baseline checks |
| LOW | packages/codemod/src/bin/batchTest.ts | 349 | // Step 5: Run codemod (programmatic API) |
| LOW | packages/codemod/src/bin/batchTest.ts | 362 | // Step 6: Rewrite v2 deps to local tarballs, then re-install |
| LOW | packages/codemod/src/bin/batchTest.ts | 370 | // Step 7: Post-codemod checks |
| LOW | packages/codemod/src/bin/batchTest.ts | 418 | // Step 8: Write per-repo report |
| Severity | File | Line | Snippet |
|---|---|---|---|
| MEDIUM | test/e2e/helpers/index.ts | 109 | // ─────────────────────────────────────────────────────────────────────────────── |
| MEDIUM | test/e2e/helpers/index.ts | 111 | // ─────────────────────────────────────────────────────────────────────────────── |
| MEDIUM | test/e2e/helpers/index.ts | 213 | // ─────────────────────────────────────────────────────────────────────────────── |
| MEDIUM | test/e2e/helpers/index.ts | 221 | // ─────────────────────────────────────────────────────────────────────────────── |
| MEDIUM | scripts/generate-multidoc.sh | 32 | # --------------------------------------------------------------------------- |
| MEDIUM | scripts/generate-multidoc.sh | 34 | # --------------------------------------------------------------------------- |
| MEDIUM | scripts/generate-multidoc.sh | 94 | # --------------------------------------------------------------------------- |
| MEDIUM | scripts/generate-multidoc.sh | 96 | # --------------------------------------------------------------------------- |
| Severity | File | Line | Snippet |
|---|---|---|---|
| LOW | test/integration/test/server.test.ts | 1057 | name: 'John Doe', |
| LOW | test/integration/test/server.test.ts | 1095 | name: 'John Doe', |
| LOW | test/integration/test/server/mcp.test.ts | 5056 | name: 'John Doe', |
| LOW | test/integration/test/server/mcp.test.ts | 6314 | name: 'John Doe', |
| LOW | test/integration/test/server/elicitation.test.ts | 69 | content: { name: 'John Doe' } |
| LOW | test/integration/test/server/elicitation.test.ts | 86 | content: { name: 'John Doe' } |
| LOW | test/integration/test/server/elicitation.test.ts | 143 | street: '123 Main St', |
| LOW | test/integration/test/server/elicitation.test.ts | 186 | email: 'user@example.com' |
| LOW | test/integration/test/server/elicitation.test.ts | 211 | name: 'John Doe', |
| LOW | test/integration/test/server/elicitation.test.ts | 446 | content: { email: 'user@example.com' } |
| LOW | test/integration/test/server/elicitation.test.ts | 463 | content: { email: 'user@example.com' } |
| LOW | test/integration/test/client/client.test.ts | 2150 | name: 'John Doe', |
| LOW | test/integration/test/client/client.test.ts | 2197 | expect(structuredContent.name).toBe('John Doe'); |
| LOW | test/integration/test/client/client.test.ts | 3891 | name: 'John Doe', |
| LOW | test/integration/test/client/client.test.ts | 3930 | expect(structuredContent.name).toBe('John Doe'); |
| LOW | test/e2e/scenarios/prompts.test.ts | 459 | const withOpt = await client.getPrompt({ name: 'summarize', arguments: { text: 'lorem ipsum', max_words: '10' } }); |
| LOW | test/e2e/scenarios/prompts.test.ts | 461 | { role: 'user', content: { type: 'text', text: 'Summarize the following text in at most 10 words:\nlorem ipsum' |
| LOW | test/e2e/scenarios/prompts.test.ts | 464 | const withoutOpt = await client.getPrompt({ name: 'summarize', arguments: { text: 'lorem ipsum' } }); |
| LOW | test/e2e/scenarios/prompts.test.ts | 465 | expect(withoutOpt.messages).toEqual([{ role: 'user', content: { type: 'text', text: 'Summarize the following text:\n |
| LOW | test/conformance/src/everythingServer.ts | 456 | default: 'John Doe' |
| LOW | packages/core/test/validators/validators.test.ts | 49 | const result = validator('John Doe'); |
| LOW | packages/core/test/validators/validators.test.ts | 51 | expect(result.data).toBe('John Doe'); |
| LOW | packages/core/test/validators/validators.test.ts | 75 | expect(validator('user@example.com').valid).toBe(true); |
| Severity | File | Line | Snippet |
|---|---|---|---|
| HIGH | docs/client-quickstart.md | 300 | + '\n export ANTHROPIC_API_KEY=your-api-key-here' |
| HIGH | examples/client-quickstart/src/index.ts | 172 | + '\n export ANTHROPIC_API_KEY=your-api-key-here' |
| Severity | File | Line | Snippet |
|---|---|---|---|
| MEDIUM | examples/client/src/simpleOAuthClientProvider.ts | 5 | * In-memory OAuth client provider for demonstration purposes |
| Severity | File | Line | Snippet |
|---|---|---|---|
| LOW | scripts/generate-multidoc.sh | 1 | #!/usr/bin/env bash |
| LOW | packages/server/src/stdio.ts | 1 | // Subpath entry for the stdio server transport. |
| LOW | packages/client/src/stdio.ts | 1 | // Subpath entry for the stdio client transport. |
| Severity | File | Line | Snippet |
|---|---|---|---|
| LOW | scripts/generate-multidoc.sh | 8 | # Usage: |