@kernlang/mcp-server 3.1.6 → 3.1.8
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 +324 -0
- package/dist/__tests__/server.integration.test.d.ts +1 -0
- package/dist/__tests__/server.integration.test.js +150 -0
- package/dist/__tests__/server.integration.test.js.map +1 -0
- package/dist/index.d.ts +4 -7
- package/dist/index.js +995 -135
- package/dist/index.js.map +1 -1
- package/package.json +37 -14
package/README.md
ADDED
|
@@ -0,0 +1,324 @@
|
|
|
1
|
+
# @kernlang/mcp-server
|
|
2
|
+
|
|
3
|
+
MCP server for KERN -- the LLM-native language that compiles to 12 targets. Give any AI agent the ability to write, compile, review, and self-correct `.kern` code.
|
|
4
|
+
|
|
5
|
+
```
|
|
6
|
+
npx @kernlang/mcp-server
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
## What is this?
|
|
10
|
+
|
|
11
|
+
KERN is a declarative DSL designed specifically for AI code generation. This MCP server exposes KERN's full compiler, reviewer, and schema to any MCP-compatible client (Claude Desktop, Cursor, Windsurf, VS Code, etc.).
|
|
12
|
+
|
|
13
|
+
An AI agent using this server can:
|
|
14
|
+
1. **Ask what it can write** -- `schema` tool returns the full language spec as JSON
|
|
15
|
+
2. **Compile .kern to any target** -- Next.js, React, Vue, Express, FastAPI, MCP servers, and more
|
|
16
|
+
3. **Self-correct from errors** -- `compile-json` returns structured diagnostics with line numbers and suggestions
|
|
17
|
+
4. **Review code** -- 76+ static analysis rules with taint tracking and OWASP coverage
|
|
18
|
+
|
|
19
|
+
## Quick start
|
|
20
|
+
|
|
21
|
+
### Claude Desktop
|
|
22
|
+
|
|
23
|
+
Add to `~/Library/Application Support/Claude/claude_desktop_config.json`:
|
|
24
|
+
|
|
25
|
+
```json
|
|
26
|
+
{
|
|
27
|
+
"mcpServers": {
|
|
28
|
+
"kern": {
|
|
29
|
+
"command": "npx",
|
|
30
|
+
"args": ["@kernlang/mcp-server"]
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
### Cursor
|
|
37
|
+
|
|
38
|
+
Add to `.cursor/mcp.json` in your project:
|
|
39
|
+
|
|
40
|
+
```json
|
|
41
|
+
{
|
|
42
|
+
"mcpServers": {
|
|
43
|
+
"kern": {
|
|
44
|
+
"command": "npx",
|
|
45
|
+
"args": ["@kernlang/mcp-server"]
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
### Claude Code
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
claude mcp add kern -- npx @kernlang/mcp-server
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
### Windsurf / VS Code
|
|
58
|
+
|
|
59
|
+
Add to your MCP settings:
|
|
60
|
+
|
|
61
|
+
```json
|
|
62
|
+
{
|
|
63
|
+
"kern": {
|
|
64
|
+
"command": "npx",
|
|
65
|
+
"args": ["@kernlang/mcp-server"]
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
## Tools
|
|
71
|
+
|
|
72
|
+
### compile
|
|
73
|
+
|
|
74
|
+
Compile `.kern` source to any target framework. Returns generated code.
|
|
75
|
+
|
|
76
|
+
```
|
|
77
|
+
source: ".kern source code"
|
|
78
|
+
target: "nextjs" | "react" | "vue" | "express" | "fastapi" | "mcp" | ...
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
### compile-json
|
|
82
|
+
|
|
83
|
+
Compile with structured JSON diagnostics for programmatic self-correction. Returns `{ success, code, diagnostics, stats }`.
|
|
84
|
+
|
|
85
|
+
Each diagnostic includes `code`, `severity`, `line`, `col`, `endCol`, and `suggestion` -- everything an LLM needs to fix its own mistakes.
|
|
86
|
+
|
|
87
|
+
### schema
|
|
88
|
+
|
|
89
|
+
Returns the full KERN language schema as JSON: all node types, their props (with required/optional and types), allowed children, style shorthands, and multiline block types.
|
|
90
|
+
|
|
91
|
+
Use this before writing `.kern` code to know exactly what's valid.
|
|
92
|
+
|
|
93
|
+
### review
|
|
94
|
+
|
|
95
|
+
Run static analysis (76+ rules, taint tracking, OWASP) on TypeScript/JavaScript source code.
|
|
96
|
+
|
|
97
|
+
### review-kern
|
|
98
|
+
|
|
99
|
+
Lint `.kern` source for structural issues, missing props, and pattern violations.
|
|
100
|
+
|
|
101
|
+
### review-mcp-server
|
|
102
|
+
|
|
103
|
+
Scan MCP server code for security vulnerabilities. 13 rules mapped to OWASP MCP Top 10.
|
|
104
|
+
|
|
105
|
+
### parse
|
|
106
|
+
|
|
107
|
+
Parse `.kern` source and return the intermediate representation (IR). Useful for debugging.
|
|
108
|
+
|
|
109
|
+
### decompile
|
|
110
|
+
|
|
111
|
+
Convert parsed IR back to human-readable `.kern` text.
|
|
112
|
+
|
|
113
|
+
### validate
|
|
114
|
+
|
|
115
|
+
Validate `.kern` syntax without compiling. Returns parse errors or success.
|
|
116
|
+
|
|
117
|
+
### list-targets
|
|
118
|
+
|
|
119
|
+
List all 12 available compile targets with descriptions.
|
|
120
|
+
|
|
121
|
+
### list-nodes
|
|
122
|
+
|
|
123
|
+
Browse KERN node types by category (layout, backend, state, types, mcp, etc.) with their props and allowed children.
|
|
124
|
+
|
|
125
|
+
## Resources
|
|
126
|
+
|
|
127
|
+
| Resource | URI | Description |
|
|
128
|
+
|----------|-----|-------------|
|
|
129
|
+
| kern-spec | `kern://spec` | Full language specification |
|
|
130
|
+
| kern-examples | `kern://examples/{category}` | Example code by category (ui, api, state-machine, mcp, terminal) |
|
|
131
|
+
| kern-targets | `kern://targets` | Available compile targets as JSON |
|
|
132
|
+
|
|
133
|
+
## Prompts
|
|
134
|
+
|
|
135
|
+
### write-kern
|
|
136
|
+
|
|
137
|
+
Comprehensive system prompt that teaches an LLM how to write `.kern` code -- grammar rules, node types, style shorthands, and annotated examples for UI, API, state machines, MCP servers, hooks, and type systems.
|
|
138
|
+
|
|
139
|
+
## LLM self-correction loop
|
|
140
|
+
|
|
141
|
+
The `schema` and `compile-json` tools enable a closed-loop workflow:
|
|
142
|
+
|
|
143
|
+
```
|
|
144
|
+
1. schema --> "what can I write?"
|
|
145
|
+
2. write .kern --> generate code using schema
|
|
146
|
+
3. compile-json --> "did I get it right?"
|
|
147
|
+
4. if errors:
|
|
148
|
+
read diagnostics (line, col, suggestion)
|
|
149
|
+
fix and goto 3
|
|
150
|
+
5. done
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
No human intervention needed. The LLM can iterate to correct code autonomously.
|
|
154
|
+
|
|
155
|
+
## KERN syntax at a glance
|
|
156
|
+
|
|
157
|
+
```kern
|
|
158
|
+
// Comments work with // or #
|
|
159
|
+
|
|
160
|
+
doc text="User management API"
|
|
161
|
+
server name=UserAPI port=3001
|
|
162
|
+
middleware name=cors
|
|
163
|
+
middleware name=json
|
|
164
|
+
|
|
165
|
+
route GET /api/users
|
|
166
|
+
auth required
|
|
167
|
+
handler <<<
|
|
168
|
+
const users = await db.query('SELECT * FROM users');
|
|
169
|
+
res.json(users);
|
|
170
|
+
>>>
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
```kern
|
|
174
|
+
// State machine -- 7 lines, 140+ lines TypeScript output
|
|
175
|
+
machine name=Order initial=pending
|
|
176
|
+
transition from=pending to=confirmed event=confirm
|
|
177
|
+
transition from=confirmed to=shipped event=ship
|
|
178
|
+
transition from=shipped to=delivered event=deliver
|
|
179
|
+
transition from=pending to=cancelled event=cancel
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
## Project structure
|
|
183
|
+
|
|
184
|
+
A typical KERN project looks like this:
|
|
185
|
+
|
|
186
|
+
```
|
|
187
|
+
my-project/
|
|
188
|
+
kern.config.ts # KERN configuration
|
|
189
|
+
src/
|
|
190
|
+
features/
|
|
191
|
+
auth.kern # .kern source files
|
|
192
|
+
dashboard.kern
|
|
193
|
+
generated/ # compiled output (--outdir)
|
|
194
|
+
auth.ts
|
|
195
|
+
dashboard.tsx
|
|
196
|
+
src/ # facade re-exports (--facades)
|
|
197
|
+
auth.ts # export * from '../generated/auth.js'
|
|
198
|
+
dashboard.ts
|
|
199
|
+
index.ts # barrel exports (auto-generated)
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
With `kern compile src/features --outdir=generated --facades`, you write `.kern` files and everything else is auto-generated.
|
|
203
|
+
|
|
204
|
+
## Configuration
|
|
205
|
+
|
|
206
|
+
Create `kern.config.ts` in your project root:
|
|
207
|
+
|
|
208
|
+
```ts
|
|
209
|
+
import type { KernConfig } from 'kern-lang';
|
|
210
|
+
|
|
211
|
+
const config: KernConfig = {
|
|
212
|
+
// Target framework
|
|
213
|
+
target: 'nextjs',
|
|
214
|
+
|
|
215
|
+
// Output directory for generated files
|
|
216
|
+
output: {
|
|
217
|
+
outDir: 'src/generated',
|
|
218
|
+
sourceMaps: true,
|
|
219
|
+
},
|
|
220
|
+
|
|
221
|
+
// i18n support
|
|
222
|
+
i18n: {
|
|
223
|
+
enabled: true,
|
|
224
|
+
hookName: 'useTranslation',
|
|
225
|
+
importPath: 'react-i18next',
|
|
226
|
+
},
|
|
227
|
+
|
|
228
|
+
// Component import mappings
|
|
229
|
+
components: {
|
|
230
|
+
uiLibrary: '@components/ui',
|
|
231
|
+
componentRoot: '@/components',
|
|
232
|
+
},
|
|
233
|
+
|
|
234
|
+
// Color palette (hex -> Tailwind class)
|
|
235
|
+
colors: {
|
|
236
|
+
'#09090b': 'zinc-950',
|
|
237
|
+
'#f97316': 'orange-500',
|
|
238
|
+
},
|
|
239
|
+
|
|
240
|
+
// Code review settings
|
|
241
|
+
review: {
|
|
242
|
+
showConfidence: true,
|
|
243
|
+
maxComplexity: 15,
|
|
244
|
+
},
|
|
245
|
+
};
|
|
246
|
+
|
|
247
|
+
export default config;
|
|
248
|
+
```
|
|
249
|
+
|
|
250
|
+
The config is auto-loaded by the CLI. All fields are optional -- sensible defaults are applied.
|
|
251
|
+
|
|
252
|
+
### Configuration options
|
|
253
|
+
|
|
254
|
+
| Key | Default | Description |
|
|
255
|
+
|-----|---------|-------------|
|
|
256
|
+
| `target` | `nextjs` | Compile target (auto-detected from package.json) |
|
|
257
|
+
| `structure` | `flat` | Output structure: `flat`, `bulletproof`, `atomic`, `kern` |
|
|
258
|
+
| `output.outDir` | `.` | Directory for generated files |
|
|
259
|
+
| `output.sourceMaps` | `false` | Generate `.map` files |
|
|
260
|
+
| `i18n.enabled` | `true` | Wrap strings in `t()` calls |
|
|
261
|
+
| `i18n.hookName` | `useTranslation` | i18n hook name |
|
|
262
|
+
| `components.uiLibrary` | `@components/ui` | UI component import path |
|
|
263
|
+
| `colors` | Zinc scale | Hex-to-Tailwind color mappings |
|
|
264
|
+
| `review.maxComplexity` | `15` | Max cognitive complexity |
|
|
265
|
+
| `review.disabledRules` | `[]` | Rule IDs to disable |
|
|
266
|
+
| `express.security` | `strict` | Express security level |
|
|
267
|
+
| `fastapi.cors` | `false` | Enable CORS for FastAPI |
|
|
268
|
+
|
|
269
|
+
## CLI commands
|
|
270
|
+
|
|
271
|
+
The KERN CLI (`kern-lang` npm package) provides these commands:
|
|
272
|
+
|
|
273
|
+
```bash
|
|
274
|
+
# Compile .kern files to TypeScript
|
|
275
|
+
kern compile src/ --outdir=generated --facades --barrel
|
|
276
|
+
|
|
277
|
+
# Compile with JSON diagnostics (for LLM self-correction)
|
|
278
|
+
kern compile src/ --outdir=generated --json
|
|
279
|
+
|
|
280
|
+
# Dump full language schema as JSON
|
|
281
|
+
kern schema
|
|
282
|
+
|
|
283
|
+
# Watch mode -- recompile on changes
|
|
284
|
+
kern dev src/
|
|
285
|
+
|
|
286
|
+
# Scan project and auto-detect target
|
|
287
|
+
kern scan
|
|
288
|
+
|
|
289
|
+
# LLM-powered code review
|
|
290
|
+
kern review src/
|
|
291
|
+
```
|
|
292
|
+
|
|
293
|
+
### Compile flags
|
|
294
|
+
|
|
295
|
+
| Flag | Description |
|
|
296
|
+
|------|-------------|
|
|
297
|
+
| `--outdir=DIR` | Output directory (default: `generated/`) |
|
|
298
|
+
| `--target=TARGET` | Override compile target |
|
|
299
|
+
| `--facades` | Auto-generate `src/*.ts` re-export facades |
|
|
300
|
+
| `--facades-dir=DIR` | Custom facades directory |
|
|
301
|
+
| `--barrel` | Generate barrel `index.ts` in output dir |
|
|
302
|
+
| `--strict-parse` | Fail on parse errors |
|
|
303
|
+
| `--json` | Output structured JSON diagnostics |
|
|
304
|
+
|
|
305
|
+
## Compile targets
|
|
306
|
+
|
|
307
|
+
| Target | Output |
|
|
308
|
+
|--------|--------|
|
|
309
|
+
| `nextjs` | Next.js App Router (TypeScript/React) |
|
|
310
|
+
| `tailwind` | React + Tailwind CSS |
|
|
311
|
+
| `web` | Plain React components |
|
|
312
|
+
| `vue` | Vue 3 SFC |
|
|
313
|
+
| `nuxt` | Nuxt 3 |
|
|
314
|
+
| `express` | Express TypeScript REST API |
|
|
315
|
+
| `fastapi` | FastAPI Python async backend |
|
|
316
|
+
| `native` | React Native (iOS/Android) |
|
|
317
|
+
| `cli` | Node.js CLI |
|
|
318
|
+
| `terminal` | Terminal UI (ANSI) |
|
|
319
|
+
| `ink` | Ink (React for terminals) |
|
|
320
|
+
| `mcp` | MCP server (Model Context Protocol) |
|
|
321
|
+
|
|
322
|
+
## License
|
|
323
|
+
|
|
324
|
+
AGPL-3.0
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
import { spawn } from 'child_process';
|
|
2
|
+
import { dirname, resolve } from 'path';
|
|
3
|
+
import { fileURLToPath } from 'url';
|
|
4
|
+
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
5
|
+
const SERVER_PATH = resolve(__dirname, '../../dist/index.js');
|
|
6
|
+
function sendMCP(messages) {
|
|
7
|
+
return new Promise((resolve, reject) => {
|
|
8
|
+
const cp = spawn('node', [SERVER_PATH], { stdio: ['pipe', 'pipe', 'pipe'] });
|
|
9
|
+
let stdout = '';
|
|
10
|
+
let stderr = '';
|
|
11
|
+
cp.stdout.on('data', (d) => {
|
|
12
|
+
stdout += d.toString();
|
|
13
|
+
});
|
|
14
|
+
cp.stderr.on('data', (d) => {
|
|
15
|
+
stderr += d.toString();
|
|
16
|
+
});
|
|
17
|
+
for (const msg of messages) {
|
|
18
|
+
cp.stdin.write(`${JSON.stringify(msg)}\n`);
|
|
19
|
+
}
|
|
20
|
+
setTimeout(() => {
|
|
21
|
+
cp.kill();
|
|
22
|
+
resolve({ stdout, stderr });
|
|
23
|
+
}, 3000);
|
|
24
|
+
cp.on('error', reject);
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
function rpc(method, params = {}, id = 1) {
|
|
28
|
+
return { jsonrpc: '2.0', method, params, id };
|
|
29
|
+
}
|
|
30
|
+
describe('KERN MCP Server Integration', () => {
|
|
31
|
+
it('should respond to initialize', async () => {
|
|
32
|
+
const { stdout } = await sendMCP([
|
|
33
|
+
rpc('initialize', {
|
|
34
|
+
protocolVersion: '2024-11-05',
|
|
35
|
+
capabilities: {},
|
|
36
|
+
clientInfo: { name: 'test', version: '1.0' },
|
|
37
|
+
}),
|
|
38
|
+
]);
|
|
39
|
+
const response = JSON.parse(stdout.split('\n')[0]);
|
|
40
|
+
expect(response.result.serverInfo.name).toBe('kern');
|
|
41
|
+
expect(response.result.serverInfo.version).toBe('3.0.0');
|
|
42
|
+
expect(response.result.capabilities.tools).toBeDefined();
|
|
43
|
+
expect(response.result.capabilities.resources).toBeDefined();
|
|
44
|
+
expect(response.result.capabilities.prompts).toBeDefined();
|
|
45
|
+
});
|
|
46
|
+
it('should list tools', async () => {
|
|
47
|
+
const { stdout } = await sendMCP([
|
|
48
|
+
rpc('initialize', {
|
|
49
|
+
protocolVersion: '2024-11-05',
|
|
50
|
+
capabilities: {},
|
|
51
|
+
clientInfo: { name: 'test', version: '1.0' },
|
|
52
|
+
}, 1),
|
|
53
|
+
{ jsonrpc: '2.0', method: 'notifications/initialized' },
|
|
54
|
+
rpc('tools/list', {}, 2),
|
|
55
|
+
]);
|
|
56
|
+
const lines = stdout.split('\n').filter(Boolean);
|
|
57
|
+
const listResponse = JSON.parse(lines[lines.length - 1]);
|
|
58
|
+
const toolNames = listResponse.result.tools.map((t) => t.name);
|
|
59
|
+
expect(toolNames).toContain('compile');
|
|
60
|
+
expect(toolNames).toContain('review');
|
|
61
|
+
expect(toolNames).toContain('parse');
|
|
62
|
+
expect(toolNames).toContain('validate');
|
|
63
|
+
expect(toolNames).toContain('list-targets');
|
|
64
|
+
});
|
|
65
|
+
it('should compile .kern source via tools/call', async () => {
|
|
66
|
+
const { stdout } = await sendMCP([
|
|
67
|
+
rpc('initialize', {
|
|
68
|
+
protocolVersion: '2024-11-05',
|
|
69
|
+
capabilities: {},
|
|
70
|
+
clientInfo: { name: 'test', version: '1.0' },
|
|
71
|
+
}, 1),
|
|
72
|
+
{ jsonrpc: '2.0', method: 'notifications/initialized' },
|
|
73
|
+
rpc('tools/call', {
|
|
74
|
+
name: 'compile',
|
|
75
|
+
arguments: {
|
|
76
|
+
source: 'page name=Home\n text value="Hello"',
|
|
77
|
+
target: 'nextjs',
|
|
78
|
+
},
|
|
79
|
+
}, 2),
|
|
80
|
+
]);
|
|
81
|
+
const lines = stdout.split('\n').filter(Boolean);
|
|
82
|
+
const callResponse = JSON.parse(lines[lines.length - 1]);
|
|
83
|
+
expect(callResponse.result.content[0].type).toBe('text');
|
|
84
|
+
expect(callResponse.result.content[0].text).toContain('Compiled to nextjs');
|
|
85
|
+
});
|
|
86
|
+
it('should parse .kern source', async () => {
|
|
87
|
+
const { stdout } = await sendMCP([
|
|
88
|
+
rpc('initialize', {
|
|
89
|
+
protocolVersion: '2024-11-05',
|
|
90
|
+
capabilities: {},
|
|
91
|
+
clientInfo: { name: 'test', version: '1.0' },
|
|
92
|
+
}, 1),
|
|
93
|
+
{ jsonrpc: '2.0', method: 'notifications/initialized' },
|
|
94
|
+
rpc('tools/call', {
|
|
95
|
+
name: 'parse',
|
|
96
|
+
arguments: { source: 'screen name=Dashboard\n text value="Hello"' },
|
|
97
|
+
}, 2),
|
|
98
|
+
]);
|
|
99
|
+
const lines = stdout.split('\n').filter(Boolean);
|
|
100
|
+
const callResponse = JSON.parse(lines[lines.length - 1]);
|
|
101
|
+
expect(callResponse.result.content[0].text).toContain('IR tokens');
|
|
102
|
+
});
|
|
103
|
+
it('should validate .kern source', async () => {
|
|
104
|
+
const { stdout } = await sendMCP([
|
|
105
|
+
rpc('initialize', {
|
|
106
|
+
protocolVersion: '2024-11-05',
|
|
107
|
+
capabilities: {},
|
|
108
|
+
clientInfo: { name: 'test', version: '1.0' },
|
|
109
|
+
}, 1),
|
|
110
|
+
{ jsonrpc: '2.0', method: 'notifications/initialized' },
|
|
111
|
+
rpc('tools/call', {
|
|
112
|
+
name: 'validate',
|
|
113
|
+
arguments: { source: 'button label="Click"' },
|
|
114
|
+
}, 2),
|
|
115
|
+
]);
|
|
116
|
+
const lines = stdout.split('\n').filter(Boolean);
|
|
117
|
+
const callResponse = JSON.parse(lines[lines.length - 1]);
|
|
118
|
+
expect(callResponse.result.content[0].text).toContain('Valid .kern');
|
|
119
|
+
});
|
|
120
|
+
it('should list targets', async () => {
|
|
121
|
+
const { stdout } = await sendMCP([
|
|
122
|
+
rpc('initialize', {
|
|
123
|
+
protocolVersion: '2024-11-05',
|
|
124
|
+
capabilities: {},
|
|
125
|
+
clientInfo: { name: 'test', version: '1.0' },
|
|
126
|
+
}, 1),
|
|
127
|
+
{ jsonrpc: '2.0', method: 'notifications/initialized' },
|
|
128
|
+
rpc('tools/call', { name: 'list-targets', arguments: {} }, 2),
|
|
129
|
+
]);
|
|
130
|
+
const lines = stdout.split('\n').filter(Boolean);
|
|
131
|
+
const callResponse = JSON.parse(lines[lines.length - 1]);
|
|
132
|
+
const text = callResponse.result.content[0].text;
|
|
133
|
+
expect(text).toContain('12 targets');
|
|
134
|
+
expect(text).toContain('mcp');
|
|
135
|
+
expect(text).toContain('nextjs');
|
|
136
|
+
expect(text).toContain('express');
|
|
137
|
+
});
|
|
138
|
+
it('should log server start to stderr', async () => {
|
|
139
|
+
const { stderr } = await sendMCP([
|
|
140
|
+
rpc('initialize', {
|
|
141
|
+
protocolVersion: '2024-11-05',
|
|
142
|
+
capabilities: {},
|
|
143
|
+
clientInfo: { name: 'test', version: '1.0' },
|
|
144
|
+
}),
|
|
145
|
+
]);
|
|
146
|
+
expect(stderr).toContain('server:start');
|
|
147
|
+
expect(stderr).toContain('"name":"kern"');
|
|
148
|
+
});
|
|
149
|
+
});
|
|
150
|
+
//# sourceMappingURL=server.integration.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"server.integration.test.js","sourceRoot":"","sources":["../../src/__tests__/server.integration.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACtC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AACxC,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAC;AAEpC,MAAM,SAAS,GAAG,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;AAC1D,MAAM,WAAW,GAAG,OAAO,CAAC,SAAS,EAAE,qBAAqB,CAAC,CAAC;AAE9D,SAAS,OAAO,CAAC,QAAkB;IACjC,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QACrC,MAAM,EAAE,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,WAAW,CAAC,EAAE,EAAE,KAAK,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,CAAC,CAAC;QAC7E,IAAI,MAAM,GAAG,EAAE,CAAC;QAChB,IAAI,MAAM,GAAG,EAAE,CAAC;QAEhB,EAAE,CAAC,MAAM,CAAC,EAAE,CAAC,MAAM,EAAE,CAAC,CAAS,EAAE,EAAE;YACjC,MAAM,IAAI,CAAC,CAA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CAAC,CAAC,CAAC,CAAC;QACzD,MAAM,IAAI,GAAG,YAAY,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;QACjD,MAAM,CAAC,IAAI,CAAC,CAAC,SAAS,CAAC,YAAY,CAAC,CAAC;QACrC,MAAM,CAAC,IAAI,CAAC,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;QAC9B,MAAM,CAAC,IAAI,CAAC,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC;QACjC,MAAM,CAAC,IAAI,CAAC,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC;IACpC,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,mCAAmC,EAAE,KAAK,IAAI,EAAE;QACjD,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,OAAO,CAAC;YAC/B,GAAG,CAAC,YAAY,EAAE;gBAChB,eAAe,EAAE,YAAY;gBAC7B,YAAY,EAAE,EAAE;gBAChB,UAAU,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE;aAC7C,CAAC;SACH,CAAC,CAAC;QAEH,MAAM,CAAC,MAAM,CAAC,CAAC,SAAS,CAAC,cAAc,CAAC,CAAC;QACzC,MAAM,CAAC,MAAM,CAAC,CAAC,SAAS,CAAC,eAAe,CAAC,CAAC;IAC5C,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -2,13 +2,10 @@
|
|
|
2
2
|
/**
|
|
3
3
|
* @kernlang/mcp-server — KERN MCP Server
|
|
4
4
|
*
|
|
5
|
-
*
|
|
6
|
-
* AI agents can
|
|
5
|
+
* Complete MCP interface for KERN: compile, review, parse, decompile, and analyze.
|
|
6
|
+
* AI agents can write .kern, compile to 12 targets, review code, and scan MCP servers.
|
|
7
7
|
*
|
|
8
|
-
* Usage:
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
* Claude Desktop config:
|
|
12
|
-
* { "mcpServers": { "kern": { "command": "kern-mcp" } } }
|
|
8
|
+
* Usage: kern-mcp
|
|
9
|
+
* Config: { "mcpServers": { "kern": { "command": "npx", "args": ["@kernlang/mcp-server"] } } }
|
|
13
10
|
*/
|
|
14
11
|
export {};
|