@flemist/mcp-project-tools 1.0.3 → 3.0.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/build/cli.d.ts ADDED
@@ -0,0 +1 @@
1
+ export { }
package/build/cli.js CHANGED
@@ -1,58 +1,96 @@
1
- import { Command } from "commander";
2
- import { S as SERVER_VERSION, s as startMcpServer, a as SERVER_NAME, A as AUTH_TOKEN } from "./startMcpServer-CN6Th9Zn.js";
3
- import * as path from "path";
4
- const program = new Command();
5
- program.name("mcp-project-tools").description("MCP project tools server").version(SERVER_VERSION);
6
- mcpCliRegister(program);
7
- function mcpCliRegister(program2) {
8
- program2.option("-p, --port <number>", "Server port").option("-h, --host <string>", "Server host").option("--auth-token <string>", "Authentication token").option("--log-dir <string>", "Log directory").option("--disable-process-manager", "Disable process manager tools").option("--disable-fs-manager", "Disable file system manager tools").option("--process-working-dir <string>", "Process manager working directory").option("--process-allowed-commands <commands>", "Comma-separated list of allowed commands").option("--fs-working-dir <string>", "File system manager working directory").option("--fs-exclude-patterns <patterns>", "Comma-separated list of exclude patterns").option("--mcpignore-file <string>", "Path to .mcpignore file").action(async (options) => {
1
+ import { Command as u } from "commander";
2
+ import { S as c, a as p, A as f, s as g } from "./startMcpServer-BOhpWAg9.js";
3
+ import * as i from "path";
4
+ import * as m from "fs";
5
+ import d from "deepmerge";
6
+ import { pathToFileURL as C } from "url";
7
+ const v = {
8
+ port: 8e3,
9
+ host: "localhost",
10
+ authToken: f,
11
+ name: p,
12
+ version: c,
13
+ logDir: "tmp/mcp-project-tools/logs",
14
+ enableJsonResponse: !0,
15
+ tools: {
16
+ processManager: {
17
+ workingDir: null,
18
+ commandLineRules: [],
19
+ run: !0,
20
+ status: !0,
21
+ wait: !0,
22
+ list: !0,
23
+ kill: !0
24
+ },
25
+ fsManager: {
26
+ workingDir: null,
27
+ globsExclude: null,
28
+ list: !0,
29
+ snapshotQueryCreate: !0,
30
+ snapshotCreate: !0,
31
+ snapshotBrowse: !0
32
+ },
33
+ playwrightManager: {
34
+ browserCreate: !0,
35
+ browserList: !0,
36
+ browserClose: !0,
37
+ contextCreate: !0,
38
+ contextList: !0,
39
+ contextClose: !0,
40
+ pageCreate: !0,
41
+ pageList: !0,
42
+ pageClose: !0,
43
+ pageGoto: !0,
44
+ domSnapshotQueryCreate: !0,
45
+ domSnapshotCreate: !0,
46
+ domSnapshotBrowse: !0
47
+ }
48
+ }
49
+ };
50
+ async function h(e, a) {
51
+ e || (e = "flemist-mcp.config.js");
52
+ let r = {};
53
+ if (e && m.existsSync(e))
54
+ try {
55
+ const o = i.resolve(e);
56
+ console.log(`Loading configuration from: ${o}`);
57
+ const t = await import(C(o).href);
58
+ r = t.default || t;
59
+ } catch (o) {
60
+ throw console.error(`Failed to load config from ${e}:`), o;
61
+ }
62
+ else e && console.warn(
63
+ `Config file not found: ${e}. Using default configuration`
64
+ );
65
+ const s = d(v, r, {
66
+ arrayMerge(o, t) {
67
+ return t;
68
+ }
69
+ });
70
+ return s.tools?.fsManager && (s.tools.fsManager.globsExclude = [
71
+ {
72
+ value: a || ".flemist-mcpignore",
73
+ valueType: "file-contains-patterns",
74
+ exclude: !0
75
+ },
76
+ ...s.tools.fsManager.globsExclude || []
77
+ ]), s.tools.fsManager?.globsExclude?.forEach((o, t, l) => {
78
+ o.valueType === "file-contains-patterns" && (l[t].value = i.resolve(o.value));
79
+ }), s;
80
+ }
81
+ const w = "3.0.0", M = {
82
+ version: w
83
+ }, n = new u();
84
+ n.name("mcp-project-tools").description("MCP project tools server").version(M.version, "-v, --version", "output the current version");
85
+ E(n);
86
+ function E(e) {
87
+ e.option("-c, --config [path]", "Path to configuration file (optional)").option("-i, --ignore [path]", "Path to .flemist-mcpignore file (optional)").action(async (a) => {
9
88
  try {
10
- const processAllowedCommands = options.processAllowedCommands ? options.processAllowedCommands.split(",").map((cmd) => cmd.trim()) : ["pnpm", "echo", "vitest", "eslint", "stylelint"];
11
- const fsExcludePatterns = options.fsExcludePatterns ? options.fsExcludePatterns.split(",").map((pattern) => pattern.trim()) : [];
12
- const mcpignoreFile = path.resolve(options.mcpignoreFile || ".mcpignore");
13
- const defaultFsExcludes = [
14
- {
15
- value: mcpignoreFile,
16
- valueType: "file-contains-patterns",
17
- exclude: true
18
- }
19
- ];
20
- const additionalFsExcludes = fsExcludePatterns.map((pattern) => ({
21
- value: pattern,
22
- valueType: "pattern",
23
- exclude: true
24
- }));
25
- await startMcpServer({
26
- port: options.port ? parseInt(options.port, 10) : 8e3,
27
- host: options.host || "local.host",
28
- authToken: options.authToken || AUTH_TOKEN,
29
- name: SERVER_NAME,
30
- version: SERVER_VERSION,
31
- logDir: options.logDir || "tmp/mcp-project-tools/logs",
32
- enableJsonResponse: false,
33
- tools: {
34
- processManager: options.disableProcessManager ? null : {
35
- workingDir: options.processWorkingDir || null,
36
- run: {
37
- allowedCommands: processAllowedCommands
38
- }
39
- },
40
- fsManager: options.disableFsManager ? null : {
41
- workingDir: options.fsWorkingDir || null,
42
- list: {
43
- globsExclude: [
44
- ...defaultFsExcludes,
45
- ...additionalFsExcludes
46
- ]
47
- }
48
- }
49
- }
50
- });
51
- } catch (error) {
52
- console.error("Failed to start MCP server:", error);
53
- process.exit(1);
89
+ const r = await h(a.config, a.ignore);
90
+ await g(r);
91
+ } catch (r) {
92
+ console.error("Failed to start MCP server:", r), process.exit(1);
54
93
  }
55
94
  });
56
95
  }
57
- program.parse();
58
- //# sourceMappingURL=cli.js.map
96
+ n.parse();
@@ -0,0 +1,91 @@
1
+ import { Server } from 'http';
2
+
3
+ declare type CommandLineRule = {
4
+ rule: 'allow' | 'deny';
5
+ /** description, purpose, note about this rule for AI agents */
6
+ note: string;
7
+ /** Case-sensitive */
8
+ regexp: string;
9
+ };
10
+
11
+ declare type CreateServerOptions = {
12
+ logFilePath: string;
13
+ };
14
+
15
+ declare type FsManagerOptions = {
16
+ workingDir?: string | null;
17
+ globsExclude?: Glob[] | null;
18
+ list?: null | boolean;
19
+ snapshotQueryCreate?: null | boolean;
20
+ snapshotCreate?: null | boolean;
21
+ snapshotBrowse?: null | boolean;
22
+ };
23
+
24
+ /**
25
+ * @import {CreateMatchPathOptions} from "./walkPaths/createMatchPath"
26
+ */
27
+ declare type Glob = {
28
+ value: string;
29
+ valueType: 'file-contains-patterns' | 'pattern';
30
+ /**
31
+ * exclude like .gitignore by adding ^ prefix to glob.
32
+ * @see CreateMatchPathOptions
33
+ */
34
+ exclude: boolean;
35
+ };
36
+
37
+ export declare type McpConfig = Partial<StartMcpServerOptions>;
38
+
39
+ declare type McpServerOptions = {
40
+ name: string;
41
+ version: string;
42
+ authToken: string;
43
+ logFilePath: string;
44
+ enableJsonResponse?: boolean | null;
45
+ };
46
+
47
+ declare type PlaywrightManagerOptions = {
48
+ browserCreate?: null | boolean;
49
+ browserList?: null | boolean;
50
+ browserClose?: null | boolean;
51
+ contextCreate?: null | boolean;
52
+ contextList?: null | boolean;
53
+ contextClose?: null | boolean;
54
+ pageCreate?: null | boolean;
55
+ pageList?: null | boolean;
56
+ pageClose?: null | boolean;
57
+ pageGoto?: null | boolean;
58
+ domSnapshotQueryCreate?: null | boolean;
59
+ domSnapshotCreate?: null | boolean;
60
+ domSnapshotBrowse?: null | boolean;
61
+ };
62
+
63
+ declare type ProcessManagerOptions = {
64
+ /** Working directory for process execution, null uses current directory */
65
+ workingDir?: string | null;
66
+ commandLineRules: CommandLineRule[];
67
+ run?: null | boolean;
68
+ status?: null | boolean;
69
+ wait?: null | boolean;
70
+ list?: null | boolean;
71
+ kill?: null | boolean;
72
+ };
73
+
74
+ export declare function startMcpServer(options: StartMcpServerOptions): Promise<Server>;
75
+
76
+ declare type StartMcpServerOptions = Omit<CreateServerOptions & McpServerOptions & StartServerOptions, 'logFilePath'> & {
77
+ logDir: string;
78
+ tools: {
79
+ processManager?: null | ProcessManagerOptions;
80
+ fsManager?: null | FsManagerOptions;
81
+ playwrightManager?: null | PlaywrightManagerOptions;
82
+ };
83
+ };
84
+
85
+ declare type StartServerOptions = {
86
+ host?: string | null;
87
+ port?: number | null;
88
+ logFilePath: string;
89
+ };
90
+
91
+ export { }
package/build/index.js CHANGED
@@ -1,5 +1,4 @@
1
- import { s } from "./startMcpServer-CN6Th9Zn.js";
1
+ import { s } from "./startMcpServer-BOhpWAg9.js";
2
2
  export {
3
3
  s as startMcpServer
4
4
  };
5
- //# sourceMappingURL=index.js.map