Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions src/developer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,12 @@

import { z } from 'zod';
import type { FastMCP } from 'fastmcp';
import { originHeaders, requestOrigin } from './origin';

interface SessionData {
firecrawlApiKey?: string;
/** The User-Agent the session was authenticated with (see src/origin.ts). */
clientUserAgent?: string;
[key: string]: unknown;
}

Expand All @@ -34,7 +37,6 @@ type GetClient = (session?: SessionData) => unknown;

// The other mount, /v2/developer/search, may be withdrawn.
const BASE = '/v2/search/developer';
const ORIGIN_HEADERS = { 'X-Origin': 'mcp-fastmcp' };


interface DeveloperHit {
Expand Down Expand Up @@ -111,7 +113,10 @@ Returns ranked results with an ID, source type, URL, title, and the matched pass
.optional()
.describe('Set to "only" to search only agent-skill files.'),
}),
execute: async (args: unknown, { session }): Promise<string> => {
execute: async (
args: unknown,
{ session, client: mcpClient }
): Promise<string> => {
const { query, k, skills } = args as {
query: string;
k?: number;
Expand All @@ -124,7 +129,7 @@ Returns ranked results with an ID, source type, URL, title, and the matched pass
const client = getClient(session) as ClientLike;
const res = await client.http.get<{
results?: DeveloperHit[];
}>(`${BASE}?${params.toString()}`, ORIGIN_HEADERS);
}>(`${BASE}?${params.toString()}`, originHeaders(requestOrigin(mcpClient, session)));
return fmtDeveloper(res.data?.results);
},
});
Expand Down
Loading
Loading