@cyanheads/mcp-ts-core 0.9.11 → 0.9.13
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 +1 -1
- package/README.md +1 -1
- package/changelog/0.9.x/0.9.12.md +26 -0
- package/changelog/0.9.x/0.9.13.md +33 -0
- package/dist/config/index.d.ts +9 -0
- package/dist/config/index.d.ts.map +1 -1
- package/dist/config/index.js +30 -0
- package/dist/config/index.js.map +1 -1
- package/dist/core/serverManifest.d.ts +13 -1
- package/dist/core/serverManifest.d.ts.map +1 -1
- package/dist/core/serverManifest.js +5 -1
- package/dist/core/serverManifest.js.map +1 -1
- package/dist/logs/combined.log +4 -4
- package/dist/logs/error.log +2 -2
- package/dist/mcp-server/transports/http/httpTransport.d.ts.map +1 -1
- package/dist/mcp-server/transports/http/httpTransport.js +41 -0
- package/dist/mcp-server/transports/http/httpTransport.js.map +1 -1
- package/package.json +3 -3
- package/scripts/check-docs-sync.ts +50 -32
- package/skills/api-canvas/SKILL.md +106 -1
- package/skills/api-config/SKILL.md +2 -1
- package/skills/orchestrations/SKILL.md +18 -12
- package/skills/orchestrations/workflows/maintenance-release.md +3 -1
- package/skills/polish-docs-meta/SKILL.md +1 -2
- package/skills/polish-docs-meta/references/readme.md +15 -1
- package/templates/.env.example +1 -0
- package/templates/AGENTS.md +8 -35
- package/templates/CLAUDE.md +8 -36
- package/skills/migrate-mcp-ts-template/SKILL.md +0 -162
package/templates/AGENTS.md
CHANGED
|
@@ -50,6 +50,7 @@ Tailor suggestions to what's actually missing or stale — don't recite the full
|
|
|
50
50
|
- **Use `ctx.state`** for tenant-scoped storage. Never access persistence directly.
|
|
51
51
|
- **Check `ctx.elicit` / `ctx.sample`** for presence before calling.
|
|
52
52
|
- **Secrets in env vars only** — never hardcoded.
|
|
53
|
+
- **Close the loop on issues.** When implementing work tracked by a GitHub issue, comment on the issue with what landed and close it. Do both — a comment without a close leaves stale issues open; a close without a comment leaves no record of what shipped. The comment is for future readers — state the concrete changes, not the conversation that produced them.
|
|
53
54
|
|
|
54
55
|
---
|
|
55
56
|
|
|
@@ -151,6 +152,10 @@ export function getServerConfig() {
|
|
|
151
152
|
|
|
152
153
|
`parseEnvConfig` maps Zod schema paths → env var names so errors name the variable (`MY_API_KEY`) not the path (`apiKey`). Throws `ConfigurationError`, which the framework prints as a clean startup banner.
|
|
153
154
|
|
|
155
|
+
### Server instructions
|
|
156
|
+
|
|
157
|
+
`createApp({ instructions })` — optional server-level orientation, sent to clients on every `initialize` as session-level context. Use it for deployment guidance (connection aliases, regional notes, scope hints) instead of repeating the same context across tool descriptions. Client adoption is uneven, but there's no downside when set.
|
|
158
|
+
|
|
154
159
|
---
|
|
155
160
|
|
|
156
161
|
## Context
|
|
@@ -177,6 +182,8 @@ Handlers throw — the framework catches, classifies, and formats.
|
|
|
177
182
|
**Recommended: typed error contract.** Declare `errors: [{ reason, code, when, recovery, retryable? }]` on `tool()` / `resource()` to receive `ctx.fail(reason, …)` typed against the reason union. TypeScript catches typos at compile time, `data.reason` is auto-populated for observability, linter enforces conformance against the handler body. `recovery` is required descriptive metadata for the agent's next move (≥ 5 words, lint-validated); for the wire `data.recovery.hint` (mirrored into `content[]` text), pass explicitly at the throw site when dynamic context matters: `ctx.fail('reason', msg, { recovery: { hint: '...' } })`. Baseline codes (`InternalError`, `ServiceUnavailable`, `Timeout`, `ValidationError`, `SerializationError`) bubble freely and don't need declaring.
|
|
178
183
|
|
|
179
184
|
```ts
|
|
185
|
+
import { JsonRpcErrorCode } from '@cyanheads/mcp-ts-core/errors';
|
|
186
|
+
|
|
180
187
|
errors: [
|
|
181
188
|
{ reason: 'no_match', code: JsonRpcErrorCode.NotFound,
|
|
182
189
|
when: 'No item matched the query',
|
|
@@ -271,7 +278,6 @@ Available skills:
|
|
|
271
278
|
| `polish-docs-meta` | Finalize docs, README, metadata, and agent protocol for shipping |
|
|
272
279
|
| `git-wrapup` | Land working-tree changes as a versioned commit + annotated tag — version bump, changelog, verify, tag. Local only. |
|
|
273
280
|
| `release-and-publish` | Push + npm + MCP Registry + GH Release + Docker. Picks up from `git-wrapup` |
|
|
274
|
-
| `migrate-mcp-ts-template` | One-time migration of an existing project to the current framework template |
|
|
275
281
|
| `maintenance` | Investigate changelogs, adopt upstream changes, sync skills to agent dirs |
|
|
276
282
|
| `report-issue-framework` | File a bug or feature request against `@cyanheads/mcp-ts-core` via `gh` CLI |
|
|
277
283
|
| `report-issue-local` | File a bug or feature request against this server's own repo via `gh` CLI |
|
|
@@ -319,40 +325,7 @@ When you complete a skill's checklist, check the boxes and add a completion time
|
|
|
319
325
|
|
|
320
326
|
**Adding an env var requires both files:** `server.json` (registry discovery, `environmentVariables[]`) and `manifest.json` (bundle install UX, `mcp_config.env` + `user_config`). `lint:packaging` (run by `devcheck`) verifies the env var names match.
|
|
321
327
|
|
|
322
|
-
**README install badges
|
|
323
|
-
|
|
324
|
-
| Client | Mechanism |
|
|
325
|
-
|:-------|:----------|
|
|
326
|
-
| Claude Desktop | Browser downloads the `.mcpb` from the latest GitHub Release; OS file handler routes it to Claude Desktop, which opens the install dialog. No deep-link URL scheme yet — this is the canonical path. |
|
|
327
|
-
| Cursor | Official `https://cursor.com/en/install-mcp` endpoint with base64 JSON config. |
|
|
328
|
-
| VS Code / Insiders | Official `vscode:mcp/install?...` deep link, wrapped in `https://vscode.dev/redirect?url=` so GitHub-rendered markdown doesn't strip the non-HTTP scheme. |
|
|
329
|
-
| Claude Code / Codex | CLI only (`claude mcp add` / `codex mcp add`); no URL scheme. |
|
|
330
|
-
|
|
331
|
-
```markdown
|
|
332
|
-
[](https://github.com/<OWNER>/<REPO>/releases/latest/download/<PACKAGE_NAME>.mcpb)
|
|
333
|
-
[](https://cursor.com/en/install-mcp?name=<PACKAGE_NAME>&config=<BASE64_CONFIG>)
|
|
334
|
-
[](https://vscode.dev/redirect?url=vscode:mcp/install?<URLENCODED_JSON>)
|
|
335
|
-
```
|
|
336
|
-
|
|
337
|
-
Both install links route through HTTPS endpoints (`cursor.com/en/install-mcp` and `vscode.dev/redirect`) — GitHub-rendered markdown strips non-HTTP URL schemes from anchors, so a raw `cursor://` or `vscode:` link won't click through from github.com.
|
|
338
|
-
|
|
339
|
-
Generate the encoded configs (replace `<PACKAGE_NAME>` and add env vars for any required API keys):
|
|
340
|
-
|
|
341
|
-
```bash
|
|
342
|
-
# Cursor: base64-encoded JSON. Split command/args, add env when keys are needed.
|
|
343
|
-
echo -n '{"command":"npx","args":["-y","<PACKAGE_NAME>"],"env":{"API_KEY":"your-api-key"}}' | base64
|
|
344
|
-
# Without env (no required keys):
|
|
345
|
-
echo -n '{"command":"npx","args":["-y","<PACKAGE_NAME>"]}' | base64
|
|
346
|
-
|
|
347
|
-
# VS Code: URL-encoded JSON. Same shape plus a `name` field.
|
|
348
|
-
node -p 'encodeURIComponent(JSON.stringify({name:"<SHORT_NAME>",command:"npx",args:["-y","<PACKAGE_NAME>"],env:{API_KEY:"your-api-key"}}))'
|
|
349
|
-
# Without env:
|
|
350
|
-
node -p 'encodeURIComponent(JSON.stringify({name:"<SHORT_NAME>",command:"npx",args:["-y","<PACKAGE_NAME>"]}))'
|
|
351
|
-
```
|
|
352
|
-
|
|
353
|
-
Both clients use the same `{command, args, env}` shape (matching `mcp.json` schema). VS Code adds a top-level `name` field. Omit `env` entirely when no API keys are needed — don't include empty objects or framework-only vars like `MCP_TRANSPORT_TYPE`.
|
|
354
|
-
|
|
355
|
-
The Claude Desktop badge requires the bundle to ship with a stable filename — `bun run bundle` outputs `dist/<PACKAGE_NAME>.mcpb`, and `release-and-publish` attaches that file to the GitHub Release. `releases/latest/download/<PACKAGE_NAME>.mcpb` then redirects to the most recent release.
|
|
328
|
+
**README install badges** (Claude Desktop `.mcpb`, Cursor, VS Code) and the `base64` / `encodeURIComponent` config-generation commands are ship-time concerns — run the `polish-docs-meta` skill, which carries the badge format, layout, and generation snippets in `skills/polish-docs-meta/references/readme.md`.
|
|
356
329
|
|
|
357
330
|
---
|
|
358
331
|
|
package/templates/CLAUDE.md
CHANGED
|
@@ -152,6 +152,10 @@ export function getServerConfig() {
|
|
|
152
152
|
|
|
153
153
|
`parseEnvConfig` maps Zod schema paths → env var names so errors name the variable (`MY_API_KEY`) not the path (`apiKey`). Throws `ConfigurationError`, which the framework prints as a clean startup banner.
|
|
154
154
|
|
|
155
|
+
### Server instructions
|
|
156
|
+
|
|
157
|
+
`createApp({ instructions })` — optional server-level orientation, sent to clients on every `initialize` as session-level context. Use it for deployment guidance (connection aliases, regional notes, scope hints) instead of repeating the same context across tool descriptions. Client adoption is uneven, but there's no downside when set.
|
|
158
|
+
|
|
155
159
|
---
|
|
156
160
|
|
|
157
161
|
## Context
|
|
@@ -178,6 +182,8 @@ Handlers throw — the framework catches, classifies, and formats.
|
|
|
178
182
|
**Recommended: typed error contract.** Declare `errors: [{ reason, code, when, recovery, retryable? }]` on `tool()` / `resource()` to receive `ctx.fail(reason, …)` typed against the reason union. TypeScript catches typos at compile time, `data.reason` is auto-populated for observability, linter enforces conformance against the handler body. `recovery` is required descriptive metadata for the agent's next move (≥ 5 words, lint-validated); for the wire `data.recovery.hint` (mirrored into `content[]` text), pass explicitly at the throw site when dynamic context matters: `ctx.fail('reason', msg, { recovery: { hint: '...' } })`. Baseline codes (`InternalError`, `ServiceUnavailable`, `Timeout`, `ValidationError`, `SerializationError`) bubble freely and don't need declaring.
|
|
179
183
|
|
|
180
184
|
```ts
|
|
185
|
+
import { JsonRpcErrorCode } from '@cyanheads/mcp-ts-core/errors';
|
|
186
|
+
|
|
181
187
|
errors: [
|
|
182
188
|
{ reason: 'no_match', code: JsonRpcErrorCode.NotFound,
|
|
183
189
|
when: 'No item matched the query',
|
|
@@ -272,7 +278,6 @@ Available skills:
|
|
|
272
278
|
| `polish-docs-meta` | Finalize docs, README, metadata, and agent protocol for shipping |
|
|
273
279
|
| `git-wrapup` | Land working-tree changes as a versioned commit + annotated tag — version bump, changelog, verify, tag. Local only. |
|
|
274
280
|
| `release-and-publish` | Push + npm + MCP Registry + GH Release + Docker. Picks up from `git-wrapup` |
|
|
275
|
-
| `migrate-mcp-ts-template` | One-time migration of an existing project to the current framework template |
|
|
276
281
|
| `maintenance` | Investigate changelogs, adopt upstream changes, sync skills to agent dirs |
|
|
277
282
|
| `report-issue-framework` | File a bug or feature request against `@cyanheads/mcp-ts-core` via `gh` CLI |
|
|
278
283
|
| `report-issue-local` | File a bug or feature request against this server's own repo via `gh` CLI |
|
|
@@ -302,7 +307,7 @@ When you complete a skill's checklist, check the boxes and add a completion time
|
|
|
302
307
|
| `npm run rebuild` | Clean + build |
|
|
303
308
|
| `npm run clean` | Remove build artifacts |
|
|
304
309
|
| `npm run devcheck` | Lint + format + typecheck + security + changelog sync |
|
|
305
|
-
| `bun run audit:refresh` | Delete `bun.lock`, reinstall, re-audit
|
|
310
|
+
| `bun run audit:refresh` | Delete `bun.lock`, reinstall, and re-run `bun audit`. Use when `devcheck` flags a transitive advisory — Bun's `update` is sticky on transitive resolutions, so the advisory may be a stale-lockfile false positive. If it survives the refresh, it's real. |
|
|
306
311
|
| `npm run tree` | Generate directory structure doc |
|
|
307
312
|
| `npm run format` | Auto-fix formatting |
|
|
308
313
|
| `npm test` | Run tests |
|
|
@@ -320,40 +325,7 @@ When you complete a skill's checklist, check the boxes and add a completion time
|
|
|
320
325
|
|
|
321
326
|
**Adding an env var requires both files:** `server.json` (registry discovery, `environmentVariables[]`) and `manifest.json` (bundle install UX, `mcp_config.env` + `user_config`). `lint:packaging` (run by `devcheck`) verifies the env var names match.
|
|
322
327
|
|
|
323
|
-
**README install badges
|
|
324
|
-
|
|
325
|
-
| Client | Mechanism |
|
|
326
|
-
|:-------|:----------|
|
|
327
|
-
| Claude Desktop | Browser downloads the `.mcpb` from the latest GitHub Release; OS file handler routes it to Claude Desktop, which opens the install dialog. No deep-link URL scheme yet — this is the canonical path. |
|
|
328
|
-
| Cursor | Official `https://cursor.com/en/install-mcp` endpoint with base64 JSON config. |
|
|
329
|
-
| VS Code / Insiders | Official `vscode:mcp/install?...` deep link, wrapped in `https://vscode.dev/redirect?url=` so GitHub-rendered markdown doesn't strip the non-HTTP scheme. |
|
|
330
|
-
| Claude Code / Codex | CLI only (`claude mcp add` / `codex mcp add`); no URL scheme. |
|
|
331
|
-
|
|
332
|
-
```markdown
|
|
333
|
-
[](https://github.com/<OWNER>/<REPO>/releases/latest/download/<PACKAGE_NAME>.mcpb)
|
|
334
|
-
[](https://cursor.com/en/install-mcp?name=<PACKAGE_NAME>&config=<BASE64_CONFIG>)
|
|
335
|
-
[](https://vscode.dev/redirect?url=vscode:mcp/install?<URLENCODED_JSON>)
|
|
336
|
-
```
|
|
337
|
-
|
|
338
|
-
Both install links route through HTTPS endpoints (`cursor.com/en/install-mcp` and `vscode.dev/redirect`) — GitHub-rendered markdown strips non-HTTP URL schemes from anchors, so a raw `cursor://` or `vscode:` link won't click through from github.com.
|
|
339
|
-
|
|
340
|
-
Generate the encoded configs (replace `<PACKAGE_NAME>` and add env vars for any required API keys):
|
|
341
|
-
|
|
342
|
-
```bash
|
|
343
|
-
# Cursor: base64-encoded JSON. Split command/args, add env when keys are needed.
|
|
344
|
-
echo -n '{"command":"npx","args":["-y","<PACKAGE_NAME>"],"env":{"API_KEY":"your-api-key"}}' | base64
|
|
345
|
-
# Without env (no required keys):
|
|
346
|
-
echo -n '{"command":"npx","args":["-y","<PACKAGE_NAME>"]}' | base64
|
|
347
|
-
|
|
348
|
-
# VS Code: URL-encoded JSON. Same shape plus a `name` field.
|
|
349
|
-
node -p 'encodeURIComponent(JSON.stringify({name:"<SHORT_NAME>",command:"npx",args:["-y","<PACKAGE_NAME>"],env:{API_KEY:"your-api-key"}}))'
|
|
350
|
-
# Without env:
|
|
351
|
-
node -p 'encodeURIComponent(JSON.stringify({name:"<SHORT_NAME>",command:"npx",args:["-y","<PACKAGE_NAME>"]}))'
|
|
352
|
-
```
|
|
353
|
-
|
|
354
|
-
Both clients use the same `{command, args, env}` shape (matching `mcp.json` schema). VS Code adds a top-level `name` field. Omit `env` entirely when no API keys are needed — don't include empty objects or framework-only vars like `MCP_TRANSPORT_TYPE`.
|
|
355
|
-
|
|
356
|
-
The Claude Desktop badge requires the bundle to ship with a stable filename — `bun run bundle` outputs `dist/<PACKAGE_NAME>.mcpb`, and `release-and-publish` attaches that file to the GitHub Release. `releases/latest/download/<PACKAGE_NAME>.mcpb` then redirects to the most recent release.
|
|
328
|
+
**README install badges** (Claude Desktop `.mcpb`, Cursor, VS Code) and the `base64` / `encodeURIComponent` config-generation commands are ship-time concerns — run the `polish-docs-meta` skill, which carries the badge format, layout, and generation snippets in `skills/polish-docs-meta/references/readme.md`.
|
|
357
329
|
|
|
358
330
|
---
|
|
359
331
|
|
|
@@ -1,162 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: migrate-mcp-ts-template
|
|
3
|
-
description: >
|
|
4
|
-
Migrate an existing mcp-ts-template fork to use @cyanheads/mcp-ts-core as a package dependency. Use when a project was cloned/forked from github.com/cyanheads/mcp-ts-template and carries framework source code in its own src/ — this skill rewrites those internal imports to package subpath imports and removes the bundled framework files.
|
|
5
|
-
metadata:
|
|
6
|
-
author: cyanheads
|
|
7
|
-
version: "2.2"
|
|
8
|
-
audience: external
|
|
9
|
-
type: workflow
|
|
10
|
-
---
|
|
11
|
-
|
|
12
|
-
## Context
|
|
13
|
-
|
|
14
|
-
Before `@cyanheads/mcp-ts-core` was published as a package, users built servers by forking/cloning the `mcp-ts-template` repo. Those forks carry the full framework source code in their `src/` and use `@/` path aliases to import framework internals alongside their own server code.
|
|
15
|
-
|
|
16
|
-
This skill converts such a project to use `@cyanheads/mcp-ts-core` as a dependency — rewriting framework imports to package subpaths and removing the bundled framework files, while leaving server-specific code (tools, resources, prompts, services) untouched.
|
|
17
|
-
|
|
18
|
-
For the full exports catalog, see `CLAUDE.md` → Exports Reference.
|
|
19
|
-
|
|
20
|
-
## Steps
|
|
21
|
-
|
|
22
|
-
1. **Install the package**: `bun add @cyanheads/mcp-ts-core`
|
|
23
|
-
2. **Search for all `@/` imports** across `src/` that reference framework internals: `grep -rn "from '@/" src/`
|
|
24
|
-
3. **Rewrite each import** using the mapping table below
|
|
25
|
-
4. **Identify framework source files** now provided by the package (see candidates below) — review each for server-specific additions before cleaning up
|
|
26
|
-
5. **Update entry point** (`src/index.ts`) to use `createApp()` from the package and the project's chosen registration pattern (fresh scaffold default: direct imports in `src/index.ts`)
|
|
27
|
-
6. **Update build configs**:
|
|
28
|
-
- `tsconfig.json` extends `@cyanheads/mcp-ts-core/tsconfig.base.json`
|
|
29
|
-
- `biome.json` extends `@cyanheads/mcp-ts-core/biome`
|
|
30
|
-
- `vitest.config.ts` spreads from `@cyanheads/mcp-ts-core/vitest.config`
|
|
31
|
-
7. **Run `bun run devcheck`** to verify no broken imports remain
|
|
32
|
-
8. **Verify no `@/` imports** point to framework files that are no longer local
|
|
33
|
-
|
|
34
|
-
## Import mapping
|
|
35
|
-
|
|
36
|
-
These are the actual `@/` import paths used in framework source. Rewrite any that appear in server-specific files (tools, resources, services, config).
|
|
37
|
-
|
|
38
|
-
### Core
|
|
39
|
-
|
|
40
|
-
| Old `@/` import | New package import |
|
|
41
|
-
|:----------------|:-------------------|
|
|
42
|
-
| `@/config/index.js` | `@cyanheads/mcp-ts-core/config` |
|
|
43
|
-
| `@/context.js` or `@/core/context.js` | `@cyanheads/mcp-ts-core` |
|
|
44
|
-
| `@/core/worker.js` | `@cyanheads/mcp-ts-core/worker` |
|
|
45
|
-
| `@/types-global/errors.js` | `@cyanheads/mcp-ts-core/errors` |
|
|
46
|
-
| `@/storage/core/StorageService.js` | `@cyanheads/mcp-ts-core/storage` |
|
|
47
|
-
| `@/storage/core/IStorageProvider.js` | `@cyanheads/mcp-ts-core/storage/types` |
|
|
48
|
-
| `@/mcp-server/transports/auth/lib/checkScopes.js` | `@cyanheads/mcp-ts-core/auth` |
|
|
49
|
-
| `@/testing/index.js` | `@cyanheads/mcp-ts-core/testing` |
|
|
50
|
-
|
|
51
|
-
### Definition types
|
|
52
|
-
|
|
53
|
-
| Old `@/` import | New package import |
|
|
54
|
-
|:----------------|:-------------------|
|
|
55
|
-
| `@/mcp-server/tools/utils/toolDefinition.js` | `@cyanheads/mcp-ts-core/tools` (types only: `ToolDefinition`, `AnyToolDefinition`) or `@cyanheads/mcp-ts-core` (for the `tool()` builder) |
|
|
56
|
-
| `@/mcp-server/resources/utils/resourceDefinition.js` | `@cyanheads/mcp-ts-core/resources` (types only: `ResourceDefinition`, `AnyResourceDefinition`) or `@cyanheads/mcp-ts-core` (for the `resource()` builder) |
|
|
57
|
-
| `@/mcp-server/prompts/utils/promptDefinition.js` | `@cyanheads/mcp-ts-core/prompts` (types only: `PromptDefinition`) or `@cyanheads/mcp-ts-core` (for the `prompt()` builder) |
|
|
58
|
-
| `@/mcp-server/tasks/utils/taskToolDefinition.js` | `@cyanheads/mcp-ts-core/tasks` |
|
|
59
|
-
|
|
60
|
-
### Utils
|
|
61
|
-
|
|
62
|
-
| Old `@/` import | New package import |
|
|
63
|
-
|:----------------|:-------------------|
|
|
64
|
-
| `@/utils/internal/logger.js` | `@cyanheads/mcp-ts-core/utils` |
|
|
65
|
-
| `@/utils/internal/requestContext.js` | `@cyanheads/mcp-ts-core/utils` |
|
|
66
|
-
| `@/utils/internal/error-handler/errorHandler.js` | `@cyanheads/mcp-ts-core/utils` |
|
|
67
|
-
| `@/utils/internal/runtime.js` | `@cyanheads/mcp-ts-core/utils` |
|
|
68
|
-
| `@/utils/internal/encoding.js` | `@cyanheads/mcp-ts-core/utils` |
|
|
69
|
-
| `@/utils/formatting/*.js` | `@cyanheads/mcp-ts-core/utils` |
|
|
70
|
-
| `@/utils/parsing/*.js` | `@cyanheads/mcp-ts-core/utils` |
|
|
71
|
-
| `@/utils/security/*.js` | `@cyanheads/mcp-ts-core/utils` |
|
|
72
|
-
| `@/utils/network/*.js` | `@cyanheads/mcp-ts-core/utils` |
|
|
73
|
-
| `@/utils/pagination/pagination.js` | `@cyanheads/mcp-ts-core/utils` |
|
|
74
|
-
| `@/utils/types/guards.js` | `@cyanheads/mcp-ts-core/utils` |
|
|
75
|
-
| `@/utils/scheduling/*.js` | `@cyanheads/mcp-ts-core/utils` |
|
|
76
|
-
| `@/utils/telemetry/*.js` | `@cyanheads/mcp-ts-core/utils` |
|
|
77
|
-
| `@/utils/metrics/*.js` | `@cyanheads/mcp-ts-core/utils` |
|
|
78
|
-
|
|
79
|
-
### Services
|
|
80
|
-
|
|
81
|
-
| Old `@/` import | New package import |
|
|
82
|
-
|:----------------|:-------------------|
|
|
83
|
-
| `@/services/llm/*.js` | `@cyanheads/mcp-ts-core/services` |
|
|
84
|
-
| `@/services/speech/*.js` | `@cyanheads/mcp-ts-core/services` |
|
|
85
|
-
| `@/services/graph/*.js` | `@cyanheads/mcp-ts-core/services` |
|
|
86
|
-
|
|
87
|
-
## Framework file candidates
|
|
88
|
-
|
|
89
|
-
After rewriting imports, these directories and files are candidates for cleanup — they contain framework code now provided by the package. **Review each before acting**: the server may have added custom files alongside framework code in any of these directories. Preserve anything server-specific.
|
|
90
|
-
|
|
91
|
-
**Preserve:** server-specific code under `mcp-server/tools/definitions/`, `mcp-server/resources/definitions/`, `mcp-server/prompts/definitions/`, the server's own `services/`, and `config/server-config.ts`.
|
|
92
|
-
|
|
93
|
-
A file is server-specific if it doesn't appear in the `mcp-ts-template` repo at its path. Modified framework files should be extracted to a server-specific location (e.g., `src/utils/my-project/`) before deletion.
|
|
94
|
-
|
|
95
|
-
Framework directories (typically safe to remove in full — verify no server-specific files were added):
|
|
96
|
-
|
|
97
|
-
- `src/core/` (app, context, worker)
|
|
98
|
-
- `src/cli/`
|
|
99
|
-
- `src/types-global/`
|
|
100
|
-
- `src/storage/`
|
|
101
|
-
- `src/utils/`
|
|
102
|
-
- `src/testing/`
|
|
103
|
-
- `src/services/llm/`, `src/services/speech/`, `src/services/graph/` (framework-provided services — the server's own service directories are separate)
|
|
104
|
-
|
|
105
|
-
Framework files within directories that contain server code:
|
|
106
|
-
|
|
107
|
-
- `src/config/index.ts` (the framework config loader — `server-config.ts` is server-specific, keep it)
|
|
108
|
-
- `src/mcp-server/server.ts`
|
|
109
|
-
- `src/mcp-server/transports/` (entire directory)
|
|
110
|
-
- `src/mcp-server/roots/` (entire directory)
|
|
111
|
-
- `src/mcp-server/tasks/` (core task infra — tool definitions using `task: true` are server code)
|
|
112
|
-
- `src/mcp-server/tools/utils/`, `src/mcp-server/tools/tool-registration.ts`
|
|
113
|
-
- `src/mcp-server/resources/utils/`, `src/mcp-server/resources/resource-registration.ts`
|
|
114
|
-
- `src/mcp-server/prompts/utils/`, `src/mcp-server/prompts/prompt-registration.ts`
|
|
115
|
-
|
|
116
|
-
## Entry point rewrite
|
|
117
|
-
|
|
118
|
-
Rewrite the `createApp()` call and its surrounding imports to use the package. Preserve the project's existing barrel structure and registration pattern if present:
|
|
119
|
-
|
|
120
|
-
```ts
|
|
121
|
-
#!/usr/bin/env node
|
|
122
|
-
import { createApp } from '@cyanheads/mcp-ts-core';
|
|
123
|
-
import { echoTool } from './mcp-server/tools/definitions/echo.tool.js';
|
|
124
|
-
import { echoResource } from './mcp-server/resources/definitions/echo.resource.js';
|
|
125
|
-
import { echoPrompt } from './mcp-server/prompts/definitions/echo.prompt.js';
|
|
126
|
-
|
|
127
|
-
await createApp({
|
|
128
|
-
tools: [echoTool],
|
|
129
|
-
resources: [echoResource],
|
|
130
|
-
prompts: [echoPrompt],
|
|
131
|
-
});
|
|
132
|
-
```
|
|
133
|
-
|
|
134
|
-
Add `setup()` if the server initializes services:
|
|
135
|
-
|
|
136
|
-
```ts
|
|
137
|
-
await createApp({
|
|
138
|
-
tools: [echoTool],
|
|
139
|
-
resources: [echoResource],
|
|
140
|
-
prompts: [echoPrompt],
|
|
141
|
-
setup(core) {
|
|
142
|
-
initMyService(core.config, core.storage);
|
|
143
|
-
},
|
|
144
|
-
});
|
|
145
|
-
```
|
|
146
|
-
|
|
147
|
-
If the migrated project already has `definitions/index.ts` barrels and you want to keep them, that is fine. The important part is removing imports from framework internals and registering definitions consistently.
|
|
148
|
-
|
|
149
|
-
## Checklist
|
|
150
|
-
|
|
151
|
-
- [ ] `@cyanheads/mcp-ts-core` installed as a dependency
|
|
152
|
-
- [ ] All framework `@/` imports rewritten to `@cyanheads/mcp-ts-core/*` subpaths
|
|
153
|
-
- [ ] No `@/` imports point to framework files that are no longer local
|
|
154
|
-
- [ ] `src/index.ts` uses `createApp()` from the package
|
|
155
|
-
- [ ] `tsconfig.json` extends `@cyanheads/mcp-ts-core/tsconfig.base.json`
|
|
156
|
-
- [ ] `biome.json` extends `@cyanheads/mcp-ts-core/biome`
|
|
157
|
-
- [ ] `vitest.config.ts` spreads from `@cyanheads/mcp-ts-core/vitest.config`
|
|
158
|
-
- [ ] Framework-only directories removed (`src/core/`, `src/cli/`, `src/types-global/`, `src/storage/`, `src/utils/`, `src/testing/`, framework service subdirs)
|
|
159
|
-
- [ ] Framework files within mixed directories removed (`server.ts`, `transports/`, `roots/`, tasks infra, `*/utils/` dirs, `*-registration.ts` files)
|
|
160
|
-
- [ ] `vitest.config.ts` includes `@/` alias: `resolve: { alias: { '@/': new URL('./src/', import.meta.url).pathname } }`
|
|
161
|
-
- [ ] Server-specific `@/` imports (own tools, services) still work
|
|
162
|
-
- [ ] `bun run devcheck` passes
|