Agent skill
migrate-mcp-ts-template
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.
Install this agent skill to your Project
npx add-skill https://github.com/cyanheads/mcp-ts-core/tree/main/skills/migrate-mcp-ts-template
Metadata
Additional technical details for this skill
- type
- workflow
- author
- cyanheads
- version
- 2.2
- audience
- external
SKILL.md
Context
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.
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.
For the full exports catalog, see CLAUDE.md → Exports Reference.
Steps
- Install the package:
bun add @cyanheads/mcp-ts-core - Search for all
@/imports acrosssrc/that reference framework internals - Rewrite each import using the mapping table below
- Identify framework source files now provided by the package (see candidates below) — review each for server-specific additions before cleaning up
- Update entry point (
src/index.ts) to usecreateApp()from the package and the project's chosen registration pattern (fresh scaffold default: direct imports insrc/index.ts) - Update build configs:
tsconfig.jsonextends@cyanheads/mcp-ts-core/tsconfig.base.jsonbiome.jsonextends@cyanheads/mcp-ts-core/biomevitest.config.tsspreads from@cyanheads/mcp-ts-core/vitest.config
- Run
bun run devcheckto verify no broken imports remain - Verify no
@/imports point to framework files that are no longer local
Import mapping
These are the actual @/ import paths used in framework source. Rewrite any that appear in server-specific files (tools, resources, services, config).
Core
Old @/ import |
New package import |
|---|---|
@/config/index.js |
@cyanheads/mcp-ts-core/config |
@/context.js or @/core/context.js |
@cyanheads/mcp-ts-core |
@/core/worker.js |
@cyanheads/mcp-ts-core/worker |
@/types-global/errors.js |
@cyanheads/mcp-ts-core/errors |
@/storage/core/StorageService.js |
@cyanheads/mcp-ts-core/storage |
@/storage/core/IStorageProvider.js |
@cyanheads/mcp-ts-core/storage/types |
@/mcp-server/transports/auth/lib/checkScopes.js |
@cyanheads/mcp-ts-core/auth |
@/testing/index.js |
@cyanheads/mcp-ts-core/testing |
Definition types
Old @/ import |
New package import |
|---|---|
@/mcp-server/tools/utils/toolDefinition.js |
@cyanheads/mcp-ts-core/tools or @cyanheads/mcp-ts-core (for tool() builder) |
@/mcp-server/resources/utils/resourceDefinition.js |
@cyanheads/mcp-ts-core/resources or @cyanheads/mcp-ts-core (for resource() builder) |
@/mcp-server/prompts/utils/promptDefinition.js |
@cyanheads/mcp-ts-core/prompts or @cyanheads/mcp-ts-core (for prompt() builder) |
@/mcp-server/tasks/utils/taskToolDefinition.js |
@cyanheads/mcp-ts-core/tasks |
Utils
Old @/ import |
New package import |
|---|---|
@/utils/internal/logger.js |
@cyanheads/mcp-ts-core/utils |
@/utils/internal/requestContext.js |
@cyanheads/mcp-ts-core/utils |
@/utils/internal/error-handler/errorHandler.js |
@cyanheads/mcp-ts-core/utils |
@/utils/internal/runtime.js |
@cyanheads/mcp-ts-core/utils |
@/utils/internal/encoding.js |
@cyanheads/mcp-ts-core/utils |
@/utils/formatting/*.js |
@cyanheads/mcp-ts-core/utils |
@/utils/parsing/*.js |
@cyanheads/mcp-ts-core/utils |
@/utils/security/*.js |
@cyanheads/mcp-ts-core/utils |
@/utils/network/*.js |
@cyanheads/mcp-ts-core/utils |
@/utils/pagination/pagination.js |
@cyanheads/mcp-ts-core/utils |
@/utils/types/guards.js |
@cyanheads/mcp-ts-core/utils |
@/utils/scheduling/*.js |
@cyanheads/mcp-ts-core/utils |
@/utils/telemetry/*.js |
@cyanheads/mcp-ts-core/utils |
@/utils/metrics/*.js |
@cyanheads/mcp-ts-core/utils |
Services
Old @/ import |
New package import |
|---|---|
@/services/llm/*.js |
@cyanheads/mcp-ts-core/services |
@/services/speech/*.js |
@cyanheads/mcp-ts-core/services |
@/services/graph/*.js |
@cyanheads/mcp-ts-core/services |
Framework file candidates
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.
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.
Framework directories (typically safe to clean up in full — verify no server-specific files were added):
src/core/(app, context, worker)src/cli/src/types-global/src/storage/src/utils/src/testing/src/services/llm/,src/services/speech/,src/services/graph/(framework-provided services — the server's own service directories are separate)
Framework files within directories that contain server code:
src/config/index.ts(the framework config loader —server-config.tsis server-specific, keep it)src/mcp-server/server.tssrc/mcp-server/transports/(entire directory)src/mcp-server/roots/(entire directory)src/mcp-server/tasks/(core task infra — tool definitions usingtask: trueare server code)src/mcp-server/tools/utils/,src/mcp-server/tools/tool-registration.tssrc/mcp-server/resources/utils/,src/mcp-server/resources/resource-registration.tssrc/mcp-server/prompts/utils/,src/mcp-server/prompts/prompt-registration.ts
Entry point rewrite
Replace the fork's src/index.ts with the scaffold-default direct-registration pattern:
#!/usr/bin/env node
import { createApp } from '@cyanheads/mcp-ts-core';
import { echoTool } from './mcp-server/tools/definitions/echo.tool.js';
import { echoResource } from './mcp-server/resources/definitions/echo.resource.js';
import { echoPrompt } from './mcp-server/prompts/definitions/echo.prompt.js';
await createApp({
tools: [echoTool],
resources: [echoResource],
prompts: [echoPrompt],
});
Add setup() if the server initializes services:
await createApp({
tools: [echoTool],
resources: [echoResource],
prompts: [echoPrompt],
setup(core) {
initMyService(core.config, core.storage);
},
});
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.
Checklist
-
@cyanheads/mcp-ts-coreinstalled as a dependency - All framework
@/imports rewritten to@cyanheads/mcp-ts-core/*subpaths - No
@/imports point to framework files that are no longer local -
src/index.tsusescreateApp()from the package -
tsconfig.jsonextends@cyanheads/mcp-ts-core/tsconfig.base.json -
biome.jsonextends@cyanheads/mcp-ts-core/biome -
vitest.config.tsspreads from@cyanheads/mcp-ts-core/vitest.config - Framework source files cleaned up from
src/ - Server-specific
@/imports (own tools, services) still work -
bun run devcheckpasses
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
add-resource
Scaffold a new MCP resource definition. Use when the user asks to add a resource, expose data via URI, or create a readable endpoint.
field-test
Exercise tools, resources, and prompts with real-world inputs to verify behavior end-to-end. Use after adding or modifying definitions, or when the user asks to test, try out, or verify their MCP surface. Calls each definition with realistic and adversarial inputs and produces a report of issues, pain points, and recommendations.
release
Verify release readiness and publish. The git wrapup protocol handles version bumps, changelog, README, commits, and tagging during the coding session. This skill verifies nothing was missed, runs final checks, and presents the irreversible publish commands.
add-export
Add a new subpath export to the @cyanheads/mcp-ts-core package. Use when creating a new public API surface that consumers import from a dedicated subpath (e.g., @cyanheads/mcp-ts-core/newutil).
api-errors
McpError constructor, JsonRpcErrorCode reference, and error handling patterns for `@cyanheads/mcp-ts-core`. Use when looking up error codes, understanding where errors should be thrown vs. caught, or using ErrorHandler.tryCatch in services.
api-utils
API reference for all utilities exported from `@cyanheads/mcp-ts-core/utils`. Use when looking up utility method signatures, options, peer dependencies, or usage patterns.
Didn't find tool you were looking for?