@refkit/mcp 0.4.0 → 0.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # @refkit/mcp
2
2
 
3
- An MCP server that exposes refkit's **license-normalized reference search** as an agent tool (`search_references`).
3
+ An MCP server that exposes refkit's **license-normalized reference search** (`search_references`) plus two stateless verdict tools (`evaluate_use`, `build_attribution`) as agent tools.
4
4
 
5
5
  ## Zero-config (`npx`)
6
6
 
@@ -10,9 +10,12 @@ Point any MCP client at:
10
10
  npx -y @refkit/mcp
11
11
  ```
12
12
 
13
- It boots with the keyless sources (Met, Art Institute of Chicago, Wikimedia Commons, Openverse + audio, Project Gutenberg, PoetryDB) and auto-adds any BYOK source whose key is in the environment:
13
+ It boots with the keyless sources (Met, Art Institute of Chicago, Wikimedia Commons, Openverse + audio, Project Gutenberg, PoetryDB) and auto-adds any BYOK source whose key is in the environment. Each key is read as a unified `REFKIT_<PROVIDER>_KEY` name first, falling back to the provider's legacy name (both are honored indefinitely):
14
14
 
15
15
  ```bash
16
+ REFKIT_UNSPLASH_KEY=… REFKIT_PEXELS_KEY=… REFKIT_PIXABAY_KEY=… REFKIT_FLICKR_KEY=… REFKIT_SMITHSONIAN_KEY=… REFKIT_BRAVE_KEY=… npx -y @refkit/mcp
17
+
18
+ # legacy names still work:
16
19
  UNSPLASH_KEY=… PEXELS_KEY=… PIXABAY_KEY=… FLICKR_KEY=… SI_KEY=… BRAVE_TOKEN=… npx -y @refkit/mcp
17
20
  ```
18
21
 
@@ -66,6 +69,20 @@ Output: `{ references: [{ id, title?, modality, provider, canonicalUrl, license,
66
69
 
67
70
  > Results are references with a license id + source link — **not rights clearance, not legal advice**. `unknown` / `needs-review` results require the caller to verify the source's terms.
68
71
 
72
+ ## The `evaluate_use` tool
73
+
74
+ Stateless: no search round-trip, no session cache — the caller supplies the rights fields directly.
75
+
76
+ Input: `{ license, licenseVersion?, author?, title?, canonicalUrl, intent, editorialOnly?, jurisdiction?, userJurisdiction? }`.
77
+
78
+ Output: `{ decision, reasons, confidence, disclaimer, attribution? }`. `attribution.text`/`.html` are included when `decision` is `allowed-with-attribution` (built from the same input fields via `buildAttribution`).
79
+
80
+ > Same conservative heuristic as `search_references`' use-gate — **not legal advice**. Every verdict carries a `disclaimer` and a `confidence`.
81
+
82
+ ## The `build_attribution` tool
83
+
84
+ Input: `{ license, licenseVersion?, author?, title?, canonicalUrl }` → output `{ required, text?, html? }`. `required` is `false` (and `text`/`html` omitted) for licenses that need no attribution (e.g. `CC0-1.0`, `PD`).
85
+
69
86
  ## Discovery (web) source
70
87
 
71
88
  refkit's clean providers give license-normalized results. For open-web **breadth** (e.g. "cyberpunk alley"), add the Brave discovery provider — its results carry `license: 'unknown'`, so refkit's use-gate returns `needs-review` for every one (never auto-allowed):
@@ -3,8 +3,8 @@ import { readFileSync } from "fs";
3
3
  import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
4
4
  import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
5
5
  import { z } from "zod";
6
+ import { LICENSE_IDS, INTENTS, evaluateUse, buildAttribution, ccVersionFor } from "@refkit/core";
6
7
  var MODALITIES = ["image", "video", "audio", "text"];
7
- var INTENTS = ["internal-moodboard", "commercial-product", "ai-generation-input", "redistribution"];
8
8
  var ORIENTATIONS = ["landscape", "portrait", "square"];
9
9
  var SEARCH_CONTROL_KEYS = [
10
10
  "orientation",
@@ -122,7 +122,9 @@ var searchMetaSchema = z.object({
122
122
  accepted: z.number().optional(),
123
123
  rejected: z.number().optional(),
124
124
  reason: z.enum(["unsupported-modality"]).optional(),
125
- error: z.string().optional()
125
+ error: z.string().optional(),
126
+ latencyMs: z.number().optional(),
127
+ cached: z.boolean().optional()
126
128
  })),
127
129
  gate: z.object({
128
130
  intent: z.enum(INTENTS),
@@ -174,6 +176,80 @@ function createRefkitMcpServer(refkit) {
174
176
  };
175
177
  }
176
178
  );
179
+ const attributionOutputSchema = { required: z.boolean(), text: z.string().optional(), html: z.string().optional() };
180
+ server.registerTool(
181
+ "evaluate_use",
182
+ {
183
+ title: "Evaluate a license for an intended use",
184
+ description: "Stateless license/use-gate check: given a license id + intended use, returns a conservative-heuristic verdict (allowed / allowed-with-attribution / denied / needs-review) with reasons and confidence. Not legal advice \u2014 a strict-deny heuristic over source-declared license facts.",
185
+ inputSchema: {
186
+ license: z.enum(LICENSE_IDS).describe("the reference's license id"),
187
+ licenseVersion: z.string().optional().describe('precise CC version, e.g. "4.0" \u2014 attribution only'),
188
+ author: z.string().optional(),
189
+ title: z.string().optional(),
190
+ canonicalUrl: z.string().describe("canonical source link, for attribution and audit"),
191
+ intent: z.enum(INTENTS).describe("the intended use to evaluate this license against"),
192
+ editorialOnly: z.boolean().optional().describe("source marked editorial-only"),
193
+ jurisdiction: z.string().optional().describe("source-declared jurisdiction of the PD/copyright status"),
194
+ userJurisdiction: z.string().optional().describe("caller's jurisdiction; mismatched jurisdictions default to needs-review")
195
+ },
196
+ outputSchema: {
197
+ decision: z.enum(["allowed", "allowed-with-attribution", "denied", "needs-review"]),
198
+ reasons: z.array(z.string()),
199
+ confidence: z.enum(["high", "low"]),
200
+ disclaimer: z.string(),
201
+ attribution: z.object(attributionOutputSchema).optional()
202
+ }
203
+ },
204
+ async ({ license, licenseVersion, author, title, canonicalUrl, intent, editorialOnly, jurisdiction, userJurisdiction }) => {
205
+ const version = ccVersionFor(license, licenseVersion);
206
+ const rights = {
207
+ license,
208
+ licenseVersion: version,
209
+ author,
210
+ rehostPolicy: "cache-allowed",
211
+ jurisdiction,
212
+ editorialOnly,
213
+ raw: { sourceTerms: "", sourceUrl: canonicalUrl }
214
+ };
215
+ const verdict = evaluateUse(rights, intent, { userJurisdiction });
216
+ const attribution = verdict.decision === "allowed-with-attribution" ? buildAttribution({ license, licenseVersion: version, author, title, canonicalUrl }) : void 0;
217
+ const summary = `${verdict.decision}: ${verdict.reasons.join("; ") || "license facts allow this use"}`;
218
+ return {
219
+ content: [{ type: "text", text: summary }],
220
+ structuredContent: {
221
+ decision: verdict.decision,
222
+ reasons: verdict.reasons,
223
+ confidence: verdict.confidence,
224
+ disclaimer: verdict.disclaimer,
225
+ ...attribution ? { attribution } : {}
226
+ }
227
+ };
228
+ }
229
+ );
230
+ server.registerTool(
231
+ "build_attribution",
232
+ {
233
+ title: "Build an attribution credit line",
234
+ description: "Mechanically derive an attribution credit line (plain text + HTML) from a license id + author + title + canonicalUrl. `required` is false when the license needs no attribution (e.g. CC0, PD).",
235
+ inputSchema: {
236
+ license: z.enum(LICENSE_IDS),
237
+ licenseVersion: z.string().optional().describe('precise CC version, e.g. "4.0" \u2014 appended to the license name'),
238
+ author: z.string().optional(),
239
+ title: z.string().optional(),
240
+ canonicalUrl: z.string()
241
+ },
242
+ outputSchema: attributionOutputSchema
243
+ },
244
+ async ({ license, licenseVersion, author, title, canonicalUrl }) => {
245
+ const version = ccVersionFor(license, licenseVersion);
246
+ const attribution = buildAttribution({ license, licenseVersion: version, author, title, canonicalUrl });
247
+ return {
248
+ content: [{ type: "text", text: attribution.required ? attribution.text ?? "" : "No attribution required for this license." }],
249
+ structuredContent: { required: attribution.required, text: attribution.text, html: attribution.html }
250
+ };
251
+ }
252
+ );
177
253
  return server;
178
254
  }
179
255
  async function serveStdio(refkit) {
@@ -185,4 +261,4 @@ export {
185
261
  createRefkitMcpServer,
186
262
  serveStdio
187
263
  };
188
- //# sourceMappingURL=chunk-B5SVJVI4.js.map
264
+ //# sourceMappingURL=chunk-6JDNSEQM.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/index.ts"],"sourcesContent":["import { readFileSync } from 'node:fs'\nimport { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js'\nimport { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js'\nimport { z } from 'zod'\nimport { LICENSE_IDS, INTENTS, evaluateUse, buildAttribution, ccVersionFor } from '@refkit/core'\nimport type { RefkitClient, Reference, Verdict, Attribution, SearchFilters, SearchControls, SearchControlKey, ProviderOptionsById, SearchMeta, RightsRecord } from '@refkit/core'\n\nconst MODALITIES = ['image', 'video', 'audio', 'text'] as const\nconst ORIENTATIONS = ['landscape', 'portrait', 'square'] as const\nconst SEARCH_CONTROL_KEYS = [\n 'orientation',\n 'color',\n 'language',\n 'sort',\n 'safety',\n 'license.commercial',\n 'license.modification',\n 'license.allowUnknown',\n 'media.kind',\n 'media.size',\n 'media.minWidth',\n 'media.minHeight',\n 'media.duration',\n 'creator.id',\n 'creator.name',\n 'text.copyright',\n 'page',\n] as const satisfies readonly SearchControlKey[]\n\nconst filtersSchema = z.object({\n color: z.string().optional(),\n orientation: z.enum(ORIENTATIONS).optional(),\n language: z.string().optional(),\n})\nconst searchControlKeySchema = z.enum(SEARCH_CONTROL_KEYS)\n\nconst searchControlsSchema = z.object({\n orientation: z.enum(ORIENTATIONS).optional(),\n color: z.string().optional(),\n language: z.string().optional(),\n sort: z.enum(['relevance', 'latest', 'popular', 'interesting']).optional(),\n safety: z.enum(['strict', 'moderate', 'off']).optional(),\n license: z.object({\n commercial: z.boolean().optional(),\n modification: z.boolean().optional(),\n allowUnknown: z.boolean().optional(),\n }).optional(),\n media: z.object({\n kind: z.enum(['photo', 'illustration', 'vector', 'film', 'animation']).optional(),\n size: z.enum(['small', 'medium', 'large']).optional(),\n minWidth: z.number().int().nonnegative().optional(),\n minHeight: z.number().int().nonnegative().optional(),\n duration: z.enum(['short', 'medium', 'long']).optional(),\n }).optional(),\n creator: z.object({\n id: z.string().optional(),\n name: z.string().optional(),\n }).optional(),\n text: z.object({\n copyright: z.enum(['public-domain', 'copyrighted', 'any']).optional(),\n }).optional(),\n page: z.number().int().positive().optional(),\n})\n\nconst providerOptionValueSchema = z.union([z.string(), z.number(), z.boolean(), z.array(z.string())])\nconst providerOptionsSchema = z.record(z.string(), z.record(z.string(), providerOptionValueSchema))\n\n// Reported in the MCP initialize handshake. Read the real version (the dist sits\n// next to package.json, which npm always ships) instead of a hardcoded placeholder.\nconst VERSION: string = (() => {\n try {\n return JSON.parse(readFileSync(new URL('../package.json', import.meta.url), 'utf8')).version\n } catch {\n return '0.0.0'\n }\n})()\n\n// Concise, agent-facing projection of a Reference (no raw provider dump). When an\n// intent is supplied the use-gate verdict + attribution ride along, so the agent\n// sees *whether it may use* each result — not just a bare license id it ignores.\nfunction toAgentRef(r: Reference, assessment?: { verdict: Verdict; attribution: Attribution }) {\n const base = {\n id: r.id,\n title: r.title,\n modality: r.modality,\n provider: r.source.providerId,\n canonicalUrl: r.canonicalUrl,\n license: r.rights.license,\n thumbnail: r.thumbnail?.url,\n excerpt: r.text?.excerpt,\n }\n if (!assessment) return base\n const { verdict, attribution } = assessment\n const reason = verdict.reasons.join('; ')\n const useExplanation = `${verdict.decision}: ${reason || 'license facts allow this use'}${attribution.required && attribution.text ? ` Attribution required: ${attribution.text}` : ''}`\n return {\n ...base,\n useVerdict: { decision: verdict.decision, reason: verdict.reasons.join('; '), confidence: verdict.confidence },\n useExplanation,\n ...(attribution.required && attribution.text ? { attribution: attribution.text } : {}),\n }\n}\n\nconst agentRefSchema = z.object({\n id: z.string(),\n title: z.string().optional(),\n modality: z.string(),\n provider: z.string(),\n canonicalUrl: z.string(),\n license: z.string(),\n thumbnail: z.string().optional(),\n excerpt: z.string().optional(),\n useVerdict: z\n .object({ decision: z.string(), reason: z.string(), confidence: z.string() })\n .optional()\n .describe('present when `intent` (or `gateFor`) is set: may this be used for that intent, and how confident'),\n useExplanation: z.string().optional().describe('plain-language use verdict summary for agents'),\n attribution: z.string().optional().describe('ready-to-use credit line; present when the license requires attribution'),\n})\n\nconst searchMetaSchema: z.ZodType<SearchMeta> = z.object({\n query: z.string(),\n modalities: z.array(z.enum(MODALITIES)),\n limit: z.number(),\n poolFactor: z.number(),\n fetchLimit: z.number(),\n appliedFilters: filtersSchema.optional(),\n controls: z.object({\n requested: z.array(searchControlKeySchema),\n appliedByProvider: z.record(z.string(), z.array(searchControlKeySchema)),\n ignoredByProvider: z.record(z.string(), z.array(searchControlKeySchema)),\n }).optional(),\n providerOptions: z.array(z.string()).optional(),\n providers: z.array(z.object({\n providerId: z.string(),\n status: z.enum(['fulfilled', 'failed', 'skipped']),\n returned: z.number().optional(),\n accepted: z.number().optional(),\n rejected: z.number().optional(),\n reason: z.enum(['unsupported-modality']).optional(),\n error: z.string().optional(),\n latencyMs: z.number().optional(),\n cached: z.boolean().optional(),\n })),\n gate: z.object({\n intent: z.enum(INTENTS),\n before: z.number(),\n after: z.number(),\n dropped: z.number(),\n }).optional(),\n warnings: z.array(z.string()),\n})\n\n/** Wrap a configured RefkitClient as an MCP server exposing `search_references`. */\nexport function createRefkitMcpServer(refkit: RefkitClient): McpServer {\n const server = new McpServer({ name: 'refkit', version: VERSION })\n\n server.registerTool(\n 'search_references',\n {\n title: 'Search creative references',\n description:\n 'Search license-normalized reference material (image / video / audio / text) across the configured sources. ' +\n 'Every result carries a license id + canonical source link. Pass `intent` to annotate each result with a ' +\n 'use-verdict (may I use this, is attribution required) WITHOUT filtering; pass `gateFor` to instead return ' +\n 'only results whose license allows that intent. Results are references, not rights clearance — not legal advice.',\n inputSchema: {\n query: z.string().describe('what to search for, e.g. \"cyberpunk alley at night\"'),\n modalities: z.array(z.enum(MODALITIES)).optional().describe('default [\"image\"]'),\n filters: filtersSchema.optional().describe('compatibility alias for controls.orientation, controls.color, and controls.language'),\n controls: searchControlsSchema.optional().describe('provider-neutral search controls; providers translate supported controls and report ignored controls in explain metadata'),\n providerOptions: providerOptionsSchema.optional().describe('provider-specific search controls keyed by provider id; each provider whitelists supported keys'),\n explain: z.boolean().optional().describe('include provider status, applied and ignored controls, warnings, and gate/drop metadata'),\n limit: z.number().int().positive().optional(),\n intent: z.enum(INTENTS).optional().describe('annotate each result with a use-verdict for this intended use (no filtering)'),\n gateFor: z.enum(INTENTS).optional().describe('only return results whose license allows this intended use'),\n },\n outputSchema: { references: z.array(agentRefSchema), meta: searchMetaSchema.optional() },\n },\n async ({ query, modalities, filters, controls, providerOptions, explain, limit, intent, gateFor }) => {\n const searchInput = {\n query,\n modalities: modalities ?? ['image'],\n filters: filters as SearchFilters | undefined,\n controls: controls as SearchControls | undefined,\n providerOptions: providerOptions as ProviderOptionsById | undefined,\n limit,\n gateFor,\n }\n const result = explain ? await refkit.searchWithMeta(searchInput) : { references: await refkit.search(searchInput), meta: undefined }\n const refs = result.references\n const assessIntent = intent ?? gateFor\n const references = refs.map(r =>\n assessIntent\n ? toAgentRef(r, { verdict: refkit.evaluateUse(r, assessIntent), attribution: refkit.buildAttribution(r) })\n : toAgentRef(r),\n )\n return {\n content: [{ type: 'text', text: `${references.length} reference(s) for \"${query}\".` }],\n structuredContent: { references, ...(result.meta ? { meta: result.meta } : {}) },\n }\n },\n )\n\n const attributionOutputSchema = { required: z.boolean(), text: z.string().optional(), html: z.string().optional() }\n\n server.registerTool(\n 'evaluate_use',\n {\n title: 'Evaluate a license for an intended use',\n description:\n 'Stateless license/use-gate check: given a license id + intended use, returns a conservative-heuristic verdict ' +\n '(allowed / allowed-with-attribution / denied / needs-review) with reasons and confidence. ' +\n 'Not legal advice — a strict-deny heuristic over source-declared license facts.',\n inputSchema: {\n license: z.enum(LICENSE_IDS).describe('the reference\\'s license id'),\n licenseVersion: z.string().optional().describe('precise CC version, e.g. \"4.0\" — attribution only'),\n author: z.string().optional(),\n title: z.string().optional(),\n canonicalUrl: z.string().describe('canonical source link, for attribution and audit'),\n intent: z.enum(INTENTS).describe('the intended use to evaluate this license against'),\n editorialOnly: z.boolean().optional().describe('source marked editorial-only'),\n jurisdiction: z.string().optional().describe('source-declared jurisdiction of the PD/copyright status'),\n userJurisdiction: z.string().optional().describe('caller\\'s jurisdiction; mismatched jurisdictions default to needs-review'),\n },\n outputSchema: {\n decision: z.enum(['allowed', 'allowed-with-attribution', 'denied', 'needs-review']),\n reasons: z.array(z.string()),\n confidence: z.enum(['high', 'low']),\n disclaimer: z.string(),\n attribution: z.object(attributionOutputSchema).optional(),\n },\n },\n async ({ license, licenseVersion, author, title, canonicalUrl, intent, editorialOnly, jurisdiction, userJurisdiction }) => {\n const version = ccVersionFor(license, licenseVersion)\n const rights: RightsRecord = {\n license,\n licenseVersion: version,\n author,\n rehostPolicy: 'cache-allowed',\n jurisdiction,\n editorialOnly,\n raw: { sourceTerms: '', sourceUrl: canonicalUrl },\n }\n const verdict: Verdict = evaluateUse(rights, intent, { userJurisdiction })\n const attribution =\n verdict.decision === 'allowed-with-attribution'\n ? buildAttribution({ license, licenseVersion: version, author, title, canonicalUrl })\n : undefined\n const summary = `${verdict.decision}: ${verdict.reasons.join('; ') || 'license facts allow this use'}`\n return {\n content: [{ type: 'text', text: summary }],\n structuredContent: {\n decision: verdict.decision,\n reasons: verdict.reasons,\n confidence: verdict.confidence,\n disclaimer: verdict.disclaimer,\n ...(attribution ? { attribution } : {}),\n },\n }\n },\n )\n\n server.registerTool(\n 'build_attribution',\n {\n title: 'Build an attribution credit line',\n description:\n 'Mechanically derive an attribution credit line (plain text + HTML) from a license id + author + title + ' +\n 'canonicalUrl. `required` is false when the license needs no attribution (e.g. CC0, PD).',\n inputSchema: {\n license: z.enum(LICENSE_IDS),\n licenseVersion: z.string().optional().describe('precise CC version, e.g. \"4.0\" — appended to the license name'),\n author: z.string().optional(),\n title: z.string().optional(),\n canonicalUrl: z.string(),\n },\n outputSchema: attributionOutputSchema,\n },\n async ({ license, licenseVersion, author, title, canonicalUrl }) => {\n const version = ccVersionFor(license, licenseVersion)\n const attribution: Attribution = buildAttribution({ license, licenseVersion: version, author, title, canonicalUrl })\n return {\n content: [{ type: 'text', text: attribution.required ? (attribution.text ?? '') : 'No attribution required for this license.' }],\n structuredContent: { required: attribution.required, text: attribution.text, html: attribution.html },\n }\n },\n )\n\n return server\n}\n\n/** Run the refkit MCP server over stdio (host wires the RefkitClient + its providers/keys). */\nexport async function serveStdio(refkit: RefkitClient): Promise<void> {\n const server = createRefkitMcpServer(refkit)\n await server.connect(new StdioServerTransport())\n}\n"],"m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EAAE,SAAS,EAAE,SAAS,oEAA+D;AAAA,QAC9G,QAAQ,EAAE,OAAO,EAAE,SAAS;AAAA,QAC5B,OAAO,EAAE,OAAO,EAAE,SAAS;AAAA,QAC3B,cAAc,EAAE,OAAO;AAAA,MACzB;AAAA,MACA,cAAc;AAAA,IAChB;AAAA,IACA,OAAO,EAAE,SAAS,gBAAgB,QAAQ,OAAO,aAAa,MAAM;AAClE,YAAM,UAAU,aAAa,SAAS,cAAc;AACpD,YAAM,cAA2B,iBAAiB,EAAE,SAAS,gBAAgB,SAAS,QAAQ,OAAO,aAAa,CAAC;AACnH,aAAO;AAAA,QACL,SAAS,CAAC,EAAE,MAAM,QAAQ,MAAM,YAAY,WAAY,YAAY,QAAQ,KAAM,4CAA4C,CAAC;AAAA,QAC/H,mBAAmB,EAAE,UAAU,YAAY,UAAU,MAAM,YAAY,MAAM,MAAM,YAAY,KAAK;AAAA,MACtG;AAAA,IACF;AAAA,EACF;AAEA,SAAO;AACT;AAGA,eAAsB,WAAW,QAAqC;AACpE,QAAM,SAAS,sBAAsB,MAAM;AAC3C,QAAM,OAAO,QAAQ,IAAI,qBAAqB,CAAC;AACjD;","names":[]}
package/dist/cli.d.ts CHANGED
@@ -2,7 +2,11 @@
2
2
  import { ReferenceProvider } from '@refkit/core';
3
3
 
4
4
  /** Providers a zero-config server boots with: all keyless sources, plus any BYOK
5
- * source whose key is present in `env`. Exported so the wiring is unit-testable. */
5
+ * source whose key is present in `env`. Exported so the wiring is unit-testable.
6
+ *
7
+ * Env var convention: each BYOK key is read as `REFKIT_<PROVIDER>_KEY` first (the
8
+ * unified name), falling back to the provider's legacy env var name — both are
9
+ * honored indefinitely, the unified name is just preferred going forward. */
6
10
  declare function defaultProviders(env?: NodeJS.ProcessEnv): ReferenceProvider[];
7
11
 
8
12
  export { defaultProviders };
package/dist/cli.js CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  serveStdio
4
- } from "./chunk-B5SVJVI4.js";
4
+ } from "./chunk-6JDNSEQM.js";
5
5
 
6
6
  // src/cli.ts
7
7
  import { realpathSync } from "fs";
@@ -39,15 +39,24 @@ function defaultProviders(env = process.env) {
39
39
  ambientcg(),
40
40
  internetArchive()
41
41
  ];
42
- if (env.UNSPLASH_KEY) providers.push(unsplash({ accessKey: env.UNSPLASH_KEY }));
43
- if (env.PEXELS_KEY) providers.push(pexels({ apiKey: env.PEXELS_KEY }), pexelsVideo({ apiKey: env.PEXELS_KEY }));
44
- if (env.PIXABAY_KEY) providers.push(pixabay({ key: env.PIXABAY_KEY }), pixabayVideo({ key: env.PIXABAY_KEY }));
45
- if (env.FLICKR_KEY) providers.push(flickr({ apiKey: env.FLICKR_KEY }));
46
- if (env.SI_KEY) providers.push(smithsonian({ apiKey: env.SI_KEY }));
47
- if (env.BRAVE_TOKEN) providers.push(brave({ token: env.BRAVE_TOKEN }));
48
- if (env.FREESOUND_TOKEN) providers.push(freesound({ apiKey: env.FREESOUND_TOKEN }));
49
- if (env.JAMENDO_CLIENT_ID) providers.push(jamendo({ clientId: env.JAMENDO_CLIENT_ID }));
50
- if (env.EUROPEANA_KEY) providers.push(europeana({ apiKey: env.EUROPEANA_KEY }));
42
+ const unsplashKey = env.REFKIT_UNSPLASH_KEY ?? env.UNSPLASH_KEY;
43
+ const pexelsKey = env.REFKIT_PEXELS_KEY ?? env.PEXELS_KEY;
44
+ const pixabayKey = env.REFKIT_PIXABAY_KEY ?? env.PIXABAY_KEY;
45
+ const flickrKey = env.REFKIT_FLICKR_KEY ?? env.FLICKR_KEY;
46
+ const smithsonianKey = env.REFKIT_SMITHSONIAN_KEY ?? env.SI_KEY;
47
+ const braveKey = env.REFKIT_BRAVE_KEY ?? env.BRAVE_TOKEN;
48
+ const freesoundKey = env.REFKIT_FREESOUND_KEY ?? env.FREESOUND_TOKEN;
49
+ const jamendoClientId = env.REFKIT_JAMENDO_CLIENT_ID ?? env.JAMENDO_CLIENT_ID;
50
+ const europeanaKey = env.REFKIT_EUROPEANA_KEY ?? env.EUROPEANA_KEY;
51
+ if (unsplashKey) providers.push(unsplash({ accessKey: unsplashKey }));
52
+ if (pexelsKey) providers.push(pexels({ apiKey: pexelsKey }), pexelsVideo({ apiKey: pexelsKey }));
53
+ if (pixabayKey) providers.push(pixabay({ key: pixabayKey }), pixabayVideo({ key: pixabayKey }));
54
+ if (flickrKey) providers.push(flickr({ apiKey: flickrKey }));
55
+ if (smithsonianKey) providers.push(smithsonian({ apiKey: smithsonianKey }));
56
+ if (braveKey) providers.push(brave({ token: braveKey }));
57
+ if (freesoundKey) providers.push(freesound({ apiKey: freesoundKey }));
58
+ if (jamendoClientId) providers.push(jamendo({ clientId: jamendoClientId }));
59
+ if (europeanaKey) providers.push(europeana({ apiKey: europeanaKey }));
51
60
  return providers;
52
61
  }
53
62
  var isEntry = (() => {
package/dist/cli.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/cli.ts"],"sourcesContent":["#!/usr/bin/env node\n// Zero-config entry: `npx @refkit/mcp` boots a working MCP server with the keyless\n// providers, plus any BYOK provider whose key is in the environment. No host code.\nimport { realpathSync } from 'node:fs'\nimport { fileURLToPath } from 'node:url'\nimport { createRefkit, type ReferenceProvider } from '@refkit/core'\nimport { openverse, openverseAudio } from '@refkit/provider-openverse'\nimport { wikimediaCommons } from '@refkit/provider-wikimedia-commons'\nimport { met } from '@refkit/provider-met'\nimport { artic } from '@refkit/provider-artic'\nimport { gutendex } from '@refkit/provider-gutendex'\nimport { poetrydb } from '@refkit/provider-poetrydb'\nimport { unsplash } from '@refkit/provider-unsplash'\nimport { pexels, pexelsVideo } from '@refkit/provider-pexels'\nimport { pixabay, pixabayVideo } from '@refkit/provider-pixabay'\nimport { flickr } from '@refkit/provider-flickr'\nimport { smithsonian } from '@refkit/provider-smithsonian'\nimport { brave } from '@refkit/provider-brave'\nimport { rijksmuseum } from '@refkit/provider-rijksmuseum'\nimport { polyhaven, ambientcg } from '@refkit/provider-polyhaven'\nimport { freesound } from '@refkit/provider-freesound'\nimport { jamendo } from '@refkit/provider-jamendo'\nimport { europeana } from '@refkit/provider-europeana'\nimport { internetArchive } from '@refkit/provider-internet-archive'\nimport { serveStdio } from './index'\n\n/** Providers a zero-config server boots with: all keyless sources, plus any BYOK\n * source whose key is present in `env`. Exported so the wiring is unit-testable. */\nexport function defaultProviders(env: NodeJS.ProcessEnv = process.env): ReferenceProvider[] {\n const providers: ReferenceProvider[] = [\n openverse(), openverseAudio(), wikimediaCommons(), met(), artic(), gutendex(), poetrydb(),\n rijksmuseum(), polyhaven(), ambientcg(), internetArchive(),\n ]\n if (env.UNSPLASH_KEY) providers.push(unsplash({ accessKey: env.UNSPLASH_KEY }))\n if (env.PEXELS_KEY) providers.push(pexels({ apiKey: env.PEXELS_KEY }), pexelsVideo({ apiKey: env.PEXELS_KEY }))\n if (env.PIXABAY_KEY) providers.push(pixabay({ key: env.PIXABAY_KEY }), pixabayVideo({ key: env.PIXABAY_KEY }))\n if (env.FLICKR_KEY) providers.push(flickr({ apiKey: env.FLICKR_KEY }))\n if (env.SI_KEY) providers.push(smithsonian({ apiKey: env.SI_KEY }))\n if (env.BRAVE_TOKEN) providers.push(brave({ token: env.BRAVE_TOKEN }))\n if (env.FREESOUND_TOKEN) providers.push(freesound({ apiKey: env.FREESOUND_TOKEN }))\n if (env.JAMENDO_CLIENT_ID) providers.push(jamendo({ clientId: env.JAMENDO_CLIENT_ID }))\n if (env.EUROPEANA_KEY) providers.push(europeana({ apiKey: env.EUROPEANA_KEY }))\n return providers\n}\n\n// Boot only when run as the CLI entry — not when imported (e.g. by tests). realpath\n// so an npm bin symlink resolves to this file.\nconst isEntry = (() => {\n if (!process.argv[1]) return false\n try {\n return realpathSync(process.argv[1]) === fileURLToPath(import.meta.url)\n } catch {\n return false\n }\n})()\n\nif (isEntry) {\n await serveStdio(createRefkit({ providers: defaultProviders() }))\n}\n"],"mappings":";;;;;;AAGA,SAAS,oBAAoB;AAC7B,SAAS,qBAAqB;AAC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AAY,CAAC,CAAC;AACrE,MAAI,IAAI,gBAAiB,WAAU,KAAK,UAAU,EAAE,QAAQ,IAAI,gBAAgB,CAAC,CAAC;AAClF,MAAI,IAAI,kBAAmB,WAAU,KAAK,QAAQ,EAAE,UAAU,IAAI,kBAAkB,CAAC,CAAC;AACtF,MAAI,IAAI,cAAe,WAAU,KAAK,UAAU,EAAE,QAAQ,IAAI,cAAc,CAAC,CAAC;AAC9E,SAAO;AACT;AAIA,IAAM,WAAW,MAAM;AACrB,MAAI,CAAC,QAAQ,KAAK,CAAC,EAAG,QAAO;AAC7B,MAAI;AACF,WAAO,aAAa,QAAQ,KAAK,CAAC,CAAC,MAAM,cAAc,YAAY,GAAG;AAAA,EACxE,QAAQ;AACN,WAAO;AAAA,EACT;AACF,GAAG;AAEH,IAAI,SAAS;AACX,QAAM,WAAW,aAAa,EAAE,WAAW,iBAAiB,EAAE,CAAC,CAAC;AAClE;","names":[]}
1
+ {"version":3,"sources":["../src/cli.ts"],"sourcesContent":["#!/usr/bin/env node\n// Zero-config entry: `npx @refkit/mcp` boots a working MCP server with the keyless\n// providers, plus any BYOK provider whose key is in the environment. No host code.\nimport { realpathSync } from 'node:fs'\nimport { fileURLToPath } from 'node:url'\nimport { createRefkit, type ReferenceProvider } from '@refkit/core'\nimport { openverse, openverseAudio } from '@refkit/provider-openverse'\nimport { wikimediaCommons } from '@refkit/provider-wikimedia-commons'\nimport { met } from '@refkit/provider-met'\nimport { artic } from '@refkit/provider-artic'\nimport { gutendex } from '@refkit/provider-gutendex'\nimport { poetrydb } from '@refkit/provider-poetrydb'\nimport { unsplash } from '@refkit/provider-unsplash'\nimport { pexels, pexelsVideo } from '@refkit/provider-pexels'\nimport { pixabay, pixabayVideo } from '@refkit/provider-pixabay'\nimport { flickr } from '@refkit/provider-flickr'\nimport { smithsonian } from '@refkit/provider-smithsonian'\nimport { brave } from '@refkit/provider-brave'\nimport { rijksmuseum } from '@refkit/provider-rijksmuseum'\nimport { polyhaven, ambientcg } from '@refkit/provider-polyhaven'\nimport { freesound } from '@refkit/provider-freesound'\nimport { jamendo } from '@refkit/provider-jamendo'\nimport { europeana } from '@refkit/provider-europeana'\nimport { internetArchive } from '@refkit/provider-internet-archive'\nimport { serveStdio } from './index'\n\n/** Providers a zero-config server boots with: all keyless sources, plus any BYOK\n * source whose key is present in `env`. Exported so the wiring is unit-testable.\n *\n * Env var convention: each BYOK key is read as `REFKIT_<PROVIDER>_KEY` first (the\n * unified name), falling back to the provider's legacy env var name — both are\n * honored indefinitely, the unified name is just preferred going forward. */\nexport function defaultProviders(env: NodeJS.ProcessEnv = process.env): ReferenceProvider[] {\n const providers: ReferenceProvider[] = [\n openverse(), openverseAudio(), wikimediaCommons(), met(), artic(), gutendex(), poetrydb(),\n rijksmuseum(), polyhaven(), ambientcg(), internetArchive(),\n ]\n const unsplashKey = env.REFKIT_UNSPLASH_KEY ?? env.UNSPLASH_KEY\n const pexelsKey = env.REFKIT_PEXELS_KEY ?? env.PEXELS_KEY\n const pixabayKey = env.REFKIT_PIXABAY_KEY ?? env.PIXABAY_KEY\n const flickrKey = env.REFKIT_FLICKR_KEY ?? env.FLICKR_KEY\n const smithsonianKey = env.REFKIT_SMITHSONIAN_KEY ?? env.SI_KEY\n const braveKey = env.REFKIT_BRAVE_KEY ?? env.BRAVE_TOKEN\n const freesoundKey = env.REFKIT_FREESOUND_KEY ?? env.FREESOUND_TOKEN\n const jamendoClientId = env.REFKIT_JAMENDO_CLIENT_ID ?? env.JAMENDO_CLIENT_ID\n const europeanaKey = env.REFKIT_EUROPEANA_KEY ?? env.EUROPEANA_KEY\n if (unsplashKey) providers.push(unsplash({ accessKey: unsplashKey }))\n if (pexelsKey) providers.push(pexels({ apiKey: pexelsKey }), pexelsVideo({ apiKey: pexelsKey }))\n if (pixabayKey) providers.push(pixabay({ key: pixabayKey }), pixabayVideo({ key: pixabayKey }))\n if (flickrKey) providers.push(flickr({ apiKey: flickrKey }))\n if (smithsonianKey) providers.push(smithsonian({ apiKey: smithsonianKey }))\n if (braveKey) providers.push(brave({ token: braveKey }))\n if (freesoundKey) providers.push(freesound({ apiKey: freesoundKey }))\n if (jamendoClientId) providers.push(jamendo({ clientId: jamendoClientId }))\n if (europeanaKey) providers.push(europeana({ apiKey: europeanaKey }))\n return providers\n}\n\n// Boot only when run as the CLI entry — not when imported (e.g. by tests). realpath\n// so an npm bin symlink resolves to this file.\nconst isEntry = (() => {\n if (!process.argv[1]) return false\n try {\n return realpathSync(process.argv[1]) === fileURLToPath(import.meta.url)\n } catch {\n return false\n }\n})()\n\nif (isEntry) {\n await serveStdio(createRefkit({ providers: defaultProviders() }))\n}\n"],"mappings":";;;;;;AAGA,SAAS,oBAAoB;AAC7B,SAAS,qBAAqB;AAC9B,SAAS,oBAA4C;AACrD,SAAS,WAAW,sBAAsB;AAC1C,SAAS,wBAAwB;AACjC,SAAS,WAAW;AACpB,SAAS,aAAa;AACtB,SAAS,gBAAgB;AACzB,SAAS,gBAAgB;AACzB,SAAS,gBAAgB;AACzB,SAAS,QAAQ,mBAAmB;AACpC,SAAS,SAAS,oBAAoB;AACtC,SAAS,cAAc;AACvB,SAAS,mBAAmB;AAC5B,SAAS,aAAa;AACtB,SAAS,mBAAmB;AAC5B,SAAS,WAAW,iBAAiB;AACrC,SAAS,iBAAiB;AAC1B,SAAS,eAAe;AACxB,SAAS,iBAAiB;AAC1B,SAAS,uBAAuB;AASzB,SAAS,iBAAiB,MAAyB,QAAQ,KAA0B;AAC1F,QAAM,YAAiC;AAAA,IACrC,UAAU;AAAA,IAAG,eAAe;AAAA,IAAG,iBAAiB;AAAA,IAAG,IAAI;AAAA,IAAG,MAAM;AAAA,IAAG,SAAS;AAAA,IAAG,SAAS;AAAA,IACxF,YAAY;AAAA,IAAG,UAAU;AAAA,IAAG,UAAU;AAAA,IAAG,gBAAgB;AAAA,EAC3D;AACA,QAAM,cAAc,IAAI,uBAAuB,IAAI;AACnD,QAAM,YAAY,IAAI,qBAAqB,IAAI;AAC/C,QAAM,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AAiB,EAAE,CAAC,CAAC;AAClE;","names":[]}
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  createRefkitMcpServer,
3
3
  serveStdio
4
- } from "./chunk-B5SVJVI4.js";
4
+ } from "./chunk-6JDNSEQM.js";
5
5
  export {
6
6
  createRefkitMcpServer,
7
7
  serveStdio
package/package.json CHANGED
@@ -1,9 +1,16 @@
1
1
  {
2
2
  "name": "@refkit/mcp",
3
- "version": "0.4.0",
3
+ "version": "0.5.1",
4
4
  "description": "MCP server for refkit — exposes license-normalized reference search as an agent tool.",
5
5
  "type": "module",
6
6
  "license": "Apache-2.0",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "git+https://github.com/refkitjs/refkit.git",
10
+ "directory": "packages/mcp"
11
+ },
12
+ "homepage": "https://github.com/refkitjs/refkit/tree/main/packages/mcp#readme",
13
+ "bugs": "https://github.com/refkitjs/refkit/issues",
7
14
  "keywords": [
8
15
  "refkit",
9
16
  "mcp",
@@ -27,25 +34,25 @@
27
34
  "dependencies": {
28
35
  "@modelcontextprotocol/sdk": "^1.29.0",
29
36
  "zod": "^4.3.6",
30
- "@refkit/core": "0.5.0",
31
- "@refkit/provider-artic": "0.2.1",
32
- "@refkit/provider-brave": "0.2.1",
33
- "@refkit/provider-flickr": "0.2.1",
34
- "@refkit/provider-europeana": "0.2.0",
35
- "@refkit/provider-gutendex": "0.2.1",
36
- "@refkit/provider-freesound": "0.2.0",
37
- "@refkit/provider-internet-archive": "0.2.0",
38
- "@refkit/provider-jamendo": "0.2.0",
39
- "@refkit/provider-met": "0.2.1",
40
- "@refkit/provider-pexels": "0.2.1",
41
- "@refkit/provider-openverse": "0.2.1",
42
- "@refkit/provider-pixabay": "0.2.1",
43
- "@refkit/provider-polyhaven": "0.2.0",
44
- "@refkit/provider-poetrydb": "0.2.1",
45
- "@refkit/provider-rijksmuseum": "0.2.0",
46
- "@refkit/provider-smithsonian": "0.2.1",
47
- "@refkit/provider-unsplash": "0.2.1",
48
- "@refkit/provider-wikimedia-commons": "0.2.1"
37
+ "@refkit/core": "0.6.1",
38
+ "@refkit/provider-artic": "0.2.3",
39
+ "@refkit/provider-brave": "0.2.3",
40
+ "@refkit/provider-europeana": "0.3.1",
41
+ "@refkit/provider-flickr": "0.3.1",
42
+ "@refkit/provider-freesound": "0.3.1",
43
+ "@refkit/provider-gutendex": "0.2.3",
44
+ "@refkit/provider-internet-archive": "0.3.1",
45
+ "@refkit/provider-jamendo": "0.3.1",
46
+ "@refkit/provider-met": "0.2.3",
47
+ "@refkit/provider-openverse": "0.3.1",
48
+ "@refkit/provider-pexels": "0.2.3",
49
+ "@refkit/provider-pixabay": "0.2.3",
50
+ "@refkit/provider-poetrydb": "0.2.3",
51
+ "@refkit/provider-polyhaven": "0.2.2",
52
+ "@refkit/provider-rijksmuseum": "0.2.2",
53
+ "@refkit/provider-smithsonian": "0.2.3",
54
+ "@refkit/provider-unsplash": "0.2.3",
55
+ "@refkit/provider-wikimedia-commons": "0.3.1"
49
56
  },
50
57
  "files": [
51
58
  "dist",
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/index.ts"],"sourcesContent":["import { readFileSync } from 'node:fs'\nimport { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js'\nimport { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js'\nimport { z } from 'zod'\nimport type { RefkitClient, Reference, Verdict, Attribution, SearchFilters, SearchControls, SearchControlKey, ProviderOptionsById, SearchMeta } from '@refkit/core'\n\nconst MODALITIES = ['image', 'video', 'audio', 'text'] as const\nconst INTENTS = ['internal-moodboard', 'commercial-product', 'ai-generation-input', 'redistribution'] as const\nconst ORIENTATIONS = ['landscape', 'portrait', 'square'] as const\nconst SEARCH_CONTROL_KEYS = [\n 'orientation',\n 'color',\n 'language',\n 'sort',\n 'safety',\n 'license.commercial',\n 'license.modification',\n 'license.allowUnknown',\n 'media.kind',\n 'media.size',\n 'media.minWidth',\n 'media.minHeight',\n 'media.duration',\n 'creator.id',\n 'creator.name',\n 'text.copyright',\n 'page',\n] as const satisfies readonly SearchControlKey[]\n\nconst filtersSchema = z.object({\n color: z.string().optional(),\n orientation: z.enum(ORIENTATIONS).optional(),\n language: z.string().optional(),\n})\nconst searchControlKeySchema = z.enum(SEARCH_CONTROL_KEYS)\n\nconst searchControlsSchema = z.object({\n orientation: z.enum(ORIENTATIONS).optional(),\n color: z.string().optional(),\n language: z.string().optional(),\n sort: z.enum(['relevance', 'latest', 'popular', 'interesting']).optional(),\n safety: z.enum(['strict', 'moderate', 'off']).optional(),\n license: z.object({\n commercial: z.boolean().optional(),\n modification: z.boolean().optional(),\n allowUnknown: z.boolean().optional(),\n }).optional(),\n media: z.object({\n kind: z.enum(['photo', 'illustration', 'vector', 'film', 'animation']).optional(),\n size: z.enum(['small', 'medium', 'large']).optional(),\n minWidth: z.number().int().nonnegative().optional(),\n minHeight: z.number().int().nonnegative().optional(),\n duration: z.enum(['short', 'medium', 'long']).optional(),\n }).optional(),\n creator: z.object({\n id: z.string().optional(),\n name: z.string().optional(),\n }).optional(),\n text: z.object({\n copyright: z.enum(['public-domain', 'copyrighted', 'any']).optional(),\n }).optional(),\n page: z.number().int().positive().optional(),\n})\n\nconst providerOptionValueSchema = z.union([z.string(), z.number(), z.boolean(), z.array(z.string())])\nconst providerOptionsSchema = z.record(z.string(), z.record(z.string(), providerOptionValueSchema))\n\n// Reported in the MCP initialize handshake. Read the real version (the dist sits\n// next to package.json, which npm always ships) instead of a hardcoded placeholder.\nconst VERSION: string = (() => {\n try {\n return JSON.parse(readFileSync(new URL('../package.json', import.meta.url), 'utf8')).version\n } catch {\n return '0.0.0'\n }\n})()\n\n// Concise, agent-facing projection of a Reference (no raw provider dump). When an\n// intent is supplied the use-gate verdict + attribution ride along, so the agent\n// sees *whether it may use* each result — not just a bare license id it ignores.\nfunction toAgentRef(r: Reference, assessment?: { verdict: Verdict; attribution: Attribution }) {\n const base = {\n id: r.id,\n title: r.title,\n modality: r.modality,\n provider: r.source.providerId,\n canonicalUrl: r.canonicalUrl,\n license: r.rights.license,\n thumbnail: r.thumbnail?.url,\n excerpt: r.text?.excerpt,\n }\n if (!assessment) return base\n const { verdict, attribution } = assessment\n const reason = verdict.reasons.join('; ')\n const useExplanation = `${verdict.decision}: ${reason || 'license facts allow this use'}${attribution.required && attribution.text ? ` Attribution required: ${attribution.text}` : ''}`\n return {\n ...base,\n useVerdict: { decision: verdict.decision, reason: verdict.reasons.join('; '), confidence: verdict.confidence },\n useExplanation,\n ...(attribution.required && attribution.text ? { attribution: attribution.text } : {}),\n }\n}\n\nconst agentRefSchema = z.object({\n id: z.string(),\n title: z.string().optional(),\n modality: z.string(),\n provider: z.string(),\n canonicalUrl: z.string(),\n license: z.string(),\n thumbnail: z.string().optional(),\n excerpt: z.string().optional(),\n useVerdict: z\n .object({ decision: z.string(), reason: z.string(), confidence: z.string() })\n .optional()\n .describe('present when `intent` (or `gateFor`) is set: may this be used for that intent, and how confident'),\n useExplanation: z.string().optional().describe('plain-language use verdict summary for agents'),\n attribution: z.string().optional().describe('ready-to-use credit line; present when the license requires attribution'),\n})\n\nconst searchMetaSchema: z.ZodType<SearchMeta> = z.object({\n query: z.string(),\n modalities: z.array(z.enum(MODALITIES)),\n limit: z.number(),\n poolFactor: z.number(),\n fetchLimit: z.number(),\n appliedFilters: filtersSchema.optional(),\n controls: z.object({\n requested: z.array(searchControlKeySchema),\n appliedByProvider: z.record(z.string(), z.array(searchControlKeySchema)),\n ignoredByProvider: z.record(z.string(), z.array(searchControlKeySchema)),\n }).optional(),\n providerOptions: z.array(z.string()).optional(),\n providers: z.array(z.object({\n providerId: z.string(),\n status: z.enum(['fulfilled', 'failed', 'skipped']),\n returned: z.number().optional(),\n accepted: z.number().optional(),\n rejected: z.number().optional(),\n reason: z.enum(['unsupported-modality']).optional(),\n error: z.string().optional(),\n })),\n gate: z.object({\n intent: z.enum(INTENTS),\n before: z.number(),\n after: z.number(),\n dropped: z.number(),\n }).optional(),\n warnings: z.array(z.string()),\n})\n\n/** Wrap a configured RefkitClient as an MCP server exposing `search_references`. */\nexport function createRefkitMcpServer(refkit: RefkitClient): McpServer {\n const server = new McpServer({ name: 'refkit', version: VERSION })\n\n server.registerTool(\n 'search_references',\n {\n title: 'Search creative references',\n description:\n 'Search license-normalized reference material (image / video / audio / text) across the configured sources. ' +\n 'Every result carries a license id + canonical source link. Pass `intent` to annotate each result with a ' +\n 'use-verdict (may I use this, is attribution required) WITHOUT filtering; pass `gateFor` to instead return ' +\n 'only results whose license allows that intent. Results are references, not rights clearance — not legal advice.',\n inputSchema: {\n query: z.string().describe('what to search for, e.g. \"cyberpunk alley at night\"'),\n modalities: z.array(z.enum(MODALITIES)).optional().describe('default [\"image\"]'),\n filters: filtersSchema.optional().describe('compatibility alias for controls.orientation, controls.color, and controls.language'),\n controls: searchControlsSchema.optional().describe('provider-neutral search controls; providers translate supported controls and report ignored controls in explain metadata'),\n providerOptions: providerOptionsSchema.optional().describe('provider-specific search controls keyed by provider id; each provider whitelists supported keys'),\n explain: z.boolean().optional().describe('include provider status, applied and ignored controls, warnings, and gate/drop metadata'),\n limit: z.number().int().positive().optional(),\n intent: z.enum(INTENTS).optional().describe('annotate each result with a use-verdict for this intended use (no filtering)'),\n gateFor: z.enum(INTENTS).optional().describe('only return results whose license allows this intended use'),\n },\n outputSchema: { references: z.array(agentRefSchema), meta: searchMetaSchema.optional() },\n },\n async ({ query, modalities, filters, controls, providerOptions, explain, limit, intent, gateFor }) => {\n const searchInput = {\n query,\n modalities: modalities ?? ['image'],\n filters: filters as SearchFilters | undefined,\n controls: controls as SearchControls | undefined,\n providerOptions: providerOptions as ProviderOptionsById | undefined,\n limit,\n gateFor,\n }\n const result = explain ? await refkit.searchWithMeta(searchInput) : { references: await refkit.search(searchInput), meta: undefined }\n const refs = result.references\n const assessIntent = intent ?? gateFor\n const references = refs.map(r =>\n assessIntent\n ? toAgentRef(r, { verdict: refkit.evaluateUse(r, assessIntent), attribution: refkit.buildAttribution(r) })\n : toAgentRef(r),\n )\n return {\n content: [{ type: 'text', text: `${references.length} reference(s) for \"${query}\".` }],\n structuredContent: { references, ...(result.meta ? { meta: result.meta } : {}) },\n }\n },\n )\n\n return server\n}\n\n/** Run the refkit MCP server over stdio (host wires the RefkitClient + its providers/keys). */\nexport async function serveStdio(refkit: RefkitClient): Promise<void> {\n const server = createRefkitMcpServer(refkit)\n await server.connect(new StdioServerTransport())\n}\n"],"mappings":";AAAA,SAAS,oBAAoB;AAC7B,SAAS,iBAAiB;AAC1B,SAAS,4BAA4B;AACrC,SAAS,SAAS;AAGlB,IAAM,aAAa,CAAC,SAAS,SAAS,SAAS,MAAM;AACrD,IAAM,UAAU,CAAC,sBAAsB,sBAAsB,uBAAuB,gBAAgB;AACpG,IAAM,eAAe,CAAC,aAAa,YAAY,QAAQ;AACvD,IAAM,sBAAsB;AAAA,EAC1B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAEA,IAAM,gBAAgB,EAAE,OAAO;AAAA,EAC7B,OAAO,EAAE,OAAO,EAAE,SAAS;AAAA,EAC3B,aAAa,EAAE,KAAK,YAAY,EAAE,SAAS;AAAA,EAC3C,UAAU,EAAE,OAAO,EAAE,SAAS;AAChC,CAAC;AACD,IAAM,yBAAyB,EAAE,KAAK,mBAAmB;AAEzD,IAAM,uBAAuB,EAAE,OAAO;AAAA,EACpC,aAAa,EAAE,KAAK,YAAY,EAAE,SAAS;AAAA,EAC3C,OAAO,EAAE,OAAO,EAAE,SAAS;AAAA,EAC3B,UAAU,EAAE,OAAO,EAAE,SAAS;AAAA,EAC9B,MAAM,EAAE,KAAK,CAAC,aAAa,UAAU,WAAW,aAAa,CAAC,EAAE,SAAS;AAAA,EACzE,QAAQ,EAAE,KAAK,CAAC,UAAU,YAAY,K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