functype-mcp-server 0.47.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 +21 -0
- package/README.md +123 -0
- package/dist/bin.d.ts +1 -0
- package/dist/bin.js +43 -0
- package/dist/bin.js.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +379 -0
- package/dist/index.js.map +1 -0
- package/package.json +74 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2023 Jordan
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
# functype-mcp-server
|
|
2
|
+
|
|
3
|
+
MCP server for [functype](https://github.com/jordanburke/functype) — documentation lookup and compile-time TypeScript code validation for AI editors.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- **`search_docs`** — Search functype documentation by keyword or type name
|
|
8
|
+
- **`get_type_api`** — Detailed API reference for any type (Option, Either, List, IO, etc.)
|
|
9
|
+
- **`get_interfaces`** — Interface hierarchy (Functor, Monad, Foldable, Extractable, etc.)
|
|
10
|
+
- **`validate_code`** — Type-check functype code snippets using the TypeScript Compiler API
|
|
11
|
+
- **`set_functype_version`** — Switch functype version at runtime (installs + reloads docs and types)
|
|
12
|
+
|
|
13
|
+
The `validate_code` tool is the killer feature: an LLM writes functype code, calls the tool, gets back type errors, and fixes them before showing the user.
|
|
14
|
+
|
|
15
|
+
## Installation
|
|
16
|
+
|
|
17
|
+
### Claude Desktop
|
|
18
|
+
|
|
19
|
+
Add to your Claude Desktop config (`~/Library/Application Support/Claude/claude_desktop_config.json`):
|
|
20
|
+
|
|
21
|
+
```json
|
|
22
|
+
{
|
|
23
|
+
"mcpServers": {
|
|
24
|
+
"functype": {
|
|
25
|
+
"command": "npx",
|
|
26
|
+
"args": ["functype-mcp-server"]
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
### Claude Code
|
|
33
|
+
|
|
34
|
+
Add to your project's `.mcp.json`:
|
|
35
|
+
|
|
36
|
+
```json
|
|
37
|
+
{
|
|
38
|
+
"mcpServers": {
|
|
39
|
+
"functype": {
|
|
40
|
+
"command": "npx",
|
|
41
|
+
"args": ["functype-mcp-server"]
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
### From Source
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
git clone https://github.com/jordanburke/functype-mcp-server.git
|
|
51
|
+
cd functype-mcp-server
|
|
52
|
+
pnpm install
|
|
53
|
+
pnpm build
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
Then configure your MCP client to use `node dist/bin.js`.
|
|
57
|
+
|
|
58
|
+
## Tools
|
|
59
|
+
|
|
60
|
+
### `search_docs`
|
|
61
|
+
|
|
62
|
+
Search functype documentation. Omit query for a full overview.
|
|
63
|
+
|
|
64
|
+
```
|
|
65
|
+
query?: string — Type name or keyword (e.g., "Option", "map", "Foldable")
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
### `get_type_api`
|
|
69
|
+
|
|
70
|
+
Get detailed API reference for a specific type.
|
|
71
|
+
|
|
72
|
+
```
|
|
73
|
+
type_name: string — e.g., "Option", "Either", "List", "IO"
|
|
74
|
+
include_full_interface?: bool — Include full TypeScript interface definition
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
### `get_interfaces`
|
|
78
|
+
|
|
79
|
+
Get the interface hierarchy — Functor, Monad, Foldable, Extractable, etc.
|
|
80
|
+
|
|
81
|
+
No parameters.
|
|
82
|
+
|
|
83
|
+
### `validate_code`
|
|
84
|
+
|
|
85
|
+
Type-check a functype code snippet using the TypeScript compiler.
|
|
86
|
+
|
|
87
|
+
```
|
|
88
|
+
code: string — TypeScript code to validate
|
|
89
|
+
auto_import?: bool — Auto-import functype types if no import present (default: true)
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
Returns `Validation PASSED` or a list of errors with line, column, message, and TS error code.
|
|
93
|
+
|
|
94
|
+
### `set_functype_version`
|
|
95
|
+
|
|
96
|
+
Switch the functype version at runtime. Installs the specified version and reloads all documentation and type definitions.
|
|
97
|
+
|
|
98
|
+
```
|
|
99
|
+
version: string — Version to install (e.g., "0.47.0", "latest", ...)
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
Requires functype >= 0.47.0 for full documentation support. Older versions will still work for type-checking via `validate_code`.
|
|
103
|
+
|
|
104
|
+
## Environment Variables
|
|
105
|
+
|
|
106
|
+
| Variable | Default | Description |
|
|
107
|
+
| ---------------- | --------- | --------------------------------------- |
|
|
108
|
+
| `TRANSPORT_TYPE` | `stdio` | Transport mode: `stdio` or `httpStream` |
|
|
109
|
+
| `PORT` | `3000` | HTTP port (when using httpStream) |
|
|
110
|
+
| `HOST` | `0.0.0.0` | HTTP host (when using httpStream) |
|
|
111
|
+
|
|
112
|
+
## Development
|
|
113
|
+
|
|
114
|
+
```bash
|
|
115
|
+
pnpm validate # format + lint + typecheck + test + build
|
|
116
|
+
pnpm test # Run tests
|
|
117
|
+
pnpm inspect # Build + launch MCP Inspector
|
|
118
|
+
pnpm serve:dev # Dev server with tsx watch
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
## License
|
|
122
|
+
|
|
123
|
+
MIT
|
package/dist/bin.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
package/dist/bin.js
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
//#region src/bin.ts
|
|
3
|
+
if (!process.env.TRANSPORT_TYPE) process.env.TRANSPORT_TYPE = "stdio";
|
|
4
|
+
const args = process.argv.slice(2);
|
|
5
|
+
if (args.includes("--version") || args.includes("-v")) {
|
|
6
|
+
console.log("0.47.0");
|
|
7
|
+
process.exit(0);
|
|
8
|
+
}
|
|
9
|
+
if (args.includes("--help") || args.includes("-h")) {
|
|
10
|
+
console.log(`
|
|
11
|
+
functype-mcp-server v0.47.0
|
|
12
|
+
|
|
13
|
+
MCP server for functype documentation lookup and TypeScript code validation.
|
|
14
|
+
|
|
15
|
+
Usage: functype-mcp-server [options]
|
|
16
|
+
|
|
17
|
+
Options:
|
|
18
|
+
-v, --version Show version number
|
|
19
|
+
-h, --help Show help
|
|
20
|
+
|
|
21
|
+
Environment Variables:
|
|
22
|
+
TRANSPORT_TYPE Transport mode: "stdio" (default) or "httpStream"
|
|
23
|
+
PORT HTTP port (default: 3000)
|
|
24
|
+
HOST HTTP host (default: 0.0.0.0)
|
|
25
|
+
|
|
26
|
+
Tools:
|
|
27
|
+
search_docs Search functype documentation
|
|
28
|
+
get_type_api Get detailed type API reference
|
|
29
|
+
get_interfaces Get interface hierarchy
|
|
30
|
+
validate_code Type-check functype code snippets
|
|
31
|
+
|
|
32
|
+
For more information: https://github.com/jordanburke/functype-mcp-server
|
|
33
|
+
`);
|
|
34
|
+
process.exit(0);
|
|
35
|
+
}
|
|
36
|
+
async function main() {
|
|
37
|
+
await import("./index.js");
|
|
38
|
+
}
|
|
39
|
+
main().then();
|
|
40
|
+
|
|
41
|
+
//#endregion
|
|
42
|
+
export { };
|
|
43
|
+
//# sourceMappingURL=bin.js.map
|
package/dist/bin.js.map
ADDED
|
@@ -0,0 +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"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,379 @@
|
|
|
1
|
+
import { createRequire } from "node:module";
|
|
2
|
+
import { execFileSync } from "node:child_process";
|
|
3
|
+
import { dirname, join, resolve } from "node:path";
|
|
4
|
+
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
5
|
+
import { FastMCP } from "fastmcp";
|
|
6
|
+
import { z } from "zod";
|
|
7
|
+
import { readFileSync } from "node:fs";
|
|
8
|
+
import ts from "typescript";
|
|
9
|
+
|
|
10
|
+
//#region src/lib/docs/data.ts
|
|
11
|
+
/**
|
|
12
|
+
* Runtime loader for functype CLI data.
|
|
13
|
+
* Uses dynamic import so the data reflects whichever functype version
|
|
14
|
+
* is installed in node_modules at runtime (not baked in at build time).
|
|
15
|
+
*/
|
|
16
|
+
const require$1 = createRequire(import.meta.url);
|
|
17
|
+
let TYPES = {};
|
|
18
|
+
let INTERFACES = {};
|
|
19
|
+
let CATEGORIES = {};
|
|
20
|
+
let FULL_INTERFACES = {};
|
|
21
|
+
let VERSION = "unknown";
|
|
22
|
+
let initialized = false;
|
|
23
|
+
async function initDocsData(force) {
|
|
24
|
+
if (initialized && !force) return;
|
|
25
|
+
try {
|
|
26
|
+
let cli;
|
|
27
|
+
if (force) cli = await import(`${pathToFileURL(require$1.resolve("functype/cli")).href}?t=${Date.now()}`);
|
|
28
|
+
else cli = await import("functype/cli");
|
|
29
|
+
TYPES = cli.TYPES;
|
|
30
|
+
INTERFACES = cli.INTERFACES;
|
|
31
|
+
CATEGORIES = cli.CATEGORIES;
|
|
32
|
+
FULL_INTERFACES = cli.FULL_INTERFACES;
|
|
33
|
+
VERSION = cli.VERSION;
|
|
34
|
+
initialized = true;
|
|
35
|
+
} catch (err) {
|
|
36
|
+
if (force) throw err;
|
|
37
|
+
console.error("[functype-mcp] Failed to load functype/cli data — doc tools will return empty results:", err);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
//#endregion
|
|
42
|
+
//#region src/lib/docs/formatters.ts
|
|
43
|
+
const METHOD_CATEGORIES = [
|
|
44
|
+
"create",
|
|
45
|
+
"transform",
|
|
46
|
+
"extract",
|
|
47
|
+
"check",
|
|
48
|
+
"other"
|
|
49
|
+
];
|
|
50
|
+
const formatOverview = () => {
|
|
51
|
+
const lines = [`# functype ${VERSION} — Scala-inspired FP for TypeScript`, ""];
|
|
52
|
+
for (const [category, typeNames] of Object.entries(CATEGORIES)) {
|
|
53
|
+
lines.push(`## ${category}`, "");
|
|
54
|
+
for (const name of typeNames) {
|
|
55
|
+
const type = TYPES[name];
|
|
56
|
+
if (type) {
|
|
57
|
+
const ifaces = type.interfaces.length > 0 ? ` [${type.interfaces.join(", ")}]` : "";
|
|
58
|
+
lines.push(`**${name}**${ifaces}`);
|
|
59
|
+
lines.push(` ${type.description}`, "");
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
lines.push("---", "Use `get_type_api` for detailed type reference.", "Use `get_interfaces` for interface hierarchy.");
|
|
64
|
+
return lines.join("\n");
|
|
65
|
+
};
|
|
66
|
+
const formatType = (name, data, includeFullInterface) => {
|
|
67
|
+
const lines = [
|
|
68
|
+
`# ${name}<T>${data.interfaces.length > 0 ? ` [${data.interfaces.join(", ")}]` : ""}`,
|
|
69
|
+
"",
|
|
70
|
+
data.description,
|
|
71
|
+
""
|
|
72
|
+
];
|
|
73
|
+
for (const cat of METHOD_CATEGORIES) {
|
|
74
|
+
const methods = data.methods[cat];
|
|
75
|
+
if (methods && methods.length > 0) {
|
|
76
|
+
lines.push(`## ${cat.charAt(0).toUpperCase() + cat.slice(1)}`, "");
|
|
77
|
+
for (const method of methods) lines.push(`- \`${method}\``);
|
|
78
|
+
lines.push("");
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
if (includeFullInterface) {
|
|
82
|
+
const fullInterface = FULL_INTERFACES[name];
|
|
83
|
+
if (fullInterface) lines.push("## Full Interface", "", "```typescript", fullInterface, "```");
|
|
84
|
+
}
|
|
85
|
+
return lines.join("\n").trimEnd();
|
|
86
|
+
};
|
|
87
|
+
const formatInterfaces = () => {
|
|
88
|
+
const lines = ["# Interfaces", ""];
|
|
89
|
+
for (const [name, data] of Object.entries(INTERFACES)) {
|
|
90
|
+
const ext = data.extends ? ` extends ${data.extends}` : "";
|
|
91
|
+
lines.push(`## ${name}<A>${ext}`, "", data.description, "");
|
|
92
|
+
for (const method of data.methods) lines.push(`- \`${method}\``);
|
|
93
|
+
lines.push("");
|
|
94
|
+
}
|
|
95
|
+
return lines.join("\n").trimEnd();
|
|
96
|
+
};
|
|
97
|
+
const searchTypes = (query) => {
|
|
98
|
+
const q = query.toLowerCase();
|
|
99
|
+
const matches = [];
|
|
100
|
+
for (const [name, data] of Object.entries(TYPES)) {
|
|
101
|
+
const nameMatch = name.toLowerCase().includes(q);
|
|
102
|
+
const descMatch = data.description.toLowerCase().includes(q);
|
|
103
|
+
const ifaceMatch = data.interfaces.some((i) => i.toLowerCase().includes(q));
|
|
104
|
+
const methodMatch = Object.values(data.methods).flat().some((m) => m.toLowerCase().includes(q));
|
|
105
|
+
if (nameMatch || descMatch || ifaceMatch || methodMatch) matches.push({
|
|
106
|
+
name,
|
|
107
|
+
data
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
if (matches.length === 0) return `No types found matching "${query}". Available types: ${Object.keys(TYPES).join(", ")}`;
|
|
111
|
+
if (matches.length === 1) {
|
|
112
|
+
const match = matches[0];
|
|
113
|
+
return formatType(match.name, match.data);
|
|
114
|
+
}
|
|
115
|
+
const lines = [
|
|
116
|
+
`# Search results for "${query}"`,
|
|
117
|
+
"",
|
|
118
|
+
`Found ${matches.length} matching types:`,
|
|
119
|
+
""
|
|
120
|
+
];
|
|
121
|
+
for (const match of matches) {
|
|
122
|
+
const ifaces = match.data.interfaces.length > 0 ? ` [${match.data.interfaces.join(", ")}]` : "";
|
|
123
|
+
lines.push(`**${match.name}**${ifaces}`);
|
|
124
|
+
lines.push(` ${match.data.description}`, "");
|
|
125
|
+
}
|
|
126
|
+
lines.push("---", "Use `get_type_api` with a specific type name for full details.");
|
|
127
|
+
return lines.join("\n");
|
|
128
|
+
};
|
|
129
|
+
const getTypeByName = (name) => {
|
|
130
|
+
const direct = TYPES[name];
|
|
131
|
+
if (direct) return {
|
|
132
|
+
name,
|
|
133
|
+
data: direct
|
|
134
|
+
};
|
|
135
|
+
const entry = Object.entries(TYPES).find(([typeName]) => typeName.toLowerCase() === name.toLowerCase());
|
|
136
|
+
if (entry) return {
|
|
137
|
+
name: entry[0],
|
|
138
|
+
data: entry[1]
|
|
139
|
+
};
|
|
140
|
+
};
|
|
141
|
+
|
|
142
|
+
//#endregion
|
|
143
|
+
//#region src/lib/validator/compiler-host.ts
|
|
144
|
+
/**
|
|
145
|
+
* Custom TypeScript CompilerHost for in-memory type-checking of functype code.
|
|
146
|
+
* Resolves functype .d.ts files from node_modules for accurate type validation.
|
|
147
|
+
*/
|
|
148
|
+
const require = createRequire(import.meta.url);
|
|
149
|
+
const resolveFunctypeDistDir = () => {
|
|
150
|
+
const functypeMain = require.resolve("functype");
|
|
151
|
+
let dir = dirname(functypeMain);
|
|
152
|
+
for (let i = 0; i < 5; i++) try {
|
|
153
|
+
readFileSync(join(dir, "package.json"), "utf-8");
|
|
154
|
+
return join(dir, "dist");
|
|
155
|
+
} catch {
|
|
156
|
+
dir = dirname(dir);
|
|
157
|
+
}
|
|
158
|
+
return dirname(functypeMain);
|
|
159
|
+
};
|
|
160
|
+
const fileCache = /* @__PURE__ */ new Map();
|
|
161
|
+
const clearFileCache = () => {
|
|
162
|
+
fileCache.clear();
|
|
163
|
+
};
|
|
164
|
+
const readFileCached = (path) => {
|
|
165
|
+
if (fileCache.has(path)) return fileCache.get(path);
|
|
166
|
+
try {
|
|
167
|
+
const content = readFileSync(path, "utf-8");
|
|
168
|
+
fileCache.set(path, content);
|
|
169
|
+
return content;
|
|
170
|
+
} catch {
|
|
171
|
+
fileCache.set(path, void 0);
|
|
172
|
+
return;
|
|
173
|
+
}
|
|
174
|
+
};
|
|
175
|
+
const VIRTUAL_FILENAME = "/__functype_validate__.ts";
|
|
176
|
+
const compilerOptions = {
|
|
177
|
+
strict: true,
|
|
178
|
+
target: ts.ScriptTarget.ES2020,
|
|
179
|
+
module: ts.ModuleKind.ESNext,
|
|
180
|
+
moduleResolution: ts.ModuleResolutionKind.Bundler,
|
|
181
|
+
noEmit: true,
|
|
182
|
+
noUncheckedIndexedAccess: true,
|
|
183
|
+
skipLibCheck: true,
|
|
184
|
+
esModuleInterop: true,
|
|
185
|
+
allowSyntheticDefaultImports: true,
|
|
186
|
+
declaration: false,
|
|
187
|
+
sourceMap: false
|
|
188
|
+
};
|
|
189
|
+
const createCompilerHost = (sourceCode) => {
|
|
190
|
+
const functypeDistDir = resolveFunctypeDistDir();
|
|
191
|
+
const defaultHost = ts.createCompilerHost(compilerOptions);
|
|
192
|
+
return {
|
|
193
|
+
...defaultHost,
|
|
194
|
+
getSourceFile(fileName, languageVersion) {
|
|
195
|
+
if (fileName === VIRTUAL_FILENAME) return ts.createSourceFile(fileName, sourceCode, languageVersion, true);
|
|
196
|
+
return defaultHost.getSourceFile(fileName, languageVersion);
|
|
197
|
+
},
|
|
198
|
+
fileExists(fileName) {
|
|
199
|
+
if (fileName === VIRTUAL_FILENAME) return true;
|
|
200
|
+
return defaultHost.fileExists(fileName);
|
|
201
|
+
},
|
|
202
|
+
readFile(fileName) {
|
|
203
|
+
if (fileName === VIRTUAL_FILENAME) return sourceCode;
|
|
204
|
+
return readFileCached(fileName) ?? defaultHost.readFile(fileName);
|
|
205
|
+
},
|
|
206
|
+
resolveModuleNames(moduleNames, containingFile) {
|
|
207
|
+
return moduleNames.map((moduleName) => {
|
|
208
|
+
if (moduleName === "functype" || moduleName.startsWith("functype/")) {
|
|
209
|
+
const subpath = moduleName === "functype" ? "index.d.ts" : moduleName.replace("functype/", "") + ".d.ts";
|
|
210
|
+
const resolvedFileName = resolve(functypeDistDir, subpath);
|
|
211
|
+
if (readFileCached(resolvedFileName) !== void 0) return {
|
|
212
|
+
resolvedFileName,
|
|
213
|
+
isExternalLibraryImport: true
|
|
214
|
+
};
|
|
215
|
+
const indexPath = resolve(functypeDistDir, subpath.replace(".d.ts", "/index.d.ts"));
|
|
216
|
+
if (readFileCached(indexPath) !== void 0) return {
|
|
217
|
+
resolvedFileName: indexPath,
|
|
218
|
+
isExternalLibraryImport: true
|
|
219
|
+
};
|
|
220
|
+
return;
|
|
221
|
+
}
|
|
222
|
+
return ts.resolveModuleName(moduleName, containingFile, compilerOptions, defaultHost).resolvedModule;
|
|
223
|
+
});
|
|
224
|
+
}
|
|
225
|
+
};
|
|
226
|
+
};
|
|
227
|
+
|
|
228
|
+
//#endregion
|
|
229
|
+
//#region src/lib/validator/validate.ts
|
|
230
|
+
/**
|
|
231
|
+
* Core validation function — type-checks functype code snippets using the TypeScript Compiler API.
|
|
232
|
+
*/
|
|
233
|
+
const 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`;
|
|
234
|
+
const hasFunctypeImport = (code) => /from\s+["']functype(?:\/[^"']*)?["']/.test(code);
|
|
235
|
+
const validateCode = (code, options = {}) => {
|
|
236
|
+
const shouldPrepend = (options.autoImport ?? true) && !hasFunctypeImport(code);
|
|
237
|
+
const importLineCount = shouldPrepend ? 1 : 0;
|
|
238
|
+
const host = createCompilerHost(shouldPrepend ? DEFAULT_IMPORTS + code : code);
|
|
239
|
+
const program = ts.createProgram([VIRTUAL_FILENAME], compilerOptions, host);
|
|
240
|
+
const userDiagnostics = ts.getPreEmitDiagnostics(program).filter((d) => d.file?.fileName === VIRTUAL_FILENAME).map((d) => {
|
|
241
|
+
const { line, character } = d.file.getLineAndCharacterOfPosition(d.start ?? 0);
|
|
242
|
+
return {
|
|
243
|
+
originalLine: line,
|
|
244
|
+
line: line - importLineCount + 1,
|
|
245
|
+
column: character + 1,
|
|
246
|
+
message: ts.flattenDiagnosticMessageText(d.messageText, "\n"),
|
|
247
|
+
code: d.code,
|
|
248
|
+
severity: d.category === ts.DiagnosticCategory.Error ? "error" : "warning"
|
|
249
|
+
};
|
|
250
|
+
}).filter((d) => !shouldPrepend || d.originalLine >= importLineCount).map(({ originalLine: _, ...rest }) => rest);
|
|
251
|
+
return {
|
|
252
|
+
success: userDiagnostics.filter((d) => d.severity === "error").length === 0,
|
|
253
|
+
diagnostics: userDiagnostics,
|
|
254
|
+
importsPrepended: shouldPrepend
|
|
255
|
+
};
|
|
256
|
+
};
|
|
257
|
+
|
|
258
|
+
//#endregion
|
|
259
|
+
//#region src/index.ts
|
|
260
|
+
const PROJECT_ROOT = dirname(dirname(fileURLToPath(import.meta.url)));
|
|
261
|
+
const SERVER_VERSION = "0.47.0";
|
|
262
|
+
function createServer() {
|
|
263
|
+
const server = new FastMCP({
|
|
264
|
+
name: "functype-mcp-server",
|
|
265
|
+
version: SERVER_VERSION,
|
|
266
|
+
instructions: `Functype MCP Server — documentation lookup and code validation for the functype TypeScript FP library (v${VERSION}).
|
|
267
|
+
|
|
268
|
+
Available tools:
|
|
269
|
+
- search_docs: Search functype documentation by keyword or type name
|
|
270
|
+
- get_type_api: Get detailed API reference for a specific type
|
|
271
|
+
- get_interfaces: Get the interface hierarchy (Functor, Monad, Foldable, etc.)
|
|
272
|
+
- validate_code: Type-check functype code snippets at compile time
|
|
273
|
+
- set_functype_version: Switch the functype version at runtime (installs + reloads)
|
|
274
|
+
|
|
275
|
+
Use validate_code to verify your functype code is type-correct before presenting it to the user.`
|
|
276
|
+
});
|
|
277
|
+
server.addTool({
|
|
278
|
+
name: "search_docs",
|
|
279
|
+
description: "Search functype documentation by keyword or type name. Omit query for a full overview of all types and categories.",
|
|
280
|
+
parameters: z.object({ query: z.string().optional().describe("Type name or keyword to search for. Omit for full overview.") }),
|
|
281
|
+
execute: async (args) => {
|
|
282
|
+
if (!args.query || args.query.trim() === "") return formatOverview();
|
|
283
|
+
return searchTypes(args.query);
|
|
284
|
+
}
|
|
285
|
+
});
|
|
286
|
+
server.addTool({
|
|
287
|
+
name: "get_type_api",
|
|
288
|
+
description: "Get detailed API reference for a specific functype type including methods by category and optionally the full TypeScript interface definition.",
|
|
289
|
+
parameters: z.object({
|
|
290
|
+
type_name: z.string().describe("The type name (e.g., Option, Either, List, IO)"),
|
|
291
|
+
include_full_interface: z.boolean().optional().default(false).describe("Include full TypeScript interface definition")
|
|
292
|
+
}),
|
|
293
|
+
execute: async (args) => {
|
|
294
|
+
const found = getTypeByName(args.type_name);
|
|
295
|
+
if (!found) {
|
|
296
|
+
const available = Object.keys(FULL_INTERFACES).join(", ");
|
|
297
|
+
return `Type "${args.type_name}" not found. Available types: ${available}`;
|
|
298
|
+
}
|
|
299
|
+
return formatType(found.name, found.data, args.include_full_interface);
|
|
300
|
+
}
|
|
301
|
+
});
|
|
302
|
+
server.addTool({
|
|
303
|
+
name: "get_interfaces",
|
|
304
|
+
description: "Get the functype interface hierarchy — Functor, Monad, Foldable, Extractable, Matchable, etc. — with their methods and inheritance.",
|
|
305
|
+
parameters: z.object({}),
|
|
306
|
+
execute: async () => {
|
|
307
|
+
return formatInterfaces();
|
|
308
|
+
}
|
|
309
|
+
});
|
|
310
|
+
server.addTool({
|
|
311
|
+
name: "validate_code",
|
|
312
|
+
description: "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.",
|
|
313
|
+
parameters: z.object({
|
|
314
|
+
code: z.string().describe("TypeScript code snippet using functype to type-check"),
|
|
315
|
+
auto_import: z.boolean().optional().default(true).describe("Automatically import all functype types if no import statement is present. Default: true")
|
|
316
|
+
}),
|
|
317
|
+
execute: async (args) => {
|
|
318
|
+
const result = validateCode(args.code, { autoImport: args.auto_import });
|
|
319
|
+
if (result.success) return `Validation PASSED${result.importsPrepended ? " (functype imports auto-added)" : ""}\n\nThe code is type-correct.`;
|
|
320
|
+
const errorLines = result.diagnostics.map((d) => `- Line ${d.line}, Col ${d.column}: ${d.message} (TS${d.code})`);
|
|
321
|
+
const importNote = result.importsPrepended ? "\n\nNote: functype imports were auto-added." : "";
|
|
322
|
+
return `Validation FAILED — ${result.diagnostics.length} error(s):\n\n${errorLines.join("\n")}${importNote}`;
|
|
323
|
+
}
|
|
324
|
+
});
|
|
325
|
+
server.addTool({
|
|
326
|
+
name: "set_functype_version",
|
|
327
|
+
description: "Switch the functype version at runtime. Installs the specified version and reloads all documentation and type definitions.",
|
|
328
|
+
parameters: z.object({ version: z.string().describe("The functype version to install (e.g., \"0.46.0\", \"latest\", \"^0.45.0\")") }),
|
|
329
|
+
execute: async (args) => {
|
|
330
|
+
const spec = `functype@${args.version}`;
|
|
331
|
+
try {
|
|
332
|
+
execFileSync("pnpm", ["add", spec], {
|
|
333
|
+
cwd: PROJECT_ROOT,
|
|
334
|
+
stdio: "pipe",
|
|
335
|
+
timeout: 6e4
|
|
336
|
+
});
|
|
337
|
+
} catch (err) {
|
|
338
|
+
return `Failed to install ${spec}: ${err instanceof Error ? err.message : String(err)}`;
|
|
339
|
+
}
|
|
340
|
+
clearFileCache();
|
|
341
|
+
try {
|
|
342
|
+
await initDocsData(true);
|
|
343
|
+
} catch {
|
|
344
|
+
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.`;
|
|
345
|
+
}
|
|
346
|
+
return `Switched to functype v${VERSION}. Documentation and type definitions have been reloaded.`;
|
|
347
|
+
}
|
|
348
|
+
});
|
|
349
|
+
return server;
|
|
350
|
+
}
|
|
351
|
+
async function main() {
|
|
352
|
+
await initDocsData();
|
|
353
|
+
const server = createServer();
|
|
354
|
+
const useHttp = process.env.TRANSPORT_TYPE === "httpStream" || process.env.TRANSPORT_TYPE === "http";
|
|
355
|
+
const port = parseInt(process.env.PORT || "3000");
|
|
356
|
+
const host = process.env.HOST || "0.0.0.0";
|
|
357
|
+
if (useHttp) {
|
|
358
|
+
console.error(`[functype-mcp] Starting HTTP server on ${host}:${port}`);
|
|
359
|
+
await server.start({
|
|
360
|
+
transportType: "httpStream",
|
|
361
|
+
httpStream: {
|
|
362
|
+
port,
|
|
363
|
+
host,
|
|
364
|
+
endpoint: "/mcp"
|
|
365
|
+
}
|
|
366
|
+
});
|
|
367
|
+
console.error(`[functype-mcp] HTTP server ready at http://${host}:${port}/mcp`);
|
|
368
|
+
} else {
|
|
369
|
+
console.error("[functype-mcp] Starting in stdio mode");
|
|
370
|
+
await server.start({ transportType: "stdio" });
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
process.on("SIGINT", () => process.exit(0));
|
|
374
|
+
process.on("SIGTERM", () => process.exit(0));
|
|
375
|
+
main().catch(console.error);
|
|
376
|
+
|
|
377
|
+
//#endregion
|
|
378
|
+
export { };
|
|
379
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +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,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,I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package.json
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "functype-mcp-server",
|
|
3
|
+
"version": "0.47.0",
|
|
4
|
+
"description": "MCP server for functype documentation lookup and TypeScript code validation",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"mcp",
|
|
7
|
+
"functype",
|
|
8
|
+
"typescript",
|
|
9
|
+
"functional-programming",
|
|
10
|
+
"model-context-protocol",
|
|
11
|
+
"claude",
|
|
12
|
+
"ai-assistant",
|
|
13
|
+
"fastmcp",
|
|
14
|
+
"type-checking"
|
|
15
|
+
],
|
|
16
|
+
"author": "Jordan Burke <jordan.burke@gmail.com>",
|
|
17
|
+
"license": "MIT",
|
|
18
|
+
"homepage": "https://github.com/jordanburke/functype-mcp-server#readme",
|
|
19
|
+
"repository": {
|
|
20
|
+
"type": "git",
|
|
21
|
+
"url": "git+https://github.com/jordanburke/functype-mcp-server.git"
|
|
22
|
+
},
|
|
23
|
+
"bugs": {
|
|
24
|
+
"url": "https://github.com/jordanburke/functype-mcp-server/issues"
|
|
25
|
+
},
|
|
26
|
+
"bin": {
|
|
27
|
+
"functype-mcp-server": "dist/bin.js"
|
|
28
|
+
},
|
|
29
|
+
"type": "module",
|
|
30
|
+
"main": "./dist/index.js",
|
|
31
|
+
"module": "./dist/index.js",
|
|
32
|
+
"types": "./dist/index.d.ts",
|
|
33
|
+
"exports": {
|
|
34
|
+
".": {
|
|
35
|
+
"types": "./dist/index.d.ts",
|
|
36
|
+
"import": "./dist/index.js",
|
|
37
|
+
"default": "./dist/index.js"
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
"files": [
|
|
41
|
+
"dist/",
|
|
42
|
+
"README.md",
|
|
43
|
+
"LICENSE"
|
|
44
|
+
],
|
|
45
|
+
"dependencies": {
|
|
46
|
+
"fastmcp": "^3.33.0",
|
|
47
|
+
"functype": "^0.47.0",
|
|
48
|
+
"typescript": "^5.9.3",
|
|
49
|
+
"zod": "^4.3.6"
|
|
50
|
+
},
|
|
51
|
+
"devDependencies": {
|
|
52
|
+
"@types/node": "^24.10.13",
|
|
53
|
+
"ts-builds": "^2.4.0",
|
|
54
|
+
"tsdown": "^0.20.3",
|
|
55
|
+
"tsx": "^4.21.0"
|
|
56
|
+
},
|
|
57
|
+
"prettier": "ts-builds/prettier",
|
|
58
|
+
"scripts": {
|
|
59
|
+
"validate": "ts-builds validate",
|
|
60
|
+
"format": "ts-builds format",
|
|
61
|
+
"format:check": "ts-builds format:check",
|
|
62
|
+
"lint": "ts-builds lint",
|
|
63
|
+
"lint:check": "ts-builds lint:check",
|
|
64
|
+
"typecheck": "ts-builds typecheck",
|
|
65
|
+
"test": "ts-builds test",
|
|
66
|
+
"test:watch": "ts-builds test:watch",
|
|
67
|
+
"test:coverage": "ts-builds test:coverage",
|
|
68
|
+
"build": "NODE_ENV=production ts-builds build",
|
|
69
|
+
"dev": "ts-builds dev",
|
|
70
|
+
"inspect": "pnpm build && npx @modelcontextprotocol/inspector dist/index.js",
|
|
71
|
+
"serve": "pnpm build && node dist/index.js",
|
|
72
|
+
"serve:dev": "tsx watch src/index.ts"
|
|
73
|
+
}
|
|
74
|
+
}
|