functype-mcp-server 0.47.0 → 0.50.0

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/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2023 Jordan
3
+ Copyright (c) 2025 Jordan Burke
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
@@ -18,4 +18,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
18
  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
19
  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
20
  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
21
+ SOFTWARE.
package/README.md CHANGED
@@ -2,6 +2,8 @@
2
2
 
3
3
  MCP server for [functype](https://github.com/jordanburke/functype) — documentation lookup and compile-time TypeScript code validation for AI editors.
4
4
 
5
+ This package is part of the [functype monorepo](https://github.com/jordanburke/functype).
6
+
5
7
  ## Features
6
8
 
7
9
  - **`search_docs`** — Search functype documentation by keyword or type name
@@ -47,8 +49,8 @@ Add to your project's `.mcp.json`:
47
49
  ### From Source
48
50
 
49
51
  ```bash
50
- git clone https://github.com/jordanburke/functype-mcp-server.git
51
- cd functype-mcp-server
52
+ git clone https://github.com/jordanburke/functype.git
53
+ cd functype/mcp-server
52
54
  pnpm install
53
55
  pnpm build
54
56
  ```
package/dist/bin.js CHANGED
@@ -3,12 +3,12 @@
3
3
  if (!process.env.TRANSPORT_TYPE) process.env.TRANSPORT_TYPE = "stdio";
4
4
  const args = process.argv.slice(2);
5
5
  if (args.includes("--version") || args.includes("-v")) {
6
- console.log("0.47.0");
6
+ console.log("0.50.0");
7
7
  process.exit(0);
8
8
  }
9
9
  if (args.includes("--help") || args.includes("-h")) {
10
10
  console.log(`
11
- functype-mcp-server v0.47.0
11
+ functype-mcp-server v0.50.0
12
12
 
13
13
  MCP server for functype documentation lookup and TypeScript code validation.
14
14
 
@@ -29,7 +29,7 @@ Tools:
29
29
  get_interfaces Get interface hierarchy
30
30
  validate_code Type-check functype code snippets
31
31
 
32
- For more information: https://github.com/jordanburke/functype-mcp-server
32
+ For more information: https://github.com/jordanburke/functype/tree/main/mcp-server
33
33
  `);
34
34
  process.exit(0);
35
35
  }
@@ -37,7 +37,7 @@ async function main() {
37
37
  await import("./index.js");
38
38
  }
39
39
  main().then();
40
-
41
40
  //#endregion
42
- export { };
41
+ export {};
42
+
43
43
  //# sourceMappingURL=bin.js.map
package/dist/bin.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"bin.js","names":[],"sources":["../src/bin.ts"],"sourcesContent":["#!/usr/bin/env node\n\ndeclare const __VERSION__: string\n\nif (!process.env.TRANSPORT_TYPE) {\n process.env.TRANSPORT_TYPE = \"stdio\"\n}\n\nconst args = process.argv.slice(2)\n\nif (args.includes(\"--version\") || args.includes(\"-v\")) {\n console.log(__VERSION__)\n process.exit(0)\n}\n\nif (args.includes(\"--help\") || args.includes(\"-h\")) {\n console.log(`\nfunctype-mcp-server v${__VERSION__}\n\nMCP server for functype documentation lookup and TypeScript code validation.\n\nUsage: functype-mcp-server [options]\n\nOptions:\n -v, --version Show version number\n -h, --help Show help\n\nEnvironment Variables:\n TRANSPORT_TYPE Transport mode: \"stdio\" (default) or \"httpStream\"\n PORT HTTP port (default: 3000)\n HOST HTTP host (default: 0.0.0.0)\n\nTools:\n search_docs Search functype documentation\n get_type_api Get detailed type API reference\n get_interfaces Get interface hierarchy\n validate_code Type-check functype code snippets\n\nFor more information: https://github.com/jordanburke/functype-mcp-server\n`)\n process.exit(0)\n}\n\nasync function main() {\n await import(\"./index.js\")\n}\n\nmain().then()\n"],"mappings":";;AAIA,IAAI,CAAC,QAAQ,IAAI,eACf,SAAQ,IAAI,iBAAiB;AAG/B,MAAM,OAAO,QAAQ,KAAK,MAAM,EAAE;AAElC,IAAI,KAAK,SAAS,YAAY,IAAI,KAAK,SAAS,KAAK,EAAE;AACrD,SAAQ,aAAgB;AACxB,SAAQ,KAAK,EAAE;;AAGjB,IAAI,KAAK,SAAS,SAAS,IAAI,KAAK,SAAS,KAAK,EAAE;AAClD,SAAQ,IAAI;;;;;;;;;;;;;;;;;;;;;;;EAuBZ;AACA,SAAQ,KAAK,EAAE;;AAGjB,eAAe,OAAO;AACpB,OAAM,OAAO;;AAGf,MAAM,CAAC,MAAM"}
1
+ {"version":3,"file":"bin.js","names":[],"sources":["../src/bin.ts"],"sourcesContent":["#!/usr/bin/env node\n\ndeclare const __VERSION__: string\n\nif (!process.env.TRANSPORT_TYPE) {\n process.env.TRANSPORT_TYPE = \"stdio\"\n}\n\nconst args = process.argv.slice(2)\n\nif (args.includes(\"--version\") || args.includes(\"-v\")) {\n console.log(__VERSION__)\n process.exit(0)\n}\n\nif (args.includes(\"--help\") || args.includes(\"-h\")) {\n console.log(`\nfunctype-mcp-server v${__VERSION__}\n\nMCP server for functype documentation lookup and TypeScript code validation.\n\nUsage: functype-mcp-server [options]\n\nOptions:\n -v, --version Show version number\n -h, --help Show help\n\nEnvironment Variables:\n TRANSPORT_TYPE Transport mode: \"stdio\" (default) or \"httpStream\"\n PORT HTTP port (default: 3000)\n HOST HTTP host (default: 0.0.0.0)\n\nTools:\n search_docs Search functype documentation\n get_type_api Get detailed type API reference\n get_interfaces Get interface hierarchy\n validate_code Type-check functype code snippets\n\nFor more information: https://github.com/jordanburke/functype/tree/main/mcp-server\n`)\n process.exit(0)\n}\n\nasync function main() {\n await import(\"./index.js\")\n}\n\nmain().then()\n"],"mappings":";;AAIA,IAAI,CAAC,QAAQ,IAAI,eACf,SAAQ,IAAI,iBAAiB;AAG/B,MAAM,OAAO,QAAQ,KAAK,MAAM,EAAE;AAElC,IAAI,KAAK,SAAS,YAAY,IAAI,KAAK,SAAS,KAAK,EAAE;AACrD,SAAQ,IAAA,SAAgB;AACxB,SAAQ,KAAK,EAAE;;AAGjB,IAAI,KAAK,SAAS,SAAS,IAAI,KAAK,SAAS,KAAK,EAAE;AAClD,SAAQ,IAAI;;;;;;;;;;;;;;;;;;;;;;;EAuBZ;AACA,SAAQ,KAAK,EAAE;;AAGjB,eAAe,OAAO;AACpB,OAAM,OAAO;;AAGf,MAAM,CAAC,MAAM"}
package/dist/index.js CHANGED
@@ -6,7 +6,6 @@ import { FastMCP } from "fastmcp";
6
6
  import { z } from "zod";
7
7
  import { readFileSync } from "node:fs";
8
8
  import ts from "typescript";
9
-
10
9
  //#region src/lib/docs/data.ts
11
10
  /**
12
11
  * Runtime loader for functype CLI data.
@@ -37,7 +36,6 @@ async function initDocsData(force) {
37
36
  console.error("[functype-mcp] Failed to load functype/cli data — doc tools will return empty results:", err);
38
37
  }
39
38
  }
40
-
41
39
  //#endregion
42
40
  //#region src/lib/docs/formatters.ts
43
41
  const METHOD_CATEGORIES = [
@@ -96,6 +94,8 @@ const formatInterfaces = () => {
96
94
  };
97
95
  const searchTypes = (query) => {
98
96
  const q = query.toLowerCase();
97
+ const exactMatch = TYPES[query];
98
+ if (exactMatch) return formatType(query, exactMatch);
99
99
  const matches = [];
100
100
  for (const [name, data] of Object.entries(TYPES)) {
101
101
  const nameMatch = name.toLowerCase().includes(q);
@@ -112,13 +112,16 @@ const searchTypes = (query) => {
112
112
  const match = matches[0];
113
113
  return formatType(match.name, match.data);
114
114
  }
115
+ const nameMatches = matches.filter((m) => m.name.toLowerCase().includes(q));
116
+ const otherMatches = matches.filter((m) => !m.name.toLowerCase().includes(q));
117
+ const sorted = [...nameMatches, ...otherMatches];
115
118
  const lines = [
116
119
  `# Search results for "${query}"`,
117
120
  "",
118
- `Found ${matches.length} matching types:`,
121
+ `Found ${sorted.length} matching types:`,
119
122
  ""
120
123
  ];
121
- for (const match of matches) {
124
+ for (const match of sorted) {
122
125
  const ifaces = match.data.interfaces.length > 0 ? ` [${match.data.interfaces.join(", ")}]` : "";
123
126
  lines.push(`**${match.name}**${ifaces}`);
124
127
  lines.push(` ${match.data.description}`, "");
@@ -138,7 +141,6 @@ const getTypeByName = (name) => {
138
141
  data: entry[1]
139
142
  };
140
143
  };
141
-
142
144
  //#endregion
143
145
  //#region src/lib/validator/compiler-host.ts
144
146
  /**
@@ -192,15 +194,15 @@ const createCompilerHost = (sourceCode) => {
192
194
  return {
193
195
  ...defaultHost,
194
196
  getSourceFile(fileName, languageVersion) {
195
- if (fileName === VIRTUAL_FILENAME) return ts.createSourceFile(fileName, sourceCode, languageVersion, true);
197
+ if (fileName === "/__functype_validate__.ts") return ts.createSourceFile(fileName, sourceCode, languageVersion, true);
196
198
  return defaultHost.getSourceFile(fileName, languageVersion);
197
199
  },
198
200
  fileExists(fileName) {
199
- if (fileName === VIRTUAL_FILENAME) return true;
201
+ if (fileName === "/__functype_validate__.ts") return true;
200
202
  return defaultHost.fileExists(fileName);
201
203
  },
202
204
  readFile(fileName) {
203
- if (fileName === VIRTUAL_FILENAME) return sourceCode;
205
+ if (fileName === "/__functype_validate__.ts") return sourceCode;
204
206
  return readFileCached(fileName) ?? defaultHost.readFile(fileName);
205
207
  },
206
208
  resolveModuleNames(moduleNames, containingFile) {
@@ -224,7 +226,6 @@ const createCompilerHost = (sourceCode) => {
224
226
  }
225
227
  };
226
228
  };
227
-
228
229
  //#endregion
229
230
  //#region src/lib/validator/validate.ts
230
231
  /**
@@ -254,11 +255,10 @@ const validateCode = (code, options = {}) => {
254
255
  importsPrepended: shouldPrepend
255
256
  };
256
257
  };
257
-
258
258
  //#endregion
259
259
  //#region src/index.ts
260
260
  const PROJECT_ROOT = dirname(dirname(fileURLToPath(import.meta.url)));
261
- const SERVER_VERSION = "0.47.0";
261
+ const SERVER_VERSION = "0.50.0";
262
262
  function createServer() {
263
263
  const server = new FastMCP({
264
264
  name: "functype-mcp-server",
@@ -373,7 +373,7 @@ async function main() {
373
373
  process.on("SIGINT", () => process.exit(0));
374
374
  process.on("SIGTERM", () => process.exit(0));
375
375
  main().catch(console.error);
376
-
377
376
  //#endregion
378
- export { };
377
+ export {};
378
+
379
379
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["require"],"sources":["../src/lib/docs/data.ts","../src/lib/docs/formatters.ts","../src/lib/validator/compiler-host.ts","../src/lib/validator/validate.ts","../src/index.ts"],"sourcesContent":["/**\n * Runtime loader for functype CLI data.\n * Uses dynamic import so the data reflects whichever functype version\n * is installed in node_modules at runtime (not baked in at build time).\n */\n\nimport { createRequire } from \"node:module\"\nimport { pathToFileURL } from \"node:url\"\n\nexport type { InterfaceData, TypeData } from \"functype/cli\"\nimport type { InterfaceData, TypeData } from \"functype/cli\"\n\nconst require = createRequire(import.meta.url)\n\nexport let TYPES: Record<string, TypeData> = {}\nexport let INTERFACES: Record<string, InterfaceData> = {}\nexport let CATEGORIES: Record<string, string[]> = {}\nexport let FULL_INTERFACES: Record<string, string> = {}\nexport let VERSION = \"unknown\"\n\nlet initialized = false\n\nexport async function initDocsData(force?: boolean): Promise<void> {\n if (initialized && !force) return\n\n try {\n let cli: typeof import(\"functype/cli\")\n if (force) {\n const resolvedPath = require.resolve(\"functype/cli\")\n cli = await import(`${pathToFileURL(resolvedPath).href}?t=${Date.now()}`)\n } else {\n cli = await import(\"functype/cli\")\n }\n TYPES = cli.TYPES\n INTERFACES = cli.INTERFACES\n CATEGORIES = cli.CATEGORIES\n FULL_INTERFACES = cli.FULL_INTERFACES\n VERSION = cli.VERSION\n initialized = true\n } catch (err) {\n if (force) throw err\n console.error(\"[functype-mcp] Failed to load functype/cli data — doc tools will return empty results:\", err)\n }\n}\n","/**\n * Markdown formatters for MCP tool output.\n * Plain TypeScript — no functype dependency in formatters.\n */\n\nimport type { InterfaceData, TypeData } from \"./data\"\nimport { CATEGORIES, FULL_INTERFACES, INTERFACES, TYPES, VERSION } from \"./data\"\n\nconst METHOD_CATEGORIES = [\"create\", \"transform\", \"extract\", \"check\", \"other\"] as const\n\nexport const formatOverview = (): string => {\n const lines: string[] = [`# functype ${VERSION} — Scala-inspired FP for TypeScript`, \"\"]\n\n for (const [category, typeNames] of Object.entries(CATEGORIES)) {\n lines.push(`## ${category}`, \"\")\n for (const name of typeNames) {\n const type = TYPES[name]\n if (type) {\n const ifaces = type.interfaces.length > 0 ? ` [${type.interfaces.join(\", \")}]` : \"\"\n lines.push(`**${name}**${ifaces}`)\n lines.push(` ${type.description}`, \"\")\n }\n }\n }\n\n lines.push(\"---\", \"Use `get_type_api` for detailed type reference.\", \"Use `get_interfaces` for interface hierarchy.\")\n return lines.join(\"\\n\")\n}\n\nexport const formatType = (name: string, data: TypeData, includeFullInterface?: boolean): string => {\n const ifaceList = data.interfaces.length > 0 ? ` [${data.interfaces.join(\", \")}]` : \"\"\n const lines: string[] = [`# ${name}<T>${ifaceList}`, \"\", data.description, \"\"]\n\n for (const cat of METHOD_CATEGORIES) {\n const methods = data.methods[cat]\n if (methods && methods.length > 0) {\n lines.push(`## ${cat.charAt(0).toUpperCase() + cat.slice(1)}`, \"\")\n for (const method of methods) {\n lines.push(`- \\`${method}\\``)\n }\n lines.push(\"\")\n }\n }\n\n if (includeFullInterface) {\n const fullInterface = FULL_INTERFACES[name]\n if (fullInterface) {\n lines.push(\"## Full Interface\", \"\", \"```typescript\", fullInterface, \"```\")\n }\n }\n\n return lines.join(\"\\n\").trimEnd()\n}\n\nexport const formatInterfaces = (): string => {\n const lines: string[] = [\"# Interfaces\", \"\"]\n\n for (const [name, data] of Object.entries(INTERFACES)) {\n const ext = data.extends ? ` extends ${data.extends}` : \"\"\n lines.push(`## ${name}<A>${ext}`, \"\", data.description, \"\")\n for (const method of data.methods) {\n lines.push(`- \\`${method}\\``)\n }\n lines.push(\"\")\n }\n\n return lines.join(\"\\n\").trimEnd()\n}\n\nexport const searchTypes = (query: string): string => {\n const q = query.toLowerCase()\n const matches: Array<{ name: string; data: TypeData }> = []\n\n for (const [name, data] of Object.entries(TYPES)) {\n const nameMatch = name.toLowerCase().includes(q)\n const descMatch = data.description.toLowerCase().includes(q)\n const ifaceMatch = data.interfaces.some((i) => i.toLowerCase().includes(q))\n const methodMatch = Object.values(data.methods)\n .flat()\n .some((m) => m.toLowerCase().includes(q))\n\n if (nameMatch || descMatch || ifaceMatch || methodMatch) {\n matches.push({ name, data })\n }\n }\n\n if (matches.length === 0) {\n return `No types found matching \"${query}\". Available types: ${Object.keys(TYPES).join(\", \")}`\n }\n\n if (matches.length === 1) {\n const match = matches[0]!\n return formatType(match.name, match.data)\n }\n\n const lines: string[] = [`# Search results for \"${query}\"`, \"\", `Found ${matches.length} matching types:`, \"\"]\n for (const match of matches) {\n const ifaces = match.data.interfaces.length > 0 ? ` [${match.data.interfaces.join(\", \")}]` : \"\"\n lines.push(`**${match.name}**${ifaces}`)\n lines.push(` ${match.data.description}`, \"\")\n }\n\n lines.push(\"---\", \"Use `get_type_api` with a specific type name for full details.\")\n return lines.join(\"\\n\")\n}\n\nexport const getTypeByName = (name: string): { name: string; data: TypeData } | undefined => {\n const direct = TYPES[name]\n if (direct) return { name, data: direct }\n\n const entry = Object.entries(TYPES).find(([typeName]) => typeName.toLowerCase() === name.toLowerCase())\n if (entry) return { name: entry[0], data: entry[1] }\n\n return undefined\n}\n\nexport const getInterfaceByName = (name: string): { name: string; data: InterfaceData } | undefined => {\n const direct = INTERFACES[name]\n if (direct) return { name, data: direct }\n\n const entry = Object.entries(INTERFACES).find(([ifaceName]) => ifaceName.toLowerCase() === name.toLowerCase())\n if (entry) return { name: entry[0], data: entry[1] }\n\n return undefined\n}\n","/**\n * Custom TypeScript CompilerHost for in-memory type-checking of functype code.\n * Resolves functype .d.ts files from node_modules for accurate type validation.\n */\n\nimport { readFileSync } from \"node:fs\"\nimport { createRequire } from \"node:module\"\nimport { dirname, join, resolve } from \"node:path\"\n\nimport ts from \"typescript\"\n\nconst require = createRequire(import.meta.url)\n\nconst resolveFunctypeDistDir = (): string => {\n // Resolve the main entry point, then walk up to find the dist dir\n const functypeMain = require.resolve(\"functype\")\n // functypeMain is something like .../node_modules/functype/dist/index.js\n // Walk up until we find a directory containing package.json\n let dir = dirname(functypeMain)\n for (let i = 0; i < 5; i++) {\n try {\n readFileSync(join(dir, \"package.json\"), \"utf-8\")\n return join(dir, \"dist\")\n } catch {\n dir = dirname(dir)\n }\n }\n // Fallback: assume dist is sibling to main\n return dirname(functypeMain)\n}\n\nconst fileCache = new Map<string, string | undefined>()\n\nexport const clearFileCache = (): void => {\n fileCache.clear()\n}\n\nconst readFileCached = (path: string): string | undefined => {\n if (fileCache.has(path)) return fileCache.get(path)\n try {\n const content = readFileSync(path, \"utf-8\")\n fileCache.set(path, content)\n return content\n } catch {\n fileCache.set(path, undefined)\n return undefined\n }\n}\n\nexport const VIRTUAL_FILENAME = \"/__functype_validate__.ts\"\n\nexport const compilerOptions: ts.CompilerOptions = {\n strict: true,\n target: ts.ScriptTarget.ES2020,\n module: ts.ModuleKind.ESNext,\n moduleResolution: ts.ModuleResolutionKind.Bundler,\n noEmit: true,\n noUncheckedIndexedAccess: true,\n skipLibCheck: true,\n esModuleInterop: true,\n allowSyntheticDefaultImports: true,\n declaration: false,\n sourceMap: false,\n}\n\nexport const createCompilerHost = (sourceCode: string): ts.CompilerHost => {\n const functypeDistDir = resolveFunctypeDistDir()\n const defaultHost = ts.createCompilerHost(compilerOptions)\n\n const host: ts.CompilerHost = {\n ...defaultHost,\n\n getSourceFile(fileName, languageVersion) {\n if (fileName === VIRTUAL_FILENAME) {\n return ts.createSourceFile(fileName, sourceCode, languageVersion, true)\n }\n return defaultHost.getSourceFile(fileName, languageVersion)\n },\n\n fileExists(fileName) {\n if (fileName === VIRTUAL_FILENAME) return true\n return defaultHost.fileExists(fileName)\n },\n\n readFile(fileName) {\n if (fileName === VIRTUAL_FILENAME) return sourceCode\n return readFileCached(fileName) ?? defaultHost.readFile(fileName)\n },\n\n resolveModuleNames(moduleNames, containingFile) {\n return moduleNames.map((moduleName): ts.ResolvedModule | undefined => {\n if (moduleName === \"functype\" || moduleName.startsWith(\"functype/\")) {\n const subpath = moduleName === \"functype\" ? \"index.d.ts\" : moduleName.replace(\"functype/\", \"\") + \".d.ts\"\n const resolvedFileName = resolve(functypeDistDir, subpath)\n if (readFileCached(resolvedFileName) !== undefined) {\n return { resolvedFileName, isExternalLibraryImport: true }\n }\n // Try with /index.d.ts for subpath modules\n const indexPath = resolve(functypeDistDir, subpath.replace(\".d.ts\", \"/index.d.ts\"))\n if (readFileCached(indexPath) !== undefined) {\n return { resolvedFileName: indexPath, isExternalLibraryImport: true }\n }\n return undefined\n }\n\n const result = ts.resolveModuleName(moduleName, containingFile, compilerOptions, defaultHost)\n return result.resolvedModule\n })\n },\n }\n\n return host\n}\n","/**\n * Core validation function — type-checks functype code snippets using the TypeScript Compiler API.\n */\n\nimport ts from \"typescript\"\n\nimport { compilerOptions, createCompilerHost, VIRTUAL_FILENAME } from \"./compiler-host\"\nimport type { ValidateOptions, ValidationDiagnostic, ValidationResult } from \"./types\"\n\nconst DEFAULT_IMPORTS = `import { Option, Some, None, Either, Right, Left, Try, List, Set, Map, Lazy, LazyList, Task, IO, Cond, Match, Brand, ValidatedBrand, Tuple, Stack, Ok, Err } from \"functype\"\\n`\n\nconst hasFunctypeImport = (code: string): boolean => /from\\s+[\"']functype(?:\\/[^\"']*)?[\"']/.test(code)\n\nexport const validateCode = (code: string, options: ValidateOptions = {}): ValidationResult => {\n const autoImport = options.autoImport ?? true\n const shouldPrepend = autoImport && !hasFunctypeImport(code)\n const importLineCount = shouldPrepend ? 1 : 0\n const fullCode = shouldPrepend ? DEFAULT_IMPORTS + code : code\n\n const host = createCompilerHost(fullCode)\n const program = ts.createProgram([VIRTUAL_FILENAME], compilerOptions, host)\n const allDiagnostics = ts.getPreEmitDiagnostics(program)\n\n const fileDiagnostics = allDiagnostics.filter((d) => d.file?.fileName === VIRTUAL_FILENAME)\n\n const rawDiagnostics = fileDiagnostics.map((d) => {\n const { line, character } = d.file!.getLineAndCharacterOfPosition(d.start ?? 0)\n return {\n originalLine: line,\n line: line - importLineCount + 1,\n column: character + 1,\n message: ts.flattenDiagnosticMessageText(d.messageText, \"\\n\"),\n code: d.code,\n severity: (d.category === ts.DiagnosticCategory.Error ? \"error\" : \"warning\") as \"error\" | \"warning\",\n }\n })\n\n // Filter out diagnostics from the prepended import line(s) and map to final type\n const userDiagnostics: ValidationDiagnostic[] = rawDiagnostics\n .filter((d) => !shouldPrepend || d.originalLine >= importLineCount)\n .map(({ originalLine: _, ...rest }) => rest)\n\n return {\n success: userDiagnostics.filter((d) => d.severity === \"error\").length === 0,\n diagnostics: userDiagnostics,\n importsPrepended: shouldPrepend,\n }\n}\n","import { execFileSync } from \"node:child_process\"\nimport { dirname } from \"node:path\"\nimport { fileURLToPath } from \"node:url\"\n\nimport { FastMCP } from \"fastmcp\"\nimport { z } from \"zod\"\n\nimport { FULL_INTERFACES, initDocsData, VERSION } from \"./lib/docs/data\"\nimport { formatInterfaces, formatOverview, formatType, getTypeByName, searchTypes } from \"./lib/docs/formatters\"\nimport { clearFileCache } from \"./lib/validator/compiler-host\"\nimport { validateCode } from \"./lib/validator/validate\"\n\nconst __dirname = dirname(fileURLToPath(import.meta.url))\nconst PROJECT_ROOT = dirname(__dirname)\n\ndeclare const __VERSION__: string\nconst SERVER_VERSION = (\n typeof __VERSION__ !== \"undefined\" ? __VERSION__ : \"0.0.0-dev\"\n) as `${number}.${number}.${number}`\n\nfunction createServer() {\n const server = new FastMCP({\n name: \"functype-mcp-server\",\n version: SERVER_VERSION,\n instructions: `Functype MCP Server — documentation lookup and code validation for the functype TypeScript FP library (v${VERSION}).\n\nAvailable tools:\n- search_docs: Search functype documentation by keyword or type name\n- get_type_api: Get detailed API reference for a specific type\n- get_interfaces: Get the interface hierarchy (Functor, Monad, Foldable, etc.)\n- validate_code: Type-check functype code snippets at compile time\n- set_functype_version: Switch the functype version at runtime (installs + reloads)\n\nUse validate_code to verify your functype code is type-correct before presenting it to the user.`,\n })\n\n server.addTool({\n name: \"search_docs\",\n description:\n \"Search functype documentation by keyword or type name. Omit query for a full overview of all types and categories.\",\n parameters: z.object({\n query: z.string().optional().describe(\"Type name or keyword to search for. Omit for full overview.\"),\n }),\n execute: async (args) => {\n if (!args.query || args.query.trim() === \"\") {\n return formatOverview()\n }\n return searchTypes(args.query)\n },\n })\n\n server.addTool({\n name: \"get_type_api\",\n description:\n \"Get detailed API reference for a specific functype type including methods by category and optionally the full TypeScript interface definition.\",\n parameters: z.object({\n type_name: z.string().describe(\"The type name (e.g., Option, Either, List, IO)\"),\n include_full_interface: z\n .boolean()\n .optional()\n .default(false)\n .describe(\"Include full TypeScript interface definition\"),\n }),\n execute: async (args) => {\n const found = getTypeByName(args.type_name)\n if (!found) {\n const available = Object.keys(FULL_INTERFACES).join(\", \")\n return `Type \"${args.type_name}\" not found. Available types: ${available}`\n }\n return formatType(found.name, found.data, args.include_full_interface)\n },\n })\n\n server.addTool({\n name: \"get_interfaces\",\n description:\n \"Get the functype interface hierarchy — Functor, Monad, Foldable, Extractable, Matchable, etc. — with their methods and inheritance.\",\n parameters: z.object({}),\n execute: async () => {\n return formatInterfaces()\n },\n })\n\n server.addTool({\n name: \"validate_code\",\n description:\n \"Type-check a functype code snippet using the TypeScript compiler. Returns PASSED or a list of type errors with line/column/message. Use this to verify functype code is type-correct before presenting to users.\",\n parameters: z.object({\n code: z.string().describe(\"TypeScript code snippet using functype to type-check\"),\n auto_import: z\n .boolean()\n .optional()\n .default(true)\n .describe(\"Automatically import all functype types if no import statement is present. Default: true\"),\n }),\n execute: async (args) => {\n const result = validateCode(args.code, { autoImport: args.auto_import })\n\n if (result.success) {\n const importNote = result.importsPrepended ? \" (functype imports auto-added)\" : \"\"\n return `Validation PASSED${importNote}\\n\\nThe code is type-correct.`\n }\n\n const errorLines = result.diagnostics.map((d) => `- Line ${d.line}, Col ${d.column}: ${d.message} (TS${d.code})`)\n const importNote = result.importsPrepended ? \"\\n\\nNote: functype imports were auto-added.\" : \"\"\n\n return `Validation FAILED — ${result.diagnostics.length} error(s):\\n\\n${errorLines.join(\"\\n\")}${importNote}`\n },\n })\n\n server.addTool({\n name: \"set_functype_version\",\n description:\n \"Switch the functype version at runtime. Installs the specified version and reloads all documentation and type definitions.\",\n parameters: z.object({\n version: z.string().describe('The functype version to install (e.g., \"0.46.0\", \"latest\", \"^0.45.0\")'),\n }),\n execute: async (args) => {\n const spec = `functype@${args.version}`\n try {\n execFileSync(\"pnpm\", [\"add\", spec], { cwd: PROJECT_ROOT, stdio: \"pipe\", timeout: 60_000 })\n } catch (err) {\n const message = err instanceof Error ? err.message : String(err)\n return `Failed to install ${spec}: ${message}`\n }\n\n clearFileCache()\n\n try {\n await initDocsData(true)\n } catch {\n return `Installed ${spec}, but this version does not export functype/cli. Documentation and type definitions are unavailable. The validator will still use the installed version's .d.ts files. Consider using functype >= 0.47.0 for full MCP support.`\n }\n\n return `Switched to functype v${VERSION}. Documentation and type definitions have been reloaded.`\n },\n })\n\n return server\n}\n\nasync function main() {\n await initDocsData()\n\n const server = createServer()\n\n const useHttp = process.env.TRANSPORT_TYPE === \"httpStream\" || process.env.TRANSPORT_TYPE === \"http\"\n const port = parseInt(process.env.PORT || \"3000\")\n const host = process.env.HOST || \"0.0.0.0\"\n\n if (useHttp) {\n console.error(`[functype-mcp] Starting HTTP server on ${host}:${port}`)\n await server.start({\n transportType: \"httpStream\",\n httpStream: { port, host, endpoint: \"/mcp\" },\n })\n console.error(`[functype-mcp] HTTP server ready at http://${host}:${port}/mcp`)\n } else {\n console.error(\"[functype-mcp] Starting in stdio mode\")\n await server.start({ transportType: \"stdio\" })\n }\n}\n\nprocess.on(\"SIGINT\", () => process.exit(0))\nprocess.on(\"SIGTERM\", () => process.exit(0))\n\nmain().catch(console.error)\n"],"mappings":";;;;;;;;;;;;;;;AAYA,MAAMA,YAAU,cAAc,OAAO,KAAK,IAAI;AAE9C,IAAW,QAAkC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0C,KAAK,GAAG,OAAO;AACvE,QAAM,OAAO,MAAM;GACjB,eAAe;GACf,YAAY;IAAE;IAAM;IAAM,UAAU;IAAQ;GAC7C,CAAC;AACF,UAAQ,MAAM,8CAA8C,KAAK,GAAG,KAAK,MAAM;QAC1E;AACL,UAAQ,MAAM,wCAAwC;AACtD,QAAM,OAAO,MAAM,EAAE,eAAe,SAAS,CAAC;;;AAIlD,QAAQ,GAAG,gBAAgB,QAAQ,KAAK,EAAE,CAAC;AAC3C,QAAQ,GAAG,iBAAiB,QAAQ,KAAK,EAAE,CAAC;AAE5C,MAAM,CAAC,MAAM,QAAQ,MAAM"}
1
+ {"version":3,"file":"index.js","names":["require"],"sources":["../src/lib/docs/data.ts","../src/lib/docs/formatters.ts","../src/lib/validator/compiler-host.ts","../src/lib/validator/validate.ts","../src/index.ts"],"sourcesContent":["/**\n * Runtime loader for functype CLI data.\n * Uses dynamic import so the data reflects whichever functype version\n * is installed in node_modules at runtime (not baked in at build time).\n */\n\nimport { createRequire } from \"node:module\"\nimport { pathToFileURL } from \"node:url\"\n\nexport type { InterfaceData, TypeData } from \"functype/cli\"\nimport type { InterfaceData, TypeData } from \"functype/cli\"\n\nconst require = createRequire(import.meta.url)\n\nexport let TYPES: Record<string, TypeData> = {}\nexport let INTERFACES: Record<string, InterfaceData> = {}\nexport let CATEGORIES: Record<string, string[]> = {}\nexport let FULL_INTERFACES: Record<string, string> = {}\nexport let VERSION = \"unknown\"\n\nlet initialized = false\n\nexport async function initDocsData(force?: boolean): Promise<void> {\n if (initialized && !force) return\n\n try {\n let cli: typeof import(\"functype/cli\")\n if (force) {\n const resolvedPath = require.resolve(\"functype/cli\")\n cli = await import(`${pathToFileURL(resolvedPath).href}?t=${Date.now()}`)\n } else {\n cli = await import(\"functype/cli\")\n }\n TYPES = cli.TYPES\n INTERFACES = cli.INTERFACES\n CATEGORIES = cli.CATEGORIES\n FULL_INTERFACES = cli.FULL_INTERFACES\n VERSION = cli.VERSION\n initialized = true\n } catch (err) {\n if (force) throw err\n console.error(\"[functype-mcp] Failed to load functype/cli data — doc tools will return empty results:\", err)\n }\n}\n","/**\n * Markdown formatters for MCP tool output.\n * Plain TypeScript — no functype dependency in formatters.\n */\n\nimport type { InterfaceData, TypeData } from \"./data\"\nimport { CATEGORIES, FULL_INTERFACES, INTERFACES, TYPES, VERSION } from \"./data\"\n\nconst METHOD_CATEGORIES = [\"create\", \"transform\", \"extract\", \"check\", \"other\"] as const\n\nexport const formatOverview = (): string => {\n const lines: string[] = [`# functype ${VERSION} — Scala-inspired FP for TypeScript`, \"\"]\n\n for (const [category, typeNames] of Object.entries(CATEGORIES)) {\n lines.push(`## ${category}`, \"\")\n for (const name of typeNames) {\n const type = TYPES[name]\n if (type) {\n const ifaces = type.interfaces.length > 0 ? ` [${type.interfaces.join(\", \")}]` : \"\"\n lines.push(`**${name}**${ifaces}`)\n lines.push(` ${type.description}`, \"\")\n }\n }\n }\n\n lines.push(\"---\", \"Use `get_type_api` for detailed type reference.\", \"Use `get_interfaces` for interface hierarchy.\")\n return lines.join(\"\\n\")\n}\n\nexport const formatType = (name: string, data: TypeData, includeFullInterface?: boolean): string => {\n const ifaceList = data.interfaces.length > 0 ? ` [${data.interfaces.join(\", \")}]` : \"\"\n const lines: string[] = [`# ${name}<T>${ifaceList}`, \"\", data.description, \"\"]\n\n for (const cat of METHOD_CATEGORIES) {\n const methods = data.methods[cat]\n if (methods && methods.length > 0) {\n lines.push(`## ${cat.charAt(0).toUpperCase() + cat.slice(1)}`, \"\")\n for (const method of methods) {\n lines.push(`- \\`${method}\\``)\n }\n lines.push(\"\")\n }\n }\n\n if (includeFullInterface) {\n const fullInterface = FULL_INTERFACES[name]\n if (fullInterface) {\n lines.push(\"## Full Interface\", \"\", \"```typescript\", fullInterface, \"```\")\n }\n }\n\n return lines.join(\"\\n\").trimEnd()\n}\n\nexport const formatInterfaces = (): string => {\n const lines: string[] = [\"# Interfaces\", \"\"]\n\n for (const [name, data] of Object.entries(INTERFACES)) {\n const ext = data.extends ? ` extends ${data.extends}` : \"\"\n lines.push(`## ${name}<A>${ext}`, \"\", data.description, \"\")\n for (const method of data.methods) {\n lines.push(`- \\`${method}\\``)\n }\n lines.push(\"\")\n }\n\n return lines.join(\"\\n\").trimEnd()\n}\n\nexport const searchTypes = (query: string): string => {\n const q = query.toLowerCase()\n\n // Check for exact type name match first (case-sensitive, e.g. \"IO\", \"Map\", \"Option\")\n const exactMatch = TYPES[query]\n if (exactMatch) {\n return formatType(query, exactMatch)\n }\n\n const matches: Array<{ name: string; data: TypeData }> = []\n\n for (const [name, data] of Object.entries(TYPES)) {\n const nameMatch = name.toLowerCase().includes(q)\n const descMatch = data.description.toLowerCase().includes(q)\n const ifaceMatch = data.interfaces.some((i) => i.toLowerCase().includes(q))\n const methodMatch = Object.values(data.methods)\n .flat()\n .some((m) => m.toLowerCase().includes(q))\n\n if (nameMatch || descMatch || ifaceMatch || methodMatch) {\n matches.push({ name, data })\n }\n }\n\n if (matches.length === 0) {\n return `No types found matching \"${query}\". Available types: ${Object.keys(TYPES).join(\", \")}`\n }\n\n if (matches.length === 1) {\n const match = matches[0]!\n return formatType(match.name, match.data)\n }\n\n // Prioritize name matches over description/method substring matches\n const nameMatches = matches.filter((m) => m.name.toLowerCase().includes(q))\n const otherMatches = matches.filter((m) => !m.name.toLowerCase().includes(q))\n const sorted = [...nameMatches, ...otherMatches]\n\n const lines: string[] = [`# Search results for \"${query}\"`, \"\", `Found ${sorted.length} matching types:`, \"\"]\n for (const match of sorted) {\n const ifaces = match.data.interfaces.length > 0 ? ` [${match.data.interfaces.join(\", \")}]` : \"\"\n lines.push(`**${match.name}**${ifaces}`)\n lines.push(` ${match.data.description}`, \"\")\n }\n\n lines.push(\"---\", \"Use `get_type_api` with a specific type name for full details.\")\n return lines.join(\"\\n\")\n}\n\nexport const getTypeByName = (name: string): { name: string; data: TypeData } | undefined => {\n const direct = TYPES[name]\n if (direct) return { name, data: direct }\n\n const entry = Object.entries(TYPES).find(([typeName]) => typeName.toLowerCase() === name.toLowerCase())\n if (entry) return { name: entry[0], data: entry[1] }\n\n return undefined\n}\n\nexport const getInterfaceByName = (name: string): { name: string; data: InterfaceData } | undefined => {\n const direct = INTERFACES[name]\n if (direct) return { name, data: direct }\n\n const entry = Object.entries(INTERFACES).find(([ifaceName]) => ifaceName.toLowerCase() === name.toLowerCase())\n if (entry) return { name: entry[0], data: entry[1] }\n\n return undefined\n}\n","/**\n * Custom TypeScript CompilerHost for in-memory type-checking of functype code.\n * Resolves functype .d.ts files from node_modules for accurate type validation.\n */\n\nimport { readFileSync } from \"node:fs\"\nimport { createRequire } from \"node:module\"\nimport { dirname, join, resolve } from \"node:path\"\n\nimport ts from \"typescript\"\n\nconst require = createRequire(import.meta.url)\n\nconst resolveFunctypeDistDir = (): string => {\n // Resolve the main entry point, then walk up to find the dist dir\n const functypeMain = require.resolve(\"functype\")\n // functypeMain is something like .../node_modules/functype/dist/index.js\n // Walk up until we find a directory containing package.json\n let dir = dirname(functypeMain)\n for (let i = 0; i < 5; i++) {\n try {\n readFileSync(join(dir, \"package.json\"), \"utf-8\")\n return join(dir, \"dist\")\n } catch {\n dir = dirname(dir)\n }\n }\n // Fallback: assume dist is sibling to main\n return dirname(functypeMain)\n}\n\nconst fileCache = new Map<string, string | undefined>()\n\nexport const clearFileCache = (): void => {\n fileCache.clear()\n}\n\nconst readFileCached = (path: string): string | undefined => {\n if (fileCache.has(path)) return fileCache.get(path)\n try {\n const content = readFileSync(path, \"utf-8\")\n fileCache.set(path, content)\n return content\n } catch {\n fileCache.set(path, undefined)\n return undefined\n }\n}\n\nexport const VIRTUAL_FILENAME = \"/__functype_validate__.ts\"\n\nexport const compilerOptions: ts.CompilerOptions = {\n strict: true,\n target: ts.ScriptTarget.ES2020,\n module: ts.ModuleKind.ESNext,\n moduleResolution: ts.ModuleResolutionKind.Bundler,\n noEmit: true,\n noUncheckedIndexedAccess: true,\n skipLibCheck: true,\n esModuleInterop: true,\n allowSyntheticDefaultImports: true,\n declaration: false,\n sourceMap: false,\n}\n\nexport const createCompilerHost = (sourceCode: string): ts.CompilerHost => {\n const functypeDistDir = resolveFunctypeDistDir()\n const defaultHost = ts.createCompilerHost(compilerOptions)\n\n const host: ts.CompilerHost = {\n ...defaultHost,\n\n getSourceFile(fileName, languageVersion) {\n if (fileName === VIRTUAL_FILENAME) {\n return ts.createSourceFile(fileName, sourceCode, languageVersion, true)\n }\n return defaultHost.getSourceFile(fileName, languageVersion)\n },\n\n fileExists(fileName) {\n if (fileName === VIRTUAL_FILENAME) return true\n return defaultHost.fileExists(fileName)\n },\n\n readFile(fileName) {\n if (fileName === VIRTUAL_FILENAME) return sourceCode\n return readFileCached(fileName) ?? defaultHost.readFile(fileName)\n },\n\n resolveModuleNames(moduleNames, containingFile) {\n return moduleNames.map((moduleName): ts.ResolvedModule | undefined => {\n if (moduleName === \"functype\" || moduleName.startsWith(\"functype/\")) {\n const subpath = moduleName === \"functype\" ? \"index.d.ts\" : moduleName.replace(\"functype/\", \"\") + \".d.ts\"\n const resolvedFileName = resolve(functypeDistDir, subpath)\n if (readFileCached(resolvedFileName) !== undefined) {\n return { resolvedFileName, isExternalLibraryImport: true }\n }\n // Try with /index.d.ts for subpath modules\n const indexPath = resolve(functypeDistDir, subpath.replace(\".d.ts\", \"/index.d.ts\"))\n if (readFileCached(indexPath) !== undefined) {\n return { resolvedFileName: indexPath, isExternalLibraryImport: true }\n }\n return undefined\n }\n\n const result = ts.resolveModuleName(moduleName, containingFile, compilerOptions, defaultHost)\n return result.resolvedModule\n })\n },\n }\n\n return host\n}\n","/**\n * Core validation function — type-checks functype code snippets using the TypeScript Compiler API.\n */\n\nimport ts from \"typescript\"\n\nimport { compilerOptions, createCompilerHost, VIRTUAL_FILENAME } from \"./compiler-host\"\nimport type { ValidateOptions, ValidationDiagnostic, ValidationResult } from \"./types\"\n\nconst DEFAULT_IMPORTS = `import { Option, Some, None, Either, Right, Left, Try, List, Set, Map, Lazy, LazyList, Task, IO, Cond, Match, Brand, ValidatedBrand, Tuple, Stack, Ok, Err } from \"functype\"\\n`\n\nconst hasFunctypeImport = (code: string): boolean => /from\\s+[\"']functype(?:\\/[^\"']*)?[\"']/.test(code)\n\nexport const validateCode = (code: string, options: ValidateOptions = {}): ValidationResult => {\n const autoImport = options.autoImport ?? true\n const shouldPrepend = autoImport && !hasFunctypeImport(code)\n const importLineCount = shouldPrepend ? 1 : 0\n const fullCode = shouldPrepend ? DEFAULT_IMPORTS + code : code\n\n const host = createCompilerHost(fullCode)\n const program = ts.createProgram([VIRTUAL_FILENAME], compilerOptions, host)\n const allDiagnostics = ts.getPreEmitDiagnostics(program)\n\n const fileDiagnostics = allDiagnostics.filter((d) => d.file?.fileName === VIRTUAL_FILENAME)\n\n const rawDiagnostics = fileDiagnostics.map((d) => {\n const { line, character } = d.file!.getLineAndCharacterOfPosition(d.start ?? 0)\n return {\n originalLine: line,\n line: line - importLineCount + 1,\n column: character + 1,\n message: ts.flattenDiagnosticMessageText(d.messageText, \"\\n\"),\n code: d.code,\n severity: (d.category === ts.DiagnosticCategory.Error ? \"error\" : \"warning\") as \"error\" | \"warning\",\n }\n })\n\n // Filter out diagnostics from the prepended import line(s) and map to final type\n const userDiagnostics: ValidationDiagnostic[] = rawDiagnostics\n .filter((d) => !shouldPrepend || d.originalLine >= importLineCount)\n .map(({ originalLine: _, ...rest }) => rest)\n\n return {\n success: userDiagnostics.filter((d) => d.severity === \"error\").length === 0,\n diagnostics: userDiagnostics,\n importsPrepended: shouldPrepend,\n }\n}\n","import { execFileSync } from \"node:child_process\"\nimport { dirname } from \"node:path\"\nimport { fileURLToPath } from \"node:url\"\n\nimport { FastMCP } from \"fastmcp\"\nimport { z } from \"zod\"\n\nimport { FULL_INTERFACES, initDocsData, VERSION } from \"./lib/docs/data\"\nimport { formatInterfaces, formatOverview, formatType, getTypeByName, searchTypes } from \"./lib/docs/formatters\"\nimport { clearFileCache } from \"./lib/validator/compiler-host\"\nimport { validateCode } from \"./lib/validator/validate\"\n\nconst __dirname = dirname(fileURLToPath(import.meta.url))\nconst PROJECT_ROOT = dirname(__dirname)\n\ndeclare const __VERSION__: string\nconst SERVER_VERSION = (\n typeof __VERSION__ !== \"undefined\" ? __VERSION__ : \"0.0.0-dev\"\n) as `${number}.${number}.${number}`\n\nfunction createServer() {\n const server = new FastMCP({\n name: \"functype-mcp-server\",\n version: SERVER_VERSION,\n instructions: `Functype MCP Server — documentation lookup and code validation for the functype TypeScript FP library (v${VERSION}).\n\nAvailable tools:\n- search_docs: Search functype documentation by keyword or type name\n- get_type_api: Get detailed API reference for a specific type\n- get_interfaces: Get the interface hierarchy (Functor, Monad, Foldable, etc.)\n- validate_code: Type-check functype code snippets at compile time\n- set_functype_version: Switch the functype version at runtime (installs + reloads)\n\nUse validate_code to verify your functype code is type-correct before presenting it to the user.`,\n })\n\n server.addTool({\n name: \"search_docs\",\n description:\n \"Search functype documentation by keyword or type name. Omit query for a full overview of all types and categories.\",\n parameters: z.object({\n query: z.string().optional().describe(\"Type name or keyword to search for. Omit for full overview.\"),\n }),\n execute: async (args) => {\n if (!args.query || args.query.trim() === \"\") {\n return formatOverview()\n }\n return searchTypes(args.query)\n },\n })\n\n server.addTool({\n name: \"get_type_api\",\n description:\n \"Get detailed API reference for a specific functype type including methods by category and optionally the full TypeScript interface definition.\",\n parameters: z.object({\n type_name: z.string().describe(\"The type name (e.g., Option, Either, List, IO)\"),\n include_full_interface: z\n .boolean()\n .optional()\n .default(false)\n .describe(\"Include full TypeScript interface definition\"),\n }),\n execute: async (args) => {\n const found = getTypeByName(args.type_name)\n if (!found) {\n const available = Object.keys(FULL_INTERFACES).join(\", \")\n return `Type \"${args.type_name}\" not found. Available types: ${available}`\n }\n return formatType(found.name, found.data, args.include_full_interface)\n },\n })\n\n server.addTool({\n name: \"get_interfaces\",\n description:\n \"Get the functype interface hierarchy — Functor, Monad, Foldable, Extractable, Matchable, etc. — with their methods and inheritance.\",\n parameters: z.object({}),\n execute: async () => {\n return formatInterfaces()\n },\n })\n\n server.addTool({\n name: \"validate_code\",\n description:\n \"Type-check a functype code snippet using the TypeScript compiler. Returns PASSED or a list of type errors with line/column/message. Use this to verify functype code is type-correct before presenting to users.\",\n parameters: z.object({\n code: z.string().describe(\"TypeScript code snippet using functype to type-check\"),\n auto_import: z\n .boolean()\n .optional()\n .default(true)\n .describe(\"Automatically import all functype types if no import statement is present. Default: true\"),\n }),\n execute: async (args) => {\n const result = validateCode(args.code, { autoImport: args.auto_import })\n\n if (result.success) {\n const importNote = result.importsPrepended ? \" (functype imports auto-added)\" : \"\"\n return `Validation PASSED${importNote}\\n\\nThe code is type-correct.`\n }\n\n const errorLines = result.diagnostics.map((d) => `- Line ${d.line}, Col ${d.column}: ${d.message} (TS${d.code})`)\n const importNote = result.importsPrepended ? \"\\n\\nNote: functype imports were auto-added.\" : \"\"\n\n return `Validation FAILED — ${result.diagnostics.length} error(s):\\n\\n${errorLines.join(\"\\n\")}${importNote}`\n },\n })\n\n server.addTool({\n name: \"set_functype_version\",\n description:\n \"Switch the functype version at runtime. Installs the specified version and reloads all documentation and type definitions.\",\n parameters: z.object({\n version: z.string().describe('The functype version to install (e.g., \"0.46.0\", \"latest\", \"^0.45.0\")'),\n }),\n execute: async (args) => {\n const spec = `functype@${args.version}`\n try {\n execFileSync(\"pnpm\", [\"add\", spec], { cwd: PROJECT_ROOT, stdio: \"pipe\", timeout: 60_000 })\n } catch (err) {\n const message = err instanceof Error ? err.message : String(err)\n return `Failed to install ${spec}: ${message}`\n }\n\n clearFileCache()\n\n try {\n await initDocsData(true)\n } catch {\n return `Installed ${spec}, but this version does not export functype/cli. Documentation and type definitions are unavailable. The validator will still use the installed version's .d.ts files. Consider using functype >= 0.47.0 for full MCP support.`\n }\n\n return `Switched to functype v${VERSION}. Documentation and type definitions have been reloaded.`\n },\n })\n\n return server\n}\n\nasync function main() {\n await initDocsData()\n\n const server = createServer()\n\n const useHttp = process.env.TRANSPORT_TYPE === \"httpStream\" || process.env.TRANSPORT_TYPE === \"http\"\n const port = parseInt(process.env.PORT || \"3000\")\n const host = process.env.HOST || \"0.0.0.0\"\n\n if (useHttp) {\n console.error(`[functype-mcp] Starting HTTP server on ${host}:${port}`)\n await server.start({\n transportType: \"httpStream\",\n httpStream: { port, host, endpoint: \"/mcp\" },\n })\n console.error(`[functype-mcp] HTTP server ready at http://${host}:${port}/mcp`)\n } else {\n console.error(\"[functype-mcp] Starting in stdio mode\")\n await server.start({ transportType: \"stdio\" })\n }\n}\n\nprocess.on(\"SIGINT\", () => process.exit(0))\nprocess.on(\"SIGTERM\", () => process.exit(0))\n\nmain().catch(console.error)\n"],"mappings":";;;;;;;;;;;;;;AAYA,MAAMA,YAAU,cAAc,OAAO,KAAK,IAAI;AAE9C,IAAW,QAAkC,EAAE;AAC/C,IAAW,aAA4C,EAAE;AACzD,IAAW,aAAuC,EAAE;AACpD,IAAW,kBAA0C,EAAE;AACvD,IAAW,UAAU;AAErB,IAAI,cAAc;AAElB,eAAsB,aAAa,OAAgC;AACjE,KAAI,eAAe,CAAC,MAAO;AAE3B,KAAI;EACF,IAAI;AACJ,MAAI,MAEF,OAAM,MAAM,OAAO,GAAG,cADDA,UAAQ,QAAQ,eAAe,CACH,CAAC,KAAK,KAAK,KAAK,KAAK;MAEtE,OAAM,MAAM,OAAO;AAErB,UAAQ,IAAI;AACZ,eAAa,IAAI;AACjB,eAAa,IAAI;AACjB,oBAAkB,IAAI;AACtB,YAAU,IAAI;AACd,gBAAc;UACP,KAAK;AACZ,MAAI,MAAO,OAAM;AACjB,UAAQ,MAAM,0FAA0F,IAAI;;;;;ACjChH,MAAM,oBAAoB;CAAC;CAAU;CAAa;CAAW;CAAS;CAAQ;AAE9E,MAAa,uBAA+B;CAC1C,MAAM,QAAkB,CAAC,cAAc,QAAQ,sCAAsC,GAAG;AAExF,MAAK,MAAM,CAAC,UAAU,cAAc,OAAO,QAAQ,WAAW,EAAE;AAC9D,QAAM,KAAK,MAAM,YAAY,GAAG;AAChC,OAAK,MAAM,QAAQ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
- "version": "0.47.0",
3
+ "version": "0.50.0",
4
4
  "description": "MCP server for functype documentation lookup and TypeScript code validation",
5
5
  "keywords": [
6
6
  "mcp",
@@ -15,13 +15,14 @@
15
15
  ],
16
16
  "author": "Jordan Burke <jordan.burke@gmail.com>",
17
17
  "license": "MIT",
18
- "homepage": "https://github.com/jordanburke/functype-mcp-server#readme",
18
+ "homepage": "https://github.com/jordanburke/functype/tree/main/mcp-server#readme",
19
19
  "repository": {
20
20
  "type": "git",
21
- "url": "git+https://github.com/jordanburke/functype-mcp-server.git"
21
+ "url": "git+https://github.com/jordanburke/functype.git",
22
+ "directory": "mcp-server"
22
23
  },
23
24
  "bugs": {
24
- "url": "https://github.com/jordanburke/functype-mcp-server/issues"
25
+ "url": "https://github.com/jordanburke/functype/issues"
25
26
  },
26
27
  "bin": {
27
28
  "functype-mcp-server": "dist/bin.js"
@@ -44,14 +45,14 @@
44
45
  ],
45
46
  "dependencies": {
46
47
  "fastmcp": "^3.33.0",
47
- "functype": "^0.47.0",
48
48
  "typescript": "^5.9.3",
49
- "zod": "^4.3.6"
49
+ "zod": "^4.3.6",
50
+ "functype": "0.50.0"
50
51
  },
51
52
  "devDependencies": {
52
- "@types/node": "^24.10.13",
53
- "ts-builds": "^2.4.0",
54
- "tsdown": "^0.20.3",
53
+ "@types/node": "^24.10.15",
54
+ "ts-builds": "^2.5.0",
55
+ "tsdown": "^0.21.1",
55
56
  "tsx": "^4.21.0"
56
57
  },
57
58
  "prettier": "ts-builds/prettier",