@firfi/huly-mcp 0.7.0 → 0.9.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/README.md +17 -5
- package/dist/index.cjs +25992 -25310
- package/package.json +31 -19
- package/dist/index.js +0 -116694
- package/dist/src/config/config.d.ts +0 -94
- package/dist/src/config/config.d.ts.map +0 -1
- package/dist/src/config/config.js +0 -247
- package/dist/src/config/config.js.map +0 -1
- package/dist/src/domain/schemas.d.ts +0 -256
- package/dist/src/domain/schemas.d.ts.map +0 -1
- package/dist/src/domain/schemas.js +0 -275
- package/dist/src/domain/schemas.js.map +0 -1
- package/dist/src/huly/client.d.ts +0 -63
- package/dist/src/huly/client.d.ts.map +0 -1
- package/dist/src/huly/client.js +0 -149
- package/dist/src/huly/client.js.map +0 -1
- package/dist/src/huly/errors.d.ts +0 -133
- package/dist/src/huly/errors.d.ts.map +0 -1
- package/dist/src/huly/errors.js +0 -108
- package/dist/src/huly/errors.js.map +0 -1
- package/dist/src/huly/operations/issues.d.ts +0 -122
- package/dist/src/huly/operations/issues.d.ts.map +0 -1
- package/dist/src/huly/operations/issues.js +0 -627
- package/dist/src/huly/operations/issues.js.map +0 -1
- package/dist/src/index.d.ts +0 -43
- package/dist/src/index.d.ts.map +0 -1
- package/dist/src/index.js +0 -154
- package/dist/src/index.js.map +0 -1
- package/dist/src/mcp/error-mapping.d.ts +0 -67
- package/dist/src/mcp/error-mapping.d.ts.map +0 -1
- package/dist/src/mcp/error-mapping.js +0 -195
- package/dist/src/mcp/error-mapping.js.map +0 -1
- package/dist/src/mcp/server.d.ts +0 -86
- package/dist/src/mcp/server.d.ts.map +0 -1
- package/dist/src/mcp/server.js +0 -216
- package/dist/src/mcp/server.js.map +0 -1
- package/dist/tsconfig.tsbuildinfo +0 -1
package/dist/src/index.d.ts
DELETED
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
/**
|
|
3
|
-
* Main entry point for Huly MCP server.
|
|
4
|
-
*
|
|
5
|
-
* Loads configuration, builds Layer stack, and starts the MCP server.
|
|
6
|
-
* Handles graceful shutdown on SIGTERM/SIGINT.
|
|
7
|
-
*
|
|
8
|
-
* Usage:
|
|
9
|
-
* npm start
|
|
10
|
-
*
|
|
11
|
-
* Environment variables:
|
|
12
|
-
* HULY_URL - Huly platform URL (required)
|
|
13
|
-
* HULY_EMAIL - User email (required)
|
|
14
|
-
* HULY_PASSWORD - User password (required)
|
|
15
|
-
* HULY_WORKSPACE - Default workspace (required)
|
|
16
|
-
* HULY_CONNECTION_TIMEOUT - Connection timeout in ms (default: 30000)
|
|
17
|
-
* MCP_TRANSPORT - Transport mode: stdio (default: stdio)
|
|
18
|
-
*
|
|
19
|
-
* @module
|
|
20
|
-
*/
|
|
21
|
-
import { Effect, Layer, ConfigError } from "effect";
|
|
22
|
-
import { type HulyConfigError } from "./config/config.js";
|
|
23
|
-
import { type HulyClientError } from "./huly/client.js";
|
|
24
|
-
import { McpServerService, McpServerError, type McpTransportType } from "./mcp/server.js";
|
|
25
|
-
/**
|
|
26
|
-
* Application error - wraps all startup/runtime errors.
|
|
27
|
-
*/
|
|
28
|
-
export type AppError = HulyConfigError | HulyClientError | McpServerError | ConfigError.ConfigError;
|
|
29
|
-
/**
|
|
30
|
-
* Build the full application layer stack.
|
|
31
|
-
* Config → HulyClient → McpServer
|
|
32
|
-
*/
|
|
33
|
-
export declare const buildAppLayer: (transport: McpTransportType, httpPort: number) => Layer.Layer<McpServerService, HulyConfigError | HulyClientError, never>;
|
|
34
|
-
/**
|
|
35
|
-
* Main program that starts the MCP server.
|
|
36
|
-
* Runs until shutdown signal is received.
|
|
37
|
-
*/
|
|
38
|
-
export declare const main: Effect.Effect<void, AppError>;
|
|
39
|
-
/**
|
|
40
|
-
* Run the main program with error handling.
|
|
41
|
-
*/
|
|
42
|
-
export declare const run: () => Promise<void>;
|
|
43
|
-
//# sourceMappingURL=index.d.ts.map
|
package/dist/src/index.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";AACA;;;;;;;;;;;;;;;;;;GAkBG;AACH,OAAO,EAAE,MAAM,EAAE,KAAK,EAA0B,WAAW,EAAU,MAAM,QAAQ,CAAA;AACnF,OAAO,EAAqB,KAAK,eAAe,EAAE,MAAM,oBAAoB,CAAA;AAC5E,OAAO,EAAc,KAAK,eAAe,EAAE,MAAM,kBAAkB,CAAA;AACnE,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,KAAK,gBAAgB,EAAE,MAAM,iBAAiB,CAAA;AAIzF;;GAEG;AACH,MAAM,MAAM,QAAQ,GAAG,eAAe,GAAG,eAAe,GAAG,cAAc,GAAG,WAAW,CAAC,WAAW,CAAA;AAwBnG;;;GAGG;AACH,eAAO,MAAM,aAAa,GACxB,WAAW,gBAAgB,EAC3B,UAAU,MAAM,KACf,KAAK,CAAC,KAAK,CAAC,gBAAgB,EAAE,eAAe,GAAG,eAAe,EAAE,KAAK,CAaxE,CAAA;AAED;;;GAGG;AACH,eAAO,MAAM,IAAI,EAAE,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,QAAQ,CAkB7C,CAAA;AAqDF;;GAEG;AACH,eAAO,MAAM,GAAG,QAAO,OAAO,CAAC,IAAI,CAUhC,CAAA"}
|
package/dist/src/index.js
DELETED
|
@@ -1,154 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
/**
|
|
3
|
-
* Main entry point for Huly MCP server.
|
|
4
|
-
*
|
|
5
|
-
* Loads configuration, builds Layer stack, and starts the MCP server.
|
|
6
|
-
* Handles graceful shutdown on SIGTERM/SIGINT.
|
|
7
|
-
*
|
|
8
|
-
* Usage:
|
|
9
|
-
* npm start
|
|
10
|
-
*
|
|
11
|
-
* Environment variables:
|
|
12
|
-
* HULY_URL - Huly platform URL (required)
|
|
13
|
-
* HULY_EMAIL - User email (required)
|
|
14
|
-
* HULY_PASSWORD - User password (required)
|
|
15
|
-
* HULY_WORKSPACE - Default workspace (required)
|
|
16
|
-
* HULY_CONNECTION_TIMEOUT - Connection timeout in ms (default: 30000)
|
|
17
|
-
* MCP_TRANSPORT - Transport mode: stdio (default: stdio)
|
|
18
|
-
*
|
|
19
|
-
* @module
|
|
20
|
-
*/
|
|
21
|
-
import { Effect, Layer, Cause, Console, Config, ConfigError, Option } from "effect";
|
|
22
|
-
import { HulyConfigService } from "./config/config.js";
|
|
23
|
-
import { HulyClient } from "./huly/client.js";
|
|
24
|
-
import { McpServerService, McpServerError } from "./mcp/server.js";
|
|
25
|
-
// --- Main Program ---
|
|
26
|
-
/**
|
|
27
|
-
* Get transport type from environment.
|
|
28
|
-
* Defaults to "stdio" if not set.
|
|
29
|
-
*/
|
|
30
|
-
const getTransportType = Config.string("MCP_TRANSPORT").pipe(Config.withDefault("stdio"), Effect.map((t) => {
|
|
31
|
-
if (t === "http")
|
|
32
|
-
return "http";
|
|
33
|
-
return "stdio";
|
|
34
|
-
}));
|
|
35
|
-
/**
|
|
36
|
-
* Get HTTP port from environment.
|
|
37
|
-
* Defaults to 3000 if not set.
|
|
38
|
-
*/
|
|
39
|
-
const getHttpPort = Config.integer("MCP_HTTP_PORT").pipe(Config.withDefault(3000));
|
|
40
|
-
/**
|
|
41
|
-
* Build the full application layer stack.
|
|
42
|
-
* Config → HulyClient → McpServer
|
|
43
|
-
*/
|
|
44
|
-
export const buildAppLayer = (transport, httpPort) => {
|
|
45
|
-
// HulyClient requires HulyConfig
|
|
46
|
-
const hulyClientLayer = HulyClient.layer.pipe(Layer.provide(HulyConfigService.layer));
|
|
47
|
-
// McpServer requires HulyClient
|
|
48
|
-
const mcpServerLayer = McpServerService.layer({
|
|
49
|
-
transport,
|
|
50
|
-
httpPort,
|
|
51
|
-
}).pipe(Layer.provide(hulyClientLayer));
|
|
52
|
-
return mcpServerLayer;
|
|
53
|
-
};
|
|
54
|
-
/**
|
|
55
|
-
* Main program that starts the MCP server.
|
|
56
|
-
* Runs until shutdown signal is received.
|
|
57
|
-
*/
|
|
58
|
-
export const main = Effect.gen(function* () {
|
|
59
|
-
// Get transport configuration
|
|
60
|
-
const transport = yield* getTransportType;
|
|
61
|
-
const httpPort = yield* getHttpPort;
|
|
62
|
-
yield* Console.log(`Starting Huly MCP server (transport: ${transport})...`);
|
|
63
|
-
// Build layer stack
|
|
64
|
-
const appLayer = buildAppLayer(transport, httpPort);
|
|
65
|
-
// Get server service and run
|
|
66
|
-
yield* Effect.gen(function* () {
|
|
67
|
-
const server = yield* McpServerService;
|
|
68
|
-
yield* server.run();
|
|
69
|
-
}).pipe(Effect.provide(appLayer), Effect.scoped);
|
|
70
|
-
});
|
|
71
|
-
/**
|
|
72
|
-
* Format error for display.
|
|
73
|
-
*/
|
|
74
|
-
const formatError = (error) => {
|
|
75
|
-
if (error instanceof Error) {
|
|
76
|
-
const tagged = error;
|
|
77
|
-
if (tagged._tag) {
|
|
78
|
-
if (tagged._tag === "ConfigValidationError") {
|
|
79
|
-
const field = tagged.field ? ` (${tagged.field})` : "";
|
|
80
|
-
return `Configuration error${field}: ${error.message}`;
|
|
81
|
-
}
|
|
82
|
-
if (tagged._tag === "ConfigFileError") {
|
|
83
|
-
return `Config file error: ${error.message}`;
|
|
84
|
-
}
|
|
85
|
-
if (tagged._tag === "HulyConnectionError") {
|
|
86
|
-
return `Connection error: ${error.message}`;
|
|
87
|
-
}
|
|
88
|
-
if (tagged._tag === "HulyAuthError") {
|
|
89
|
-
return `Authentication error: ${error.message}`;
|
|
90
|
-
}
|
|
91
|
-
if (tagged._tag === "McpServerError") {
|
|
92
|
-
return `Server error: ${error.message}`;
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
return error.message;
|
|
96
|
-
}
|
|
97
|
-
return String(error);
|
|
98
|
-
};
|
|
99
|
-
/**
|
|
100
|
-
* Handle program failure by logging and exiting.
|
|
101
|
-
*/
|
|
102
|
-
const handleFailure = (cause) => Effect.gen(function* () {
|
|
103
|
-
if (Cause.isFailure(cause)) {
|
|
104
|
-
const error = Cause.failureOption(cause);
|
|
105
|
-
if (Option.isSome(error)) {
|
|
106
|
-
yield* Console.error(`Error: ${formatError(error.value)}`);
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
else if (Cause.isDie(cause)) {
|
|
110
|
-
const defect = Cause.dieOption(cause);
|
|
111
|
-
if (Option.isSome(defect)) {
|
|
112
|
-
yield* Console.error(`Fatal error: ${formatError(defect.value)}`);
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
else if (Cause.isInterrupted(cause)) {
|
|
116
|
-
yield* Console.log("Server interrupted");
|
|
117
|
-
}
|
|
118
|
-
else {
|
|
119
|
-
yield* Console.error(`Unexpected error: ${Cause.pretty(cause)}`);
|
|
120
|
-
}
|
|
121
|
-
});
|
|
122
|
-
/**
|
|
123
|
-
* Run the main program with error handling.
|
|
124
|
-
*/
|
|
125
|
-
export const run = () => Effect.runPromise(main.pipe(Effect.catchAllCause((cause) => handleFailure(cause).pipe(Effect.flatMap(() => Effect.fail(cause)))), Effect.catchAll(() => Effect.void)));
|
|
126
|
-
// Run if this is the main module
|
|
127
|
-
const isMainModule = () => {
|
|
128
|
-
// Check if we're being run directly
|
|
129
|
-
// In ESM, we can check import.meta.url against process.argv
|
|
130
|
-
try {
|
|
131
|
-
const moduleUrl = new URL(import.meta.url);
|
|
132
|
-
const argPath = process.argv[1];
|
|
133
|
-
if (!argPath)
|
|
134
|
-
return false;
|
|
135
|
-
// Normalize paths for comparison
|
|
136
|
-
const modulePath = moduleUrl.pathname;
|
|
137
|
-
const normalizedArgPath = argPath.startsWith("file://")
|
|
138
|
-
? new URL(argPath).pathname
|
|
139
|
-
: argPath;
|
|
140
|
-
return modulePath === normalizedArgPath ||
|
|
141
|
-
modulePath.endsWith(normalizedArgPath) ||
|
|
142
|
-
normalizedArgPath.endsWith(modulePath.split("/").pop() ?? "");
|
|
143
|
-
}
|
|
144
|
-
catch {
|
|
145
|
-
return false;
|
|
146
|
-
}
|
|
147
|
-
};
|
|
148
|
-
if (isMainModule()) {
|
|
149
|
-
run().catch((error) => {
|
|
150
|
-
console.error("Unhandled error:", error);
|
|
151
|
-
process.exit(1);
|
|
152
|
-
});
|
|
153
|
-
}
|
|
154
|
-
//# sourceMappingURL=index.js.map
|
package/dist/src/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";AACA;;;;;;;;;;;;;;;;;;GAkBG;AACH,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AACnF,OAAO,EAAE,iBAAiB,EAAwB,MAAM,oBAAoB,CAAA;AAC5E,OAAO,EAAE,UAAU,EAAwB,MAAM,kBAAkB,CAAA;AACnE,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAyB,MAAM,iBAAiB,CAAA;AASzF,uBAAuB;AAEvB;;;GAGG;AACH,MAAM,gBAAgB,GAAG,MAAM,CAAC,MAAM,CAAC,eAAe,CAAC,CAAC,IAAI,CAC1D,MAAM,CAAC,WAAW,CAAC,OAAO,CAAC,EAC3B,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAoB,EAAE;IACjC,IAAI,CAAC,KAAK,MAAM;QAAE,OAAO,MAAM,CAAA;IAC/B,OAAO,OAAO,CAAA;AAChB,CAAC,CAAC,CACH,CAAA;AAED;;;GAGG;AACH,MAAM,WAAW,GAAG,MAAM,CAAC,OAAO,CAAC,eAAe,CAAC,CAAC,IAAI,CACtD,MAAM,CAAC,WAAW,CAAC,IAAI,CAAC,CACzB,CAAA;AAED;;;GAGG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,CAC3B,SAA2B,EAC3B,QAAgB,EACyD,EAAE;IAC3E,iCAAiC;IACjC,MAAM,eAAe,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,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;QAC/B,IAAI,CAAC,OAAO;YAAE,OAAO,KAAK,CAAA;QAE1B,iCAAiC;QACjC,MAAM,UAAU,GAAG,SAAS,CAAC,QAAQ,CAAA;QACrC,MAAM,iBAAiB,GAAG,OAAO,CAAC,UAAU,CAAC,SAAS,CAAC;YACrD,CAAC,CAAC,IAAI,GAAG,CAAC,OAAO,CAAC,CAAC,QAAQ;YAC3B,CAAC,CAAC,OAAO,CAAA;QAEX,OAAO,UAAU,KAAK,iBAAiB;YAChC,UAAU,CAAC,QAAQ,CAAC,iBAAiB,CAAC;YACtC,iBAAiB,CAAC,QAAQ,CAAC,UAAU,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,IAAI,EAAE,CAAC,CAAA;IACtE,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAA;IACd,CAAC;AACH,CAAC,CAAA;AAED,IAAI,YAAY,EAAE,EAAE,CAAC;IACnB,GAAG,EAAE,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;QACpB,OAAO,CAAC,KAAK,CAAC,kBAAkB,EAAE,KAAK,CAAC,CAAA;QACxC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;IACjB,CAAC,CAAC,CAAA;AACJ,CAAC"}
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Error mapping from Effect errors to MCP protocol error responses.
|
|
3
|
-
*
|
|
4
|
-
* Maps domain errors to appropriate MCP error codes:
|
|
5
|
-
* - -32602 (Invalid params): ParseError, IssueNotFoundError, ProjectNotFoundError, etc.
|
|
6
|
-
* - -32603 (Internal error): HulyConnectionError, HulyAuthError, unknown errors
|
|
7
|
-
*
|
|
8
|
-
* Security: Sanitizes error messages to prevent leaking sensitive information.
|
|
9
|
-
*
|
|
10
|
-
* @module
|
|
11
|
-
*/
|
|
12
|
-
import { Cause, ParseResult } from "effect";
|
|
13
|
-
import { McpErrorCode, type HulyDomainError } from "../huly/errors.js";
|
|
14
|
-
/**
|
|
15
|
-
* MCP protocol tool response structure.
|
|
16
|
-
* Compatible with MCP SDK CallToolResult.
|
|
17
|
-
* Uses index signature to match SDK's loose typing.
|
|
18
|
-
*/
|
|
19
|
-
export interface McpToolResponse {
|
|
20
|
-
content: Array<{
|
|
21
|
-
type: "text";
|
|
22
|
-
text: string;
|
|
23
|
-
}>;
|
|
24
|
-
isError?: boolean;
|
|
25
|
-
[key: string]: unknown;
|
|
26
|
-
}
|
|
27
|
-
/**
|
|
28
|
-
* Internal metadata for error tracking (not exposed to MCP).
|
|
29
|
-
*/
|
|
30
|
-
export interface ErrorMetadata {
|
|
31
|
-
errorCode: McpErrorCode;
|
|
32
|
-
}
|
|
33
|
-
/**
|
|
34
|
-
* Internal error response with metadata for testing.
|
|
35
|
-
*/
|
|
36
|
-
export interface McpErrorResponseWithMeta extends McpToolResponse {
|
|
37
|
-
isError: true;
|
|
38
|
-
_meta: ErrorMetadata;
|
|
39
|
-
}
|
|
40
|
-
/**
|
|
41
|
-
* Map a HulyDomainError to an MCP error response.
|
|
42
|
-
* Uses pattern matching on tagged errors for type-safe handling.
|
|
43
|
-
*/
|
|
44
|
-
export declare const mapDomainErrorToMcp: (error: HulyDomainError) => McpErrorResponseWithMeta;
|
|
45
|
-
/**
|
|
46
|
-
* Map a ParseError to an MCP error response.
|
|
47
|
-
*/
|
|
48
|
-
export declare const mapParseErrorToMcp: (error: ParseResult.ParseError, toolName?: string) => McpErrorResponseWithMeta;
|
|
49
|
-
/**
|
|
50
|
-
* Map an Effect Cause to an MCP error response.
|
|
51
|
-
* Handles Fail, Die, and Interrupt causes appropriately.
|
|
52
|
-
*/
|
|
53
|
-
export declare const mapCauseToMcp: <E>(cause: Cause.Cause<E>, toolName?: string) => McpErrorResponseWithMeta;
|
|
54
|
-
/**
|
|
55
|
-
* Create an MCP success response from a result value.
|
|
56
|
-
*/
|
|
57
|
-
export declare const createSuccessResponse: <T>(result: T) => McpToolResponse;
|
|
58
|
-
/**
|
|
59
|
-
* Create an MCP error response for an unknown tool.
|
|
60
|
-
*/
|
|
61
|
-
export declare const createUnknownToolError: (toolName: string) => McpErrorResponseWithMeta;
|
|
62
|
-
/**
|
|
63
|
-
* Strip internal metadata for MCP SDK compatibility.
|
|
64
|
-
* Converts internal response to MCP-compatible format.
|
|
65
|
-
*/
|
|
66
|
-
export declare const toMcpResponse: (response: McpErrorResponseWithMeta | McpToolResponse) => McpToolResponse;
|
|
67
|
-
//# sourceMappingURL=error-mapping.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"error-mapping.d.ts","sourceRoot":"","sources":["../../../src/mcp/error-mapping.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,EAAE,KAAK,EAAgB,WAAW,EAAE,MAAM,QAAQ,CAAA;AACzD,OAAO,EACL,YAAY,EACZ,KAAK,eAAe,EACrB,MAAM,mBAAmB,CAAA;AAI1B;;;;GAIG;AACH,MAAM,WAAW,eAAe;IAC9B,OAAO,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;IAC9C,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;CACvB;AAED;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,SAAS,EAAE,YAAY,CAAA;CACxB;AAED;;GAEG;AACH,MAAM,WAAW,wBAAyB,SAAQ,eAAe;IAC/D,OAAO,EAAE,IAAI,CAAA;IACb,KAAK,EAAE,aAAa,CAAA;CACrB;AAoDD;;;GAGG;AACH,eAAO,MAAM,mBAAmB,GAAI,OAAO,eAAe,KAAG,wBA+B5D,CAAA;AA+BD;;GAEG;AACH,eAAO,MAAM,kBAAkB,GAC7B,OAAO,WAAW,CAAC,UAAU,EAC7B,WAAW,MAAM,KAChB,wBAKF,CAAA;AAgCD;;;GAGG;AACH,eAAO,MAAM,aAAa,GAAI,CAAC,EAC7B,OAAO,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,EACrB,WAAW,MAAM,KAChB,wBAmDF,CAAA;AAID;;GAEG;AACH,eAAO,MAAM,qBAAqB,GAAI,CAAC,EAAE,QAAQ,CAAC,KAAG,eAEnD,CAAA;AAIF;;GAEG;AACH,eAAO,MAAM,sBAAsB,GAAI,UAAU,MAAM,KAAG,wBACoB,CAAA;AAI9E;;;GAGG;AACH,eAAO,MAAM,aAAa,GAAI,UAAU,wBAAwB,GAAG,eAAe,KAAG,eAMpF,CAAA"}
|
|
@@ -1,195 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Error mapping from Effect errors to MCP protocol error responses.
|
|
3
|
-
*
|
|
4
|
-
* Maps domain errors to appropriate MCP error codes:
|
|
5
|
-
* - -32602 (Invalid params): ParseError, IssueNotFoundError, ProjectNotFoundError, etc.
|
|
6
|
-
* - -32603 (Internal error): HulyConnectionError, HulyAuthError, unknown errors
|
|
7
|
-
*
|
|
8
|
-
* Security: Sanitizes error messages to prevent leaking sensitive information.
|
|
9
|
-
*
|
|
10
|
-
* @module
|
|
11
|
-
*/
|
|
12
|
-
import { Cause, Chunk, Match, ParseResult } from "effect";
|
|
13
|
-
import { McpErrorCode, } from "../huly/errors.js";
|
|
14
|
-
// --- Error Message Sanitization ---
|
|
15
|
-
/**
|
|
16
|
-
* Patterns that indicate sensitive information that should not be leaked.
|
|
17
|
-
* Uses regex for more precise matching (word boundaries where appropriate).
|
|
18
|
-
*/
|
|
19
|
-
const SENSITIVE_PATTERNS = [
|
|
20
|
-
/password/i,
|
|
21
|
-
/\btoken\b/i, // word boundary to avoid "tokenize" etc
|
|
22
|
-
/secret/i, // matches client_secret, secret_key, etc
|
|
23
|
-
/credential/i,
|
|
24
|
-
/api[_-]?key/i,
|
|
25
|
-
/\bauth\b/i, // word boundary to avoid "authentication" etc
|
|
26
|
-
/\bbearer\b/i,
|
|
27
|
-
/\bjwt\b/i,
|
|
28
|
-
/session[_-]?id/i, // session_id or sessionid
|
|
29
|
-
/cookie/i,
|
|
30
|
-
];
|
|
31
|
-
/**
|
|
32
|
-
* Check if a message contains potentially sensitive information.
|
|
33
|
-
*/
|
|
34
|
-
const containsSensitiveInfo = (message) => {
|
|
35
|
-
return SENSITIVE_PATTERNS.some((pattern) => pattern.test(message));
|
|
36
|
-
};
|
|
37
|
-
/**
|
|
38
|
-
* Sanitize error message to prevent leaking sensitive information.
|
|
39
|
-
* Replaces messages with sensitive keywords with a generic message.
|
|
40
|
-
*/
|
|
41
|
-
const sanitizeMessage = (message) => {
|
|
42
|
-
if (containsSensitiveInfo(message)) {
|
|
43
|
-
return "An error occurred while processing the request";
|
|
44
|
-
}
|
|
45
|
-
return message;
|
|
46
|
-
};
|
|
47
|
-
// --- Internal Helper to Create Error Response ---
|
|
48
|
-
const createErrorResponse = (text, errorCode) => ({
|
|
49
|
-
content: [{ type: "text", text }],
|
|
50
|
-
isError: true,
|
|
51
|
-
_meta: { errorCode },
|
|
52
|
-
});
|
|
53
|
-
// --- Domain Error Mapping ---
|
|
54
|
-
/**
|
|
55
|
-
* Map a HulyDomainError to an MCP error response.
|
|
56
|
-
* Uses pattern matching on tagged errors for type-safe handling.
|
|
57
|
-
*/
|
|
58
|
-
export const mapDomainErrorToMcp = (error) => {
|
|
59
|
-
return Match.value(error).pipe(Match.tag("IssueNotFoundError", (e) => createErrorResponse(e.message, McpErrorCode.InvalidParams)), Match.tag("ProjectNotFoundError", (e) => createErrorResponse(e.message, McpErrorCode.InvalidParams)), Match.tag("InvalidStatusError", (e) => createErrorResponse(e.message, McpErrorCode.InvalidParams)), Match.tag("PersonNotFoundError", (e) => createErrorResponse(e.message, McpErrorCode.InvalidParams)), Match.tag("HulyConnectionError", (e) => createErrorResponse(sanitizeMessage(`Connection error: ${e.message}`), McpErrorCode.InternalError)), Match.tag("HulyAuthError", (e) => createErrorResponse(sanitizeMessage(`Authentication error: ${e.message}`), McpErrorCode.InternalError)), Match.tag("HulyError", (e) => createErrorResponse(sanitizeMessage(e.message), McpErrorCode.InternalError)), Match.exhaustive);
|
|
60
|
-
};
|
|
61
|
-
// --- Parse Error Mapping ---
|
|
62
|
-
/**
|
|
63
|
-
* Format a ParseError to a user-friendly message.
|
|
64
|
-
* Extracts the most relevant information without exposing internal structure.
|
|
65
|
-
*/
|
|
66
|
-
const formatParseError = (error) => {
|
|
67
|
-
const issue = error.issue;
|
|
68
|
-
// Handle ArrayFormatter-like output for clearer messages
|
|
69
|
-
if ("_tag" in issue) {
|
|
70
|
-
switch (issue._tag) {
|
|
71
|
-
case "Missing":
|
|
72
|
-
return "Required field is missing";
|
|
73
|
-
case "Unexpected":
|
|
74
|
-
return "Unexpected field provided";
|
|
75
|
-
case "Type":
|
|
76
|
-
return `Invalid type: expected ${String(issue.ast)}`;
|
|
77
|
-
case "Forbidden":
|
|
78
|
-
return "Field is forbidden";
|
|
79
|
-
default:
|
|
80
|
-
// For complex issues, provide a general message
|
|
81
|
-
return "Invalid parameters provided";
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
return "Invalid parameters provided";
|
|
85
|
-
};
|
|
86
|
-
/**
|
|
87
|
-
* Map a ParseError to an MCP error response.
|
|
88
|
-
*/
|
|
89
|
-
export const mapParseErrorToMcp = (error, toolName) => {
|
|
90
|
-
const prefix = toolName ? `Invalid parameters for ${toolName}: ` : "Invalid parameters: ";
|
|
91
|
-
const message = formatParseError(error);
|
|
92
|
-
return createErrorResponse(`${prefix}${message}`, McpErrorCode.InvalidParams);
|
|
93
|
-
};
|
|
94
|
-
// --- Cause Mapping ---
|
|
95
|
-
/**
|
|
96
|
-
* Check if an error is a HulyDomainError.
|
|
97
|
-
*/
|
|
98
|
-
const isHulyDomainError = (error) => {
|
|
99
|
-
if (!error || typeof error !== "object")
|
|
100
|
-
return false;
|
|
101
|
-
if (!("_tag" in error))
|
|
102
|
-
return false;
|
|
103
|
-
const tag = error._tag;
|
|
104
|
-
return [
|
|
105
|
-
"HulyError",
|
|
106
|
-
"HulyConnectionError",
|
|
107
|
-
"HulyAuthError",
|
|
108
|
-
"IssueNotFoundError",
|
|
109
|
-
"ProjectNotFoundError",
|
|
110
|
-
"InvalidStatusError",
|
|
111
|
-
"PersonNotFoundError",
|
|
112
|
-
].includes(tag);
|
|
113
|
-
};
|
|
114
|
-
/**
|
|
115
|
-
* Check if an error is a ParseError.
|
|
116
|
-
*/
|
|
117
|
-
const isParseError = (error) => {
|
|
118
|
-
if (!error || typeof error !== "object")
|
|
119
|
-
return false;
|
|
120
|
-
if (!("_tag" in error))
|
|
121
|
-
return false;
|
|
122
|
-
return error._tag === "ParseError";
|
|
123
|
-
};
|
|
124
|
-
/**
|
|
125
|
-
* Map an Effect Cause to an MCP error response.
|
|
126
|
-
* Handles Fail, Die, and Interrupt causes appropriately.
|
|
127
|
-
*/
|
|
128
|
-
export const mapCauseToMcp = (cause, toolName) => {
|
|
129
|
-
// Handle Fail cause (expected errors)
|
|
130
|
-
if (Cause.isFailType(cause)) {
|
|
131
|
-
const error = cause.error;
|
|
132
|
-
// Check for ParseError
|
|
133
|
-
if (isParseError(error)) {
|
|
134
|
-
return mapParseErrorToMcp(error, toolName);
|
|
135
|
-
}
|
|
136
|
-
// Check for HulyDomainError
|
|
137
|
-
if (isHulyDomainError(error)) {
|
|
138
|
-
return mapDomainErrorToMcp(error);
|
|
139
|
-
}
|
|
140
|
-
// Unknown error type - provide sanitized message
|
|
141
|
-
const message = error && typeof error === "object" && "message" in error
|
|
142
|
-
? sanitizeMessage(String(error.message))
|
|
143
|
-
: "An unexpected error occurred";
|
|
144
|
-
return createErrorResponse(message, McpErrorCode.InternalError);
|
|
145
|
-
}
|
|
146
|
-
// Handle Die cause (defects/unexpected errors)
|
|
147
|
-
if (Cause.isDieType(cause)) {
|
|
148
|
-
// Never expose defect details - could contain sensitive stack traces
|
|
149
|
-
return createErrorResponse("Internal server error", McpErrorCode.InternalError);
|
|
150
|
-
}
|
|
151
|
-
// Handle Interrupt cause
|
|
152
|
-
if (Cause.isInterruptType(cause)) {
|
|
153
|
-
return createErrorResponse("Operation was interrupted", McpErrorCode.InternalError);
|
|
154
|
-
}
|
|
155
|
-
// Handle composite causes (Sequential, Parallel)
|
|
156
|
-
// Extract the first meaningful error
|
|
157
|
-
const failuresChunk = Cause.failures(cause);
|
|
158
|
-
const failures = Chunk.toArray(failuresChunk);
|
|
159
|
-
if (failures.length > 0) {
|
|
160
|
-
const firstError = failures[0];
|
|
161
|
-
if (isParseError(firstError)) {
|
|
162
|
-
return mapParseErrorToMcp(firstError, toolName);
|
|
163
|
-
}
|
|
164
|
-
if (isHulyDomainError(firstError)) {
|
|
165
|
-
return mapDomainErrorToMcp(firstError);
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
// Fallback for any other cause types
|
|
169
|
-
return createErrorResponse("An unexpected error occurred", McpErrorCode.InternalError);
|
|
170
|
-
};
|
|
171
|
-
// --- Success Response Builder ---
|
|
172
|
-
/**
|
|
173
|
-
* Create an MCP success response from a result value.
|
|
174
|
-
*/
|
|
175
|
-
export const createSuccessResponse = (result) => ({
|
|
176
|
-
content: [{ type: "text", text: JSON.stringify(result, null, 2) }],
|
|
177
|
-
});
|
|
178
|
-
// --- Unknown Tool Error ---
|
|
179
|
-
/**
|
|
180
|
-
* Create an MCP error response for an unknown tool.
|
|
181
|
-
*/
|
|
182
|
-
export const createUnknownToolError = (toolName) => createErrorResponse(`Unknown tool: ${toolName}`, McpErrorCode.InvalidParams);
|
|
183
|
-
// --- Convert to MCP SDK format ---
|
|
184
|
-
/**
|
|
185
|
-
* Strip internal metadata for MCP SDK compatibility.
|
|
186
|
-
* Converts internal response to MCP-compatible format.
|
|
187
|
-
*/
|
|
188
|
-
export const toMcpResponse = (response) => {
|
|
189
|
-
const result = { content: response.content };
|
|
190
|
-
if (response.isError !== undefined) {
|
|
191
|
-
result.isError = response.isError;
|
|
192
|
-
}
|
|
193
|
-
return result;
|
|
194
|
-
};
|
|
195
|
-
//# sourceMappingURL=error-mapping.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"error-mapping.js","sourceRoot":"","sources":["../../../src/mcp/error-mapping.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAA;AACzD,OAAO,EACL,YAAY,GAEb,MAAM,mBAAmB,CAAA;AA8B1B,qCAAqC;AAErC;;;GAGG;AACH,MAAM,kBAAkB,GAAG;IACzB,WAAW;IACX,YAAY,EAAO,wCAAwC;IAC3D,SAAS,EAAU,yCAAyC;IAC5D,aAAa;IACb,cAAc;IACd,WAAW,EAAQ,8CAA8C;IACjE,aAAa;IACb,UAAU;IACV,iBAAiB,EAAE,0BAA0B;IAC7C,SAAS;CACD,CAAA;AAEV;;GAEG;AACH,MAAM,qBAAqB,GAAG,CAAC,OAAe,EAAW,EAAE;IACzD,OAAO,kBAAkB,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAA;AACpE,CAAC,CAAA;AAED;;;GAGG;AACH,MAAM,eAAe,GAAG,CAAC,OAAe,EAAU,EAAE;IAClD,IAAI,qBAAqB,CAAC,OAAO,CAAC,EAAE,CAAC;QACnC,OAAO,gDAAgD,CAAA;IACzD,CAAC;IACD,OAAO,OAAO,CAAA;AAChB,CAAC,CAAA;AAED,mDAAmD;AAEnD,MAAM,mBAAmB,GAAG,CAC1B,IAAY,EACZ,SAAuB,EACG,EAAE,CAAC,CAAC;IAC9B,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAe,EAAE,IAAI,EAAE,CAAC;IAC1C,OAAO,EAAE,IAAI;IACb,KAAK,EAAE,EAAE,SAAS,EAAE;CACrB,CAAC,CAAA;AAEF,+BAA+B;AAE/B;;;GAGG;AACH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,GAAG,CAAC,QAAgB,EAA4B,EAAE,CACnF,mBAAmB,CAAC,iBAAiB,QAAQ,EAAE,EAAE,YAAY,CAAC,aAAa,CAAC,CAAA;AAE9E,oCAAoC;AAEpC;;;GAGG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,QAAoD,EAAmB,EAAE;IACrG,MAAM,MAAM,GAAoB,EAAE,OAAO,EAAE,QAAQ,CAAC,OAAO,EAAE,CAAA;IAC7D,IAAI,QAAQ,CAAC,OAAO,KAAK,SAAS,EAAE,CAAC;QACnC,MAAM,CAAC,OAAO,GAAG,QAAQ,CAAC,OAAO,CAAA;IACnC,CAAC;IACD,OAAO,MAAM,CAAA;AACf,CAAC,CAAA"}
|
package/dist/src/mcp/server.d.ts
DELETED
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
import { Context, Effect, Layer, Schema } from "effect";
|
|
2
|
-
import { HulyClient } from "../huly/client.js";
|
|
3
|
-
/**
|
|
4
|
-
* Transport type for MCP server.
|
|
5
|
-
*/
|
|
6
|
-
export type McpTransportType = "stdio" | "http";
|
|
7
|
-
/**
|
|
8
|
-
* Configuration for MCP server.
|
|
9
|
-
*/
|
|
10
|
-
export interface McpServerConfig {
|
|
11
|
-
readonly transport: McpTransportType;
|
|
12
|
-
readonly httpPort?: number;
|
|
13
|
-
}
|
|
14
|
-
declare const McpServerError_base: Schema.TaggedErrorClass<McpServerError, "McpServerError", {
|
|
15
|
-
readonly _tag: Schema.tag<"McpServerError">;
|
|
16
|
-
} & {
|
|
17
|
-
message: typeof Schema.String;
|
|
18
|
-
cause: Schema.optional<typeof Schema.Defect>;
|
|
19
|
-
}>;
|
|
20
|
-
/**
|
|
21
|
-
* MCP server error.
|
|
22
|
-
*/
|
|
23
|
-
export declare class McpServerError extends McpServerError_base {
|
|
24
|
-
}
|
|
25
|
-
/**
|
|
26
|
-
* Tool definitions for MCP.
|
|
27
|
-
* Maps tool names to their descriptions and JSON schemas.
|
|
28
|
-
*/
|
|
29
|
-
export declare const TOOL_DEFINITIONS: {
|
|
30
|
-
readonly list_issues: {
|
|
31
|
-
readonly name: "list_issues";
|
|
32
|
-
readonly description: "Query Huly issues with optional filters. Returns issues sorted by modification date (newest first). Supports filtering by project, status, assignee, and milestone.";
|
|
33
|
-
readonly inputSchema: import("effect/JSONSchema").JsonSchema7Root;
|
|
34
|
-
};
|
|
35
|
-
readonly get_issue: {
|
|
36
|
-
readonly name: "get_issue";
|
|
37
|
-
readonly description: "Retrieve full details for a Huly issue including markdown description. Use this to view issue content, comments, or full metadata.";
|
|
38
|
-
readonly inputSchema: import("effect/JSONSchema").JsonSchema7Root;
|
|
39
|
-
};
|
|
40
|
-
readonly create_issue: {
|
|
41
|
-
readonly name: "create_issue";
|
|
42
|
-
readonly description: "Create a new issue in a Huly project. Description supports markdown formatting. Returns the created issue identifier.";
|
|
43
|
-
readonly inputSchema: import("effect/JSONSchema").JsonSchema7Root;
|
|
44
|
-
};
|
|
45
|
-
readonly update_issue: {
|
|
46
|
-
readonly name: "update_issue";
|
|
47
|
-
readonly description: "Update fields on an existing Huly issue. Only provided fields are modified. Description updates support markdown.";
|
|
48
|
-
readonly inputSchema: import("effect/JSONSchema").JsonSchema7Root;
|
|
49
|
-
};
|
|
50
|
-
readonly add_issue_label: {
|
|
51
|
-
readonly name: "add_issue_label";
|
|
52
|
-
readonly description: "Add a tag/label to a Huly issue. Creates the tag if it doesn't exist in the project.";
|
|
53
|
-
readonly inputSchema: import("effect/JSONSchema").JsonSchema7Root;
|
|
54
|
-
};
|
|
55
|
-
};
|
|
56
|
-
/**
|
|
57
|
-
* MCP Server service interface.
|
|
58
|
-
*/
|
|
59
|
-
export interface McpServerOperations {
|
|
60
|
-
/**
|
|
61
|
-
* Start the MCP server and connect to transport.
|
|
62
|
-
* Returns an Effect that completes when the server is stopped.
|
|
63
|
-
*/
|
|
64
|
-
readonly run: () => Effect.Effect<void, McpServerError>;
|
|
65
|
-
/**
|
|
66
|
-
* Stop the MCP server gracefully.
|
|
67
|
-
*/
|
|
68
|
-
readonly stop: () => Effect.Effect<void, McpServerError>;
|
|
69
|
-
}
|
|
70
|
-
declare const McpServerService_base: Context.TagClass<McpServerService, "@hulymcp/McpServer", McpServerOperations>;
|
|
71
|
-
/**
|
|
72
|
-
* MCP Server service tag.
|
|
73
|
-
*/
|
|
74
|
-
export declare class McpServerService extends McpServerService_base {
|
|
75
|
-
/**
|
|
76
|
-
* Create the MCP server layer.
|
|
77
|
-
* Requires HulyClient to be available.
|
|
78
|
-
*/
|
|
79
|
-
static layer(config: McpServerConfig): Layer.Layer<McpServerService, never, HulyClient>;
|
|
80
|
-
/**
|
|
81
|
-
* Create a test layer for unit testing.
|
|
82
|
-
*/
|
|
83
|
-
static testLayer(mockOperations: Partial<McpServerOperations>): Layer.Layer<McpServerService>;
|
|
84
|
-
}
|
|
85
|
-
export {};
|
|
86
|
-
//# sourceMappingURL=server.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../../src/mcp/server.ts"],"names":[],"mappings":"AAiBA,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAqB,MAAM,QAAQ,CAAA;AAC1E,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAA;AA+B9C;;GAEG;AACH,MAAM,MAAM,gBAAgB,GAAG,OAAO,GAAG,MAAM,CAAA;AAE/C;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,SAAS,EAAE,gBAAgB,CAAA;IACpC,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;CAC3B;;;;;;;AAED;;GAEG;AACH,qBAAa,cAAe,SAAQ,mBAMnC;CAAG;AAIJ;;;GAGG;AACH,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;CA+BnB,CAAA;AAMV;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC;;;OAGG;IACH,QAAQ,CA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