@likec4/mcp 1.38.0 → 1.39.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/.turbo/turbo-build.log +134 -119
- package/README.md +38 -0
- package/build.config.ts +3 -2
- package/dist/index.mjs +294 -261
- package/package.json +16 -10
- package/src/index.ts +79 -20
- package/tsconfig.json +6 -2
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@likec4/mcp",
|
|
3
3
|
"description": "Model Context Protocol server for LikeC4",
|
|
4
4
|
"license": "MIT",
|
|
5
|
-
"version": "1.
|
|
5
|
+
"version": "1.39.0",
|
|
6
6
|
"bugs": "https://github.com/likec4/likec4/issues",
|
|
7
7
|
"homepage": "https://likec4.dev",
|
|
8
8
|
"author": "Denis Davydkov <denis@davydkov.com>",
|
|
@@ -45,23 +45,29 @@
|
|
|
45
45
|
}
|
|
46
46
|
}
|
|
47
47
|
},
|
|
48
|
-
"dependencies": {
|
|
48
|
+
"dependencies": {
|
|
49
|
+
"@hpcc-js/wasm-graphviz": "1.12.0",
|
|
50
|
+
"bundle-n-require": "^1.1.2",
|
|
51
|
+
"esbuild": "0.25.9",
|
|
52
|
+
"std-env": "^3.9.0"
|
|
53
|
+
},
|
|
49
54
|
"devDependencies": {
|
|
50
|
-
"@modelcontextprotocol/sdk": "^1.17.
|
|
51
|
-
"@types/node": "~20.19.
|
|
55
|
+
"@modelcontextprotocol/sdk": "^1.17.4",
|
|
56
|
+
"@types/node": "~20.19.11",
|
|
57
|
+
"citty": "^0.1.6",
|
|
52
58
|
"remeda": "^2.23.1",
|
|
53
59
|
"tsx": "4.20.3",
|
|
54
|
-
"turbo": "2.5.
|
|
60
|
+
"turbo": "2.5.6",
|
|
55
61
|
"typescript": "5.9.2",
|
|
56
62
|
"unbuild": "3.5.0",
|
|
57
63
|
"vitest": "3.2.4",
|
|
58
64
|
"vscode-uri": "3.1.0",
|
|
59
|
-
"zod": "3.25.67",
|
|
60
65
|
"wireit": "0.14.12",
|
|
61
|
-
"
|
|
62
|
-
"@likec4/core": "1.
|
|
63
|
-
"@likec4/
|
|
64
|
-
"@likec4/
|
|
66
|
+
"zod": "3.25.76",
|
|
67
|
+
"@likec4/core": "1.39.0",
|
|
68
|
+
"@likec4/language-server": "1.39.0",
|
|
69
|
+
"@likec4/log": "1.39.0",
|
|
70
|
+
"@likec4/tsconfig": "1.39.0"
|
|
65
71
|
},
|
|
66
72
|
"scripts": {
|
|
67
73
|
"typecheck": "tsc -b --verbose",
|
package/src/index.ts
CHANGED
|
@@ -3,38 +3,97 @@
|
|
|
3
3
|
import { createLanguageServices, LikeC4FileSystem, WithMCPServer } from '@likec4/language-server'
|
|
4
4
|
import {
|
|
5
5
|
configureLogger,
|
|
6
|
+
getAnsiColorFormatter,
|
|
6
7
|
getConsoleStderrSink,
|
|
7
8
|
logger,
|
|
8
9
|
} from '@likec4/log'
|
|
10
|
+
import { defineCommand, runMain } from 'citty'
|
|
9
11
|
import { resolve } from 'node:path'
|
|
12
|
+
import { isColorSupported } from 'std-env'
|
|
10
13
|
import { URI } from 'vscode-uri'
|
|
11
14
|
|
|
12
|
-
const
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
// Name it as console to override internal logger
|
|
17
|
-
console: getConsoleStderrSink(),
|
|
15
|
+
const main = defineCommand({
|
|
16
|
+
meta: {
|
|
17
|
+
name: 'likec4-mcp-server',
|
|
18
|
+
description: 'LikeC4 MCP server',
|
|
18
19
|
},
|
|
19
|
-
|
|
20
|
+
args: {
|
|
21
|
+
stdio: {
|
|
22
|
+
type: 'boolean',
|
|
23
|
+
description: 'use stdio transport (this is default)',
|
|
24
|
+
required: false,
|
|
25
|
+
},
|
|
26
|
+
http: {
|
|
27
|
+
type: 'boolean',
|
|
28
|
+
description: 'use streamable http transport',
|
|
29
|
+
required: false,
|
|
30
|
+
},
|
|
31
|
+
port: {
|
|
32
|
+
type: 'string',
|
|
33
|
+
description: 'change http port (default: 33335)',
|
|
34
|
+
valueHint: 'number',
|
|
35
|
+
required: false,
|
|
36
|
+
},
|
|
37
|
+
watch: {
|
|
38
|
+
type: 'boolean',
|
|
39
|
+
description: 'disable watch for changes (consume less resources if you have static workspace)',
|
|
40
|
+
default: true,
|
|
41
|
+
required: false,
|
|
42
|
+
},
|
|
43
|
+
workspace: {
|
|
44
|
+
type: 'positional',
|
|
45
|
+
description: 'change workspace, defaults to current directory, can be set by LIKEC4_WORKSPACE env',
|
|
46
|
+
valueHint: 'directory',
|
|
47
|
+
required: false,
|
|
48
|
+
default: process.env['LIKEC4_WORKSPACE'] || '.',
|
|
49
|
+
},
|
|
50
|
+
},
|
|
51
|
+
setup({ args }) {
|
|
52
|
+
if (args.stdio && (args.http || args.port)) {
|
|
53
|
+
throw new Error('stdio and http are mutually exclusive')
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
async run({ args }) {
|
|
57
|
+
const useStdio = args.stdio || (!args.http && !args.port)
|
|
58
|
+
|
|
59
|
+
configureLogger({
|
|
60
|
+
sinks: {
|
|
61
|
+
console: getConsoleStderrSink(
|
|
62
|
+
isColorSupported && !useStdio ? { formatter: getAnsiColorFormatter() } : undefined,
|
|
63
|
+
),
|
|
64
|
+
},
|
|
65
|
+
})
|
|
66
|
+
process.on('uncaughtException', (err) => {
|
|
67
|
+
logger.error('uncaughtException', { err })
|
|
68
|
+
})
|
|
20
69
|
|
|
21
|
-
|
|
22
|
-
|
|
70
|
+
process.on('unhandledRejection', (err) => {
|
|
71
|
+
logger.error('unhandledRejection', { err })
|
|
72
|
+
})
|
|
23
73
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
})
|
|
74
|
+
const port = args.port ? parseInt(args.port) : 33335
|
|
75
|
+
const workspace = resolve(args.workspace || '.')
|
|
76
|
+
logger.info`Loading LikeC4 from workspace: ${workspace}`
|
|
28
77
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
}])
|
|
78
|
+
if (args.watch) {
|
|
79
|
+
logger.warn`watch for changes enabled, use ${'--no-watch'} to consume less resources`
|
|
80
|
+
}
|
|
33
81
|
|
|
34
|
-
|
|
35
|
-
|
|
82
|
+
const langium = await createLanguageServices({
|
|
83
|
+
...LikeC4FileSystem(args.watch),
|
|
84
|
+
...WithMCPServer(useStdio ? 'stdio' : { port }),
|
|
85
|
+
})
|
|
86
|
+
|
|
87
|
+
await langium.shared.workspace.WorkspaceManager.initializeWorkspace([{
|
|
88
|
+
uri: URI.file(workspace).toString(),
|
|
89
|
+
name: 'workspace',
|
|
90
|
+
}])
|
|
91
|
+
|
|
92
|
+
await langium.likec4.mcp.Server.start()
|
|
93
|
+
},
|
|
94
|
+
})
|
|
36
95
|
|
|
37
|
-
main
|
|
96
|
+
runMain(main).catch(err => {
|
|
38
97
|
logger.error(err)
|
|
39
98
|
process.exit(1)
|
|
40
99
|
})
|
package/tsconfig.json
CHANGED
|
@@ -1,13 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"extends": "@likec4/tsconfig/base.json",
|
|
3
3
|
"compilerOptions": {
|
|
4
|
-
"
|
|
4
|
+
"rootDirs": [
|
|
5
|
+
"src",
|
|
6
|
+
"."
|
|
7
|
+
],
|
|
5
8
|
"types": [
|
|
6
9
|
"node"
|
|
7
10
|
]
|
|
8
11
|
},
|
|
9
12
|
"include": [
|
|
10
|
-
"src"
|
|
13
|
+
"src",
|
|
14
|
+
"build.config.ts"
|
|
11
15
|
],
|
|
12
16
|
"references": [
|
|
13
17
|
{
|