@cyanheads/mcp-ts-core 0.4.1 → 0.5.2
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/CLAUDE.md +30 -33
- package/README.md +6 -7
- package/dist/config/index.d.ts +1 -0
- package/dist/config/index.d.ts.map +1 -1
- package/dist/config/index.js +1 -0
- package/dist/config/index.js.map +1 -1
- package/dist/config/parseEnvConfig.d.ts +48 -0
- package/dist/config/parseEnvConfig.d.ts.map +1 -0
- package/dist/config/parseEnvConfig.js +73 -0
- package/dist/config/parseEnvConfig.js.map +1 -0
- package/dist/core/app.d.ts.map +1 -1
- package/dist/core/app.js +65 -3
- package/dist/core/app.js.map +1 -1
- package/dist/linter/rules/format-parity-rules.d.ts +34 -0
- package/dist/linter/rules/format-parity-rules.d.ts.map +1 -0
- package/dist/linter/rules/format-parity-rules.js +335 -0
- package/dist/linter/rules/format-parity-rules.js.map +1 -0
- package/dist/linter/rules/tool-rules.d.ts.map +1 -1
- package/dist/linter/rules/tool-rules.js +5 -0
- package/dist/linter/rules/tool-rules.js.map +1 -1
- package/package.json +10 -15
- package/skills/add-tool/SKILL.md +3 -2
- package/skills/api-config/SKILL.md +17 -5
- package/skills/field-test/SKILL.md +2 -2
- package/skills/maintenance/SKILL.md +141 -22
- package/skills/polish-docs-meta/SKILL.md +2 -2
- package/skills/polish-docs-meta/references/readme.md +217 -79
- package/skills/setup/SKILL.md +3 -3
- package/templates/AGENTS.md +19 -11
- package/templates/CLAUDE.md +18 -10
- package/skills/devcheck/SKILL.md +0 -54
- package/skills/walkthrough-init/SKILL.md +0 -50
package/templates/CLAUDE.md
CHANGED
|
@@ -14,8 +14,7 @@
|
|
|
14
14
|
|
|
15
15
|
1. **Read the framework API** — `node_modules/@cyanheads/mcp-ts-core/CLAUDE.md`
|
|
16
16
|
2. **Run the `setup` skill** — read `skills/setup/SKILL.md` and follow its checklist (project orientation, agent protocol file selection, echo definition cleanup, skill sync)
|
|
17
|
-
3. **
|
|
18
|
-
4. **Design the server** — read `skills/design-mcp-server/SKILL.md` and work through it with the user to map the domain into tools, resources, and services before scaffolding
|
|
17
|
+
3. **Design the server** — read `skills/design-mcp-server/SKILL.md` and work through it with the user to map the domain into tools, resources, and services before scaffolding
|
|
19
18
|
|
|
20
19
|
---
|
|
21
20
|
|
|
@@ -31,7 +30,7 @@ When the user asks what to do next, what's left, or needs direction, suggest rel
|
|
|
31
30
|
6. **Field-test definitions** — exercise tools/resources/prompts with real inputs using the `field-test` skill, get a report of issues and pain points
|
|
32
31
|
7. **Run `devcheck`** — lint, format, typecheck, and security audit
|
|
33
32
|
8. **Run the `polish-docs-meta` skill** — finalize README, CHANGELOG, metadata, and agent protocol for shipping
|
|
34
|
-
9. **Run the `maintenance` skill** —
|
|
33
|
+
9. **Run the `maintenance` skill** — investigate changelogs, adopt upstream changes, and sync skills after `bun update --latest`
|
|
35
34
|
|
|
36
35
|
Tailor suggestions to what's actually missing or stale — don't recite the full list every time.
|
|
37
36
|
|
|
@@ -77,6 +76,7 @@ export const searchItems = tool('search_items', {
|
|
|
77
76
|
|
|
78
77
|
// format() populates content[] — the only field most LLM clients forward to
|
|
79
78
|
// the model. Render all data the LLM needs, not just a count or title.
|
|
79
|
+
// Enforced at lint time: every field in `output` must appear in the rendered text.
|
|
80
80
|
format: (result) => [{
|
|
81
81
|
type: 'text',
|
|
82
82
|
text: result.items.map(i => `**${i.id}**: ${i.name}`).join('\n'),
|
|
@@ -122,20 +122,26 @@ export const reviewCode = prompt('review_code', {
|
|
|
122
122
|
|
|
123
123
|
```ts
|
|
124
124
|
// src/config/server-config.ts — lazy-parsed, separate from framework config
|
|
125
|
+
import { z } from '@cyanheads/mcp-ts-core';
|
|
126
|
+
import { parseEnvConfig } from '@cyanheads/mcp-ts-core/config';
|
|
127
|
+
|
|
125
128
|
const ServerConfigSchema = z.object({
|
|
126
|
-
|
|
129
|
+
apiKey: z.string().describe('External API key'),
|
|
127
130
|
maxResults: z.coerce.number().default(100),
|
|
128
131
|
});
|
|
132
|
+
|
|
129
133
|
let _config: z.infer<typeof ServerConfigSchema> | undefined;
|
|
130
134
|
export function getServerConfig() {
|
|
131
|
-
_config ??= ServerConfigSchema
|
|
132
|
-
|
|
133
|
-
maxResults:
|
|
135
|
+
_config ??= parseEnvConfig(ServerConfigSchema, {
|
|
136
|
+
apiKey: 'MY_API_KEY',
|
|
137
|
+
maxResults: 'MY_MAX_RESULTS',
|
|
134
138
|
});
|
|
135
139
|
return _config;
|
|
136
140
|
}
|
|
137
141
|
```
|
|
138
142
|
|
|
143
|
+
`parseEnvConfig` maps Zod schema paths → env var names so validation errors name the actual variable (`MY_API_KEY`) rather than the internal path (`apiKey`). It throws a `ConfigurationError` the framework catches and prints as a clean startup banner.
|
|
144
|
+
|
|
139
145
|
---
|
|
140
146
|
|
|
141
147
|
## Context
|
|
@@ -215,7 +221,7 @@ src/
|
|
|
215
221
|
|
|
216
222
|
Skills are modular instructions in `skills/` at the project root. Read them directly when a task matches — e.g., `skills/add-tool/SKILL.md` when adding a tool.
|
|
217
223
|
|
|
218
|
-
**Agent skill directory:** Copy skills into the directory your agent discovers (Claude Code: `.claude/skills/`, others: equivalent). This makes skills available as context without needing to reference `skills/` paths manually. After framework updates, re-
|
|
224
|
+
**Agent skill directory:** Copy skills into the directory your agent discovers (Claude Code: `.claude/skills/`, others: equivalent). This makes skills available as context without needing to reference `skills/` paths manually. After framework updates, run the `maintenance` skill — it re-syncs the agent directory automatically (Phase B).
|
|
219
225
|
|
|
220
226
|
Available skills:
|
|
221
227
|
|
|
@@ -232,7 +238,7 @@ Available skills:
|
|
|
232
238
|
| `field-test` | Exercise tools/resources/prompts with real inputs, verify behavior, report issues |
|
|
233
239
|
| `devcheck` | Lint, format, typecheck, audit |
|
|
234
240
|
| `polish-docs-meta` | Finalize docs, README, metadata, and agent protocol for shipping |
|
|
235
|
-
| `maintenance` |
|
|
241
|
+
| `maintenance` | Investigate changelogs, adopt upstream changes, sync skills to agent dirs |
|
|
236
242
|
| `report-issue-framework` | File a bug or feature request against `@cyanheads/mcp-ts-core` via `gh` CLI |
|
|
237
243
|
| `report-issue-local` | File a bug or feature request against this server's own repo via `gh` CLI |
|
|
238
244
|
| `api-auth` | Auth modes, scopes, JWT/OAuth |
|
|
@@ -250,6 +256,8 @@ When you complete a skill's checklist, check the boxes and add a completion time
|
|
|
250
256
|
|
|
251
257
|
## Commands
|
|
252
258
|
|
|
259
|
+
**Runtime:** Scripts use `tsx` — both `npm run <cmd>` and `bun run <cmd>` work. Use whichever package manager you have; `bun` is slightly faster for invoking scripts but not required.
|
|
260
|
+
|
|
253
261
|
| Command | Purpose |
|
|
254
262
|
|:--------|:--------|
|
|
255
263
|
| `npm run build` | Compile TypeScript |
|
|
@@ -281,7 +289,7 @@ import { getMyService } from '@/services/my-domain/my-service.js';
|
|
|
281
289
|
|
|
282
290
|
## Checklist
|
|
283
291
|
|
|
284
|
-
- [ ] Zod schemas: all fields have `.describe()`, only JSON-Schema-serializable types (no `z.custom()`, `z.date()`, `z.transform()`,
|
|
292
|
+
- [ ] Zod schemas: all fields have `.describe()`, only JSON-Schema-serializable types (no `z.custom()`, `z.date()`, `z.transform()`, `z.bigint()`, `z.symbol()`, `z.void()`, `z.map()`, `z.set()`, `z.function()`, `z.nan()`)
|
|
285
293
|
- [ ] Optional nested objects: handler guards for empty inner values from form-based clients (`if (input.obj?.field && ...)`, not just `if (input.obj)`)
|
|
286
294
|
- [ ] JSDoc `@fileoverview` + `@module` on every file
|
|
287
295
|
- [ ] `ctx.log` for logging, `ctx.state` for storage
|
package/skills/devcheck/SKILL.md
DELETED
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: devcheck
|
|
3
|
-
description: >
|
|
4
|
-
Lint, format, typecheck, and verify the project is clean. Use after making changes, before committing, or when the user asks to verify quality.
|
|
5
|
-
metadata:
|
|
6
|
-
author: cyanheads
|
|
7
|
-
version: "1.3"
|
|
8
|
-
audience: external
|
|
9
|
-
type: workflow
|
|
10
|
-
---
|
|
11
|
-
|
|
12
|
-
## What It Runs
|
|
13
|
-
|
|
14
|
-
`bun run devcheck` runs a broader check suite than just lint + types. By default it includes local hygiene checks, MCP definition linting, Biome, TypeScript, and slow dependency/security checks unless `--fast` is passed. Tests are opt-in via `--test`.
|
|
15
|
-
|
|
16
|
-
| Check | Tool | Notes |
|
|
17
|
-
|:------|:-----|:------|
|
|
18
|
-
| TODOs / FIXMEs | `git grep` | Fails on tracked TODO/FIXME markers outside excluded files |
|
|
19
|
-
| Tracked secrets | `git ls-files` | Flags tracked `.env`, keys, credentials, and similar sensitive files |
|
|
20
|
-
| MCP definitions | `bun run scripts/lint-mcp.ts` | Validates tool/resource/prompt definitions against framework rules |
|
|
21
|
-
| Biome | `biome check` | Unified lint + format — read-only by default |
|
|
22
|
-
| TypeScript | `tsc --noEmit` | Full project type check |
|
|
23
|
-
| Unused dependencies | `depcheck` | Runs by default; network-free but slower on large repos |
|
|
24
|
-
| Security audit | `bun audit` | Runs by default unless `--fast` or `--no-audit` |
|
|
25
|
-
| Outdated dependencies | `bun outdated` | Runs by default unless `--fast` or `--no-deps` |
|
|
26
|
-
| Tests | `vitest run` | Off by default; enable with `bun run devcheck --test` |
|
|
27
|
-
|
|
28
|
-
To auto-fix lint/format issues, run `bun run format`.
|
|
29
|
-
|
|
30
|
-
## Steps
|
|
31
|
-
|
|
32
|
-
1. Run `bun run devcheck`
|
|
33
|
-
2. Read the failing checks in the summary and per-check output
|
|
34
|
-
3. Fix the reported issues
|
|
35
|
-
4. Re-run `bun run devcheck` until clean
|
|
36
|
-
5. If the change touches runtime behavior, also run `bun run devcheck --test` or `bun run test`
|
|
37
|
-
6. Do not consider this skill complete until the required commands exit successfully with no errors
|
|
38
|
-
|
|
39
|
-
## Common Issues
|
|
40
|
-
|
|
41
|
-
| Check | Error Type | Typical Fix |
|
|
42
|
-
|:------|:-----------|:------------|
|
|
43
|
-
| TODOs / FIXMEs | Tracked work markers | Resolve or remove the marker before committing |
|
|
44
|
-
| Tracked secrets | Sensitive files in git | Add to `.gitignore` and remove from the index |
|
|
45
|
-
| MCP definitions | Definition lint errors | Fix schema/name/annotation issues reported by `lint-mcp` |
|
|
46
|
-
| Biome | Lint/format errors | Run `bun run format` to auto-fix, or address the flagged rule manually |
|
|
47
|
-
| TypeScript | Type errors | Fix type mismatches, missing properties, incorrect generics |
|
|
48
|
-
| Security audit | Vulnerabilities in direct deps | Update or replace the affected dependency |
|
|
49
|
-
| Outdated deps | Stale package versions | Run `bun update` or allowlist intentionally pinned packages |
|
|
50
|
-
|
|
51
|
-
## Checklist
|
|
52
|
-
|
|
53
|
-
- [ ] `bun run devcheck` exits with no errors
|
|
54
|
-
- [ ] Tests run when needed (`bun run devcheck --test` or `bun run test`)
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: walkthrough-init
|
|
3
|
-
description: >
|
|
4
|
-
Trace the agent onboarding flow after `init` scaffolds a new project. Starts from the agent reading CLAUDE.md for the first time and follows every instruction chain through skills and framework docs. Use to audit the onboarding path, find dead ends, or catch missing instructions.
|
|
5
|
-
metadata:
|
|
6
|
-
author: cyanheads
|
|
7
|
-
version: "1.0"
|
|
8
|
-
audience: internal
|
|
9
|
-
type: debug
|
|
10
|
-
---
|
|
11
|
-
|
|
12
|
-
## What this skill does
|
|
13
|
-
|
|
14
|
-
A developer has run `npx @cyanheads/mcp-ts-core init banking-mcp-server` and `bun install`. They open the project and run `claude`. You are that agent, seeing this project for the first time.
|
|
15
|
-
|
|
16
|
-
Trace the onboarding path through the actual files as they exist right now. Follow every instruction chain — read what you're told to read, do what you're told to do, and report what happens.
|
|
17
|
-
|
|
18
|
-
---
|
|
19
|
-
|
|
20
|
-
## Instructions
|
|
21
|
-
|
|
22
|
-
### Step 1: Read the project's CLAUDE.md
|
|
23
|
-
|
|
24
|
-
This is the first file the agent sees. Read `CLAUDE.md` at the project root. Report:
|
|
25
|
-
|
|
26
|
-
- What does it tell you to do first?
|
|
27
|
-
- What files does it point you to?
|
|
28
|
-
- Does it mention the `setup` skill? How?
|
|
29
|
-
|
|
30
|
-
### Step 2: Follow the first instruction
|
|
31
|
-
|
|
32
|
-
Whatever CLAUDE.md says to do first — do it. If it says to read a file, read it. If it says to run a skill, read that skill's SKILL.md. Report what you find and what it tells you to do next.
|
|
33
|
-
|
|
34
|
-
### Step 3: Keep following the chain
|
|
35
|
-
|
|
36
|
-
Continue following instructions until you've completed the full onboarding loop. At each step:
|
|
37
|
-
|
|
38
|
-
- What file are you reading?
|
|
39
|
-
- What does it tell you to do?
|
|
40
|
-
- Can you actually do it? (Do the referenced files/paths exist?)
|
|
41
|
-
- What's the next step it points you to?
|
|
42
|
-
|
|
43
|
-
### Step 4: Report
|
|
44
|
-
|
|
45
|
-
After the chain ends (or breaks), produce:
|
|
46
|
-
|
|
47
|
-
1. **The path you followed** — ordered list of files read and actions taken
|
|
48
|
-
2. **Broken links** — instructions that point to files that don't exist, skills that aren't written, or actions that can't be completed
|
|
49
|
-
3. **Dead ends** — places where the instructions stop and you don't know what to do next
|
|
50
|
-
4. **The complete onboarding flow** — a summary of what a new agent actually experiences, step by step
|