-
Notifications
You must be signed in to change notification settings - Fork 2.4k
fix: update MCP provider to support AI SDK v5 with specification vers… #1486
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: next
Are you sure you want to change the base?
Conversation
…ion v2 - Create new TypeScript package @tm/ai-sdk-provider-mcp-sampling - Implement LanguageModelV2 interface with v2 specification - Update mcp-server to use new AI SDK v5 compatible provider - Fix error: "AI SDK 5 only supports models that implement specification version 'v2'" Closes #1449 Co-authored-by: Ralph Khreish <[email protected]>
|
WalkthroughA new MCP Sampling AI SDK v5 provider package is introduced to replace the v1-based provider. The change includes a complete provider implementation that generates and streams language model responses via MCP sessions, with proper v2 specification compliance, error handling, message format conversion, and JSON extraction utilities. The existing mcp-provider.js is updated to use this new provider. Changes
Sequence Diagram(s)sequenceDiagram
participant Client as AI SDK<br/>v5 Client
participant Provider as MCP Sampling<br/>Provider
participant LM as Language Model
participant Session as MCP<br/>Session
participant Converter as Message<br/>Converter
Client->>Provider: createMCPSampling(session)
Provider->>LM: validate & construct
Client->>LM: doGenerate(callOptions)
LM->>Converter: convertToMCPFormat(prompt)
Converter-->>LM: { messages, systemPrompt }
LM->>Session: requestSampling(request)
Session-->>LM: { content, usage, stopReason }
LM->>LM: extractJson (if mode=object-json)
LM->>Converter: convertFromMCPFormat(response)
Converter-->>LM: MCPSamplingResponse
LM-->>Client: LanguageModelV2CallResult
Note over LM,Session: For doStream():
LM->>LM: calls doGenerate() internally
LM-->>Client: ReadableStream (chunks text)
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes
Suggested reviewers
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (8)
packages/ai-sdk-provider-mcp-sampling/package.json (1)
1-33: Align internal package metadata with existing tm package conventionsThe export/entrypoint pattern (
typesto src,mainto dist,exportsto src) matches the existing internal packages, which is good. Two small alignment points to consider:
- For internal/private packages, prior work has generally omitted the
versionfield entirely instead of setting it to an empty string. Dropping"version": ""will better match that pattern and avoid confusing tooling that expects a semantic version.- Confirm that using the scoped name
@tm/ai-sdk-provider-mcp-samplingfits with your existing internal import/bundling conventions (earlier packages andnoExternalrules referred totm/*imports). If the rest of the repo still assumestm/*, you may want to standardize either this name or the build config to keep things consistent. Based on learnings, internal tm packages have historically usedtm/*naming.packages/ai-sdk-provider-mcp-sampling/src/errors.ts (1)
59-103: Normalize error messages once in mapMCPError to make matching more robustThe mapping logic is good, but the substring checks are currently case-sensitive and repeatedly call
error.message.includes(...). Normalizing once improves robustness and readability.You could refactor like this:
- if (error instanceof Error) { - // Map common MCP errors to appropriate AI SDK errors - if (error.message.includes('unauthorized') || - error.message.includes('authentication')) { + if (error instanceof Error) { + const lowerMessage = error.message.toLowerCase(); + + // Map common MCP errors to appropriate AI SDK errors + if (lowerMessage.includes('unauthorized') || + lowerMessage.includes('authentication')) { return createMCPAuthenticationError({ message: `MCP authentication failed: ${error.message}`, cause: error }); } - if (error.message.includes('timeout') || - error.message.includes('timed out')) { + if (lowerMessage.includes('timeout') || + lowerMessage.includes('timed out')) { return createMCPAPICallError({ message: `MCP request timed out: ${error.message}`, cause: error, isRetryable: true }); } - if (error.message.includes('model') && - error.message.includes('not found')) { + if (lowerMessage.includes('model') && + lowerMessage.includes('not found')) { return new NoSuchModelError({ modelId: 'unknown', modelType: 'languageModel' }); }This keeps the user-facing messages unchanged while making detection more reliable.
packages/ai-sdk-provider-mcp-sampling/src/message-converter.ts (1)
24-52: Reuse content-flattening for all roles (including system) in convertToMCPFormat
convertToMCPFormatcurrently assumessystemmessages have string content and uses a separate code path from user/assistant. To handle array-based content consistently (and avoid type friction), you can normalize content once per message and then branch only on role:- for (const message of prompt) { - if (message.role === 'system') { - // MCP handles system messages separately - systemPrompt = message.content; - } else if (message.role === 'user' || message.role === 'assistant') { - // Convert content array to string - let content = ''; - if (typeof message.content === 'string') { - content = message.content; - } else if (Array.isArray(message.content)) { - content = message.content - .map((part) => { - if (part.type === 'text') { - return part.text; - } - // Skip non-text content for now (images, etc.) - return ''; - }) - .join(''); - } - - messages.push({ - role: message.role, - content - }); - } - } + for (const message of prompt) { + // Normalize content into a single string + let content = ''; + if (typeof message.content === 'string') { + content = message.content; + } else if (Array.isArray(message.content)) { + content = message.content + .map((part) => (part.type === 'text' ? part.text : '')) + .join(''); + } + + if (message.role === 'system') { + // MCP handles system messages separately + systemPrompt = content; + } else if (message.role === 'user' || message.role === 'assistant') { + messages.push({ + role: message.role, + content + }); + } + }You might also consider extracting this normalization into a small helper and reusing it in
createPromptFromMessagesto avoid duplicating the content-flattening logic.Also applies to: 103-124
packages/ai-sdk-provider-mcp-sampling/README.md (1)
1-64: Documentation looks comprehensive and well-structured.The README provides clear usage examples, feature list, and error handling documentation that aligns with the implementation. One minor grammar fix per static analysis:
-This package provides an AI SDK v5 compatible provider for using MCP sampling capabilities within Task Master. +This package provides an AI SDK v5-compatible provider for using MCP sampling capabilities within Task Master.packages/ai-sdk-provider-mcp-sampling/src/json-extractor.ts (2)
22-26: Redundant regex pattern.The marker match on line 23 is a subset of the code block match on line 17 (which already handles
(?:json)?). This block will never execute since line 17-20 handles all```code blocks including those withjson.- // Try to find JSON between specific markers - const markerMatch = trimmedText.match(/```json\s*([\s\S]*?)\s*```/i); - if (markerMatch) { - return markerMatch[1].trim(); - }
29-30: Greedy regex may produce incorrect matches for nested or multiple JSON structures.The patterns
\{[\s\S]*\}and\[[\s\S]*\]are greedy and will match from the first{or[to the last}or]in the entire text. This can cause issues with:
- Text containing multiple separate JSON objects
- Narrative text surrounding a JSON block
Consider using a non-greedy approach or iterating to find balanced brackets:
- const jsonObjectMatch = trimmedText.match(/\{[\s\S]*\}/); - const jsonArrayMatch = trimmedText.match(/\[[\s\S]*\]/); + const jsonObjectMatch = trimmedText.match(/\{[\s\S]*?\}/); + const jsonArrayMatch = trimmedText.match(/\[[\s\S]*?\]/);However, non-greedy won't handle nested structures either. A more robust approach would be to find the first
{or[and then walk forward to find the matching closing bracket while counting nesting depth.packages/ai-sdk-provider-mcp-sampling/src/mcp-sampling-language-model.ts (2)
162-171: Type guard can be simplified.The inline type guard with
anycast is functional but verbose. Consider extracting it or using a simpler check:- const isObjectJson = ( - o: unknown - ): o is { mode: { type: 'object-json' } } => - !!o && - typeof o === 'object' && - 'mode' in o && - (o as any).mode?.type === 'object-json'; - if (isObjectJson(options) && text) { + const mode = (options as { mode?: { type?: string } }).mode; + if (mode?.type === 'object-json' && text) { text = extractJson(text); }
270-305: Non-null assertion is safe but fragile.The
textPartId!assertion at line 291 is currently safe because the loop only runs whentext.length > 0, which is the same condition under whichtextPartIdis assigned. However, this relies on implicit control flow coupling.Consider restructuring to make the safety explicit:
- let textPartId: string | undefined; - - // Emit text-start if we have content - if (text.length > 0) { - textPartId = generateId(); + if (text.length > 0) { + const textPartId = generateId(); controller.enqueue({ type: 'text-start', id: textPartId }); - } - - for (let i = 0; i < text.length; i += chunkSize) { + for (let i = 0; i < text.length; i += chunkSize) { // Check for abort during streaming if (options.abortSignal?.aborted) { throw options.abortSignal.reason || new Error('Request aborted'); } - const chunk = text.slice(i, i + chunkSize); controller.enqueue({ type: 'text-delta', - id: textPartId!, + id: textPartId, delta: chunk }); - // Add small delay to simulate streaming await new Promise((resolve) => setTimeout(resolve, 20)); } - - // Close text part if opened - if (textPartId) { controller.enqueue({ type: 'text-end', id: textPartId }); }
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (13)
mcp-server/src/providers/mcp-provider.js(2 hunks)packages/ai-sdk-provider-mcp-sampling/CHANGELOG.md(1 hunks)packages/ai-sdk-provider-mcp-sampling/README.md(1 hunks)packages/ai-sdk-provider-mcp-sampling/package.json(1 hunks)packages/ai-sdk-provider-mcp-sampling/src/errors.ts(1 hunks)packages/ai-sdk-provider-mcp-sampling/src/index.ts(1 hunks)packages/ai-sdk-provider-mcp-sampling/src/json-extractor.ts(1 hunks)packages/ai-sdk-provider-mcp-sampling/src/mcp-sampling-language-model.ts(1 hunks)packages/ai-sdk-provider-mcp-sampling/src/mcp-sampling-provider.ts(1 hunks)packages/ai-sdk-provider-mcp-sampling/src/message-converter.ts(1 hunks)packages/ai-sdk-provider-mcp-sampling/src/types.ts(1 hunks)packages/ai-sdk-provider-mcp-sampling/tsconfig.json(1 hunks)test-mcp-v2.js(1 hunks)
🧰 Additional context used
📓 Path-based instructions (8)
**/*.md
📄 CodeRabbit inference engine (.cursor/rules/ai_providers.mdc)
Update relevant documentation (like
README.md) mentioning supported providers or configuration when adding a new AI provider
Files:
packages/ai-sdk-provider-mcp-sampling/CHANGELOG.mdpackages/ai-sdk-provider-mcp-sampling/README.md
**/*.ts
📄 CodeRabbit inference engine (.cursor/rules/test_workflow.mdc)
TypeScript test files must achieve minimum code coverage thresholds: 80% lines/functions and 70% branches globally, 90% for utilities, and 85% for middleware; new features must meet or exceed these thresholds
Files:
packages/ai-sdk-provider-mcp-sampling/src/json-extractor.tspackages/ai-sdk-provider-mcp-sampling/src/mcp-sampling-provider.tspackages/ai-sdk-provider-mcp-sampling/src/errors.tspackages/ai-sdk-provider-mcp-sampling/src/index.tspackages/ai-sdk-provider-mcp-sampling/src/types.tspackages/ai-sdk-provider-mcp-sampling/src/message-converter.tspackages/ai-sdk-provider-mcp-sampling/src/mcp-sampling-language-model.ts
**/*.{js,ts}
📄 CodeRabbit inference engine (.cursor/rules/utilities.mdc)
**/*.{js,ts}: Import and use specific getters from config-manager.js (e.g., getMainProvider(), getLogLevel(), getMainMaxTokens()) to access configuration values needed for application logic
Use isApiKeySet(providerName, session) from config-manager.js to check if a provider's key is available before potentially attempting an AI call
Do not add direct console.log calls outside the logging utility - use the central log function instead
Ensure silent mode is disabled in a finally block to prevent it from staying enabled
Do not access the global silentMode variable directly - use the exported silent mode control functions instead
Do not duplicate task ID formatting logic across modules - centralize formatting utilities
Use ContextGatherer class from utils/contextGatherer.js for AI-powered commands that need project context, supporting tasks, files, custom text, and project tree context
Use FuzzyTaskSearch class from utils/fuzzyTaskSearch.js for automatic task relevance detection with configurable search parameters
Use fuzzy search to supplement user-provided task IDs and display discovered task IDs to users for transparency
Do not replace explicit user task selections with fuzzy results - fuzzy search should supplement, not replace user selections
Use readJSON and writeJSON utilities for all JSON file operations instead of raw fs.readFileSync or fs.writeFileSync
Include error handling for JSON file operations and validate JSON structure after reading
Use path.join() for cross-platform path construction and path.resolve() for absolute paths, validating paths before file operations
Support both .env files and MCP session environment for environment variable resolution with fallbacks for missing values
Prefer updating the core function to accept an outputFormat parameter and check outputFormat === 'json' before displaying UI elements
Files:
packages/ai-sdk-provider-mcp-sampling/src/json-extractor.tspackages/ai-sdk-provider-mcp-sampling/src/mcp-sampling-provider.tspackages/ai-sdk-provider-mcp-sampling/src/errors.tstest-mcp-v2.jspackages/ai-sdk-provider-mcp-sampling/src/index.tspackages/ai-sdk-provider-mcp-sampling/src/types.tspackages/ai-sdk-provider-mcp-sampling/src/message-converter.tspackages/ai-sdk-provider-mcp-sampling/src/mcp-sampling-language-model.tsmcp-server/src/providers/mcp-provider.js
**/*.{ts,tsx}
📄 CodeRabbit inference engine (CLAUDE.md)
Import modules with
.jsextension even in TypeScript source files for ESM compatibility
Files:
packages/ai-sdk-provider-mcp-sampling/src/json-extractor.tspackages/ai-sdk-provider-mcp-sampling/src/mcp-sampling-provider.tspackages/ai-sdk-provider-mcp-sampling/src/errors.tspackages/ai-sdk-provider-mcp-sampling/src/index.tspackages/ai-sdk-provider-mcp-sampling/src/types.tspackages/ai-sdk-provider-mcp-sampling/src/message-converter.tspackages/ai-sdk-provider-mcp-sampling/src/mcp-sampling-language-model.ts
**/*.js
📄 CodeRabbit inference engine (.cursor/rules/architecture.mdc)
**/*.js: Always use isSilentMode() function to check current silent mode status instead of directly accessing the global silentMode variable or global.silentMode
Use try/finally block pattern when wrapping core function calls with enableSilentMode/disableSilentMode to ensure silent mode is always restored, even if errors occur
For functions that need to handle both a passed silentMode parameter and check global state, check both the function parameter and global state: const isSilent = options.silentMode || (typeof options.silentMode === 'undefined' && isSilentMode())
Functions should accept their dependencies as parameters rather than using globals to promote testability and explicit dependency injection
Define callbacks as separate functions for easier testing rather than inline functions
Files:
test-mcp-v2.jsmcp-server/src/providers/mcp-provider.js
**/*.{js,jsx}
📄 CodeRabbit inference engine (.cursor/rules/test_workflow.mdc)
JavaScript test files using Jest must follow the same testing patterns as TypeScript files, include proper mocking of external dependencies, and achieve the same coverage thresholds
Files:
test-mcp-v2.jsmcp-server/src/providers/mcp-provider.js
mcp-server/src/**/*.js
📄 CodeRabbit inference engine (.cursor/rules/mcp.mdc)
mcp-server/src/**/*.js: Use kebab-case for all file names in the MCP server structure (e.g., list-tasks.js, set-task-status.js)
Log the start of execution with sanitized arguments, log successful completion with result summary including cache status, and log all error conditions with appropriate log levels
Do not log entire large data structures or sensitive information in direct functions and tools
Files:
mcp-server/src/providers/mcp-provider.js
mcp-server/src/**/*.{js,ts}
📄 CodeRabbit inference engine (.cursor/rules/utilities.mdc)
mcp-server/src/**/*.{js,ts}: Use the logger wrapper pattern when passing loggers to prevent mcpLog[level] is not a function errors, wrapping FastMCP's log object with standard methods
Use normalizeProjectRoot(rawPath, log) to take a raw project root path (potentially URI encoded, with file:// prefix) and return a normalized, absolute path
Use createContentResponse(content) and createErrorResponse(errorMessage) helper functions to create basic MCP response structures
Use createLogWrapper(log) to create a logger object wrapper with standard methods mapping to the passed MCP log object's methods
Files:
mcp-server/src/providers/mcp-provider.js
🧠 Learnings (58)
📓 Common learnings
Learnt from: Crunchyman-ralph
Repo: eyaltoledano/claude-task-master PR: 1002
File: .changeset/puny-friends-give.md:2-3
Timestamp: 2025-07-17T21:33:57.585Z
Learning: In the eyaltoledano/claude-task-master repository, the MCP server code in mcp-server/src/ is part of the main "task-master-ai" package, not a separate "mcp-server" package. When creating changesets for MCP server changes, use "task-master-ai" as the package name.
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: .cursor/rules/ai_providers.mdc:0-0
Timestamp: 2025-11-24T17:57:14.743Z
Learning: To add a new AI provider with official Vercel AI SDK support, install the provider package via `npm install ai-sdk/<provider-name>`
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: .cursor/rules/ai_providers.mdc:0-0
Timestamp: 2025-11-24T17:57:14.743Z
Learning: Applies to src/ai-providers/*.js : Create a new provider module in `src/ai-providers/<provider-name>.js` that implements `generate<ProviderName>Text`, `stream<ProviderName>Text`, and `generate<ProviderName>Object` functions using the Vercel AI SDK
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: .cursor/rules/dev_workflow.mdc:0-0
Timestamp: 2025-11-24T18:00:06.827Z
Learning: Interacting via MCP server is the preferred method for AI agents and integrated development environments over CLI usage
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: .cursor/rules/ai_providers.mdc:0-0
Timestamp: 2025-11-24T17:57:14.743Z
Learning: Applies to scripts/modules/config-manager.js : In `scripts/modules/config-manager.js`, update `MODEL_MAP` to include the new provider, ensure `VALID_PROVIDERS` includes the provider, update API key handling in `keyMap` and the `switch` statement in `getMcpApiKeyStatus` and `isApiKeySet`
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: .cursor/rules/architecture.mdc:0-0
Timestamp: 2025-11-24T17:58:07.992Z
Learning: Applies to src/ai-providers/*.js : src/ai-providers/*.js files should contain provider-specific wrappers for Vercel AI SDK functions and interact directly with Vercel AI SDK adapters
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: .cursor/rules/ai_providers.mdc:0-0
Timestamp: 2025-11-24T17:57:14.743Z
Learning: Applies to scripts/modules/ai-services-unified.js : In `scripts/modules/ai-services-unified.js`, import new providers and add entries to the `PROVIDER_FUNCTIONS` map with `generateText`, `streamText`, and `generateObject` properties
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: .cursor/rules/mcp.mdc:0-0
Timestamp: 2025-11-24T18:01:06.077Z
Learning: Applies to mcp-server/src/tools/*.js : Access API keys for AI services via the session.env object in the MCP context rather than reading environment variables directly
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: .cursor/rules/ai_providers.mdc:0-0
Timestamp: 2025-11-24T17:57:14.743Z
Learning: Applies to src/ai-providers/*.js : Provider modules in `src/ai-providers/` must import `generateText`, `streamText`, `generateObject` from the `ai` package, the provider's `create<ProviderName>` function from `ai-sdk/<provider-name>`, and the `log` utility from `../../scripts/modules/utils.js`
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: .cursor/rules/ai_providers.mdc:0-0
Timestamp: 2025-11-24T17:57:14.743Z
Learning: Applies to tests/unit/ai-providers/*.test.js : Create unit tests in `tests/unit/ai-providers/<provider-name>.test.js` that mock the provider's AI SDK module and test each exported function for correct client instantiation, parameter passing, result handling, and error handling
Learnt from: Crunchyman-ralph
Repo: eyaltoledano/claude-task-master PR: 1178
File: packages/tm-core/src/auth/config.ts:5-7
Timestamp: 2025-09-02T21:51:27.921Z
Learning: The user Crunchyman-ralph prefers not to use node: scheme imports (e.g., 'node:os', 'node:path') for Node.js core modules and considers suggestions to change bare imports to node: scheme as too nitpicky.
Learnt from: Crunchyman-ralph
Repo: eyaltoledano/claude-task-master PR: 1069
File: .changeset/fix-tag-complexity-detection.md:0-0
Timestamp: 2025-08-02T15:33:22.656Z
Learning: For changeset files (.changeset/*.md), Crunchyman-ralph prefers to ignore formatting nitpicks about blank lines between frontmatter and descriptions, as he doesn't mind having them and wants to avoid such comments in future reviews.
Learnt from: Crunchyman-ralph
Repo: eyaltoledano/claude-task-master PR: 1132
File: .github/workflows/weekly-metrics-discord.yml:81-93
Timestamp: 2025-08-13T22:10:46.958Z
Learning: Crunchyman-ralph ignores YAML formatting nitpicks about trailing spaces when there's no project-specific YAML formatter configured, preferring to focus on functionality over cosmetic formatting issues.
Learnt from: Crunchyman-ralph
Repo: eyaltoledano/claude-task-master PR: 1132
File: .github/workflows/weekly-metrics-discord.yml:81-93
Timestamp: 2025-08-13T22:10:46.958Z
Learning: Crunchyman-ralph ignores YAML formatting nitpicks about trailing spaces when there's no project-specific YAML formatter configured, preferring to focus on functionality over cosmetic formatting issues.
Learnt from: Crunchyman-ralph
Repo: eyaltoledano/claude-task-master PR: 1105
File: scripts/modules/supported-models.json:242-254
Timestamp: 2025-08-08T11:33:15.297Z
Learning: Preference: In scripts/modules/supported-models.json, the "name" field is optional. For OpenAI entries (e.g., "gpt-5"), Crunchyman-ralph prefers omitting "name" when the id is explicit enough; avoid nitpicks requesting a "name" in such cases.
Learnt from: Crunchyman-ralph
Repo: eyaltoledano/claude-task-master PR: 1200
File: src/ai-providers/custom-sdk/grok-cli/language-model.js:96-100
Timestamp: 2025-09-19T16:06:42.182Z
Learning: The user Crunchyman-ralph prefers to keep environment variable names explicit (like GROK_CLI_API_KEY) rather than supporting multiple aliases, to avoid overlap and ensure clear separation between different CLI implementations.
Learnt from: Crunchyman-ralph
Repo: eyaltoledano/claude-task-master PR: 1178
File: packages/tm-core/src/subpath-exports.test.ts:6-9
Timestamp: 2025-09-03T12:45:30.724Z
Learning: The user Crunchyman-ralph prefers to avoid overly nitpicky or detailed suggestions in code reviews, especially for test coverage of minor import paths. Focus on more substantial issues rather than comprehensive coverage of all possible edge cases.
Learnt from: Crunchyman-ralph
Repo: eyaltoledano/claude-task-master PR: 1217
File: apps/cli/src/index.ts:16-21
Timestamp: 2025-09-18T16:35:35.147Z
Learning: The user Crunchyman-ralph considers suggestions to export types for better ergonomics (like exporting UpdateInfo type alongside related functions) as nitpicky and prefers not to implement such suggestions.
📚 Learning: 2025-07-17T21:33:57.585Z
Learnt from: Crunchyman-ralph
Repo: eyaltoledano/claude-task-master PR: 1002
File: .changeset/puny-friends-give.md:2-3
Timestamp: 2025-07-17T21:33:57.585Z
Learning: In the eyaltoledano/claude-task-master repository, the MCP server code in mcp-server/src/ is part of the main "task-master-ai" package, not a separate "mcp-server" package. When creating changesets for MCP server changes, use "task-master-ai" as the package name.
Applied to files:
packages/ai-sdk-provider-mcp-sampling/CHANGELOG.mdpackages/ai-sdk-provider-mcp-sampling/README.mdpackages/ai-sdk-provider-mcp-sampling/tsconfig.jsonpackages/ai-sdk-provider-mcp-sampling/package.jsonmcp-server/src/providers/mcp-provider.js
📚 Learning: 2025-11-24T17:57:14.743Z
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: .cursor/rules/ai_providers.mdc:0-0
Timestamp: 2025-11-24T17:57:14.743Z
Learning: To add a new AI provider with official Vercel AI SDK support, install the provider package via `npm install ai-sdk/<provider-name>`
Applied to files:
packages/ai-sdk-provider-mcp-sampling/CHANGELOG.mdpackages/ai-sdk-provider-mcp-sampling/README.mdpackages/ai-sdk-provider-mcp-sampling/src/mcp-sampling-provider.tspackages/ai-sdk-provider-mcp-sampling/package.jsonmcp-server/src/providers/mcp-provider.js
📚 Learning: 2025-11-24T17:57:14.743Z
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: .cursor/rules/ai_providers.mdc:0-0
Timestamp: 2025-11-24T17:57:14.743Z
Learning: Applies to **/*.md : Update relevant documentation (like `README.md`) mentioning supported providers or configuration when adding a new AI provider
Applied to files:
packages/ai-sdk-provider-mcp-sampling/CHANGELOG.mdpackages/ai-sdk-provider-mcp-sampling/README.md
📚 Learning: 2025-11-24T17:57:14.743Z
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: .cursor/rules/ai_providers.mdc:0-0
Timestamp: 2025-11-24T17:57:14.743Z
Learning: Applies to src/ai-providers/*.js : Create a new provider module in `src/ai-providers/<provider-name>.js` that implements `generate<ProviderName>Text`, `stream<ProviderName>Text`, and `generate<ProviderName>Object` functions using the Vercel AI SDK
Applied to files:
packages/ai-sdk-provider-mcp-sampling/CHANGELOG.mdpackages/ai-sdk-provider-mcp-sampling/README.mdpackages/ai-sdk-provider-mcp-sampling/src/mcp-sampling-provider.tspackages/ai-sdk-provider-mcp-sampling/src/index.tspackages/ai-sdk-provider-mcp-sampling/package.jsonpackages/ai-sdk-provider-mcp-sampling/src/mcp-sampling-language-model.tsmcp-server/src/providers/mcp-provider.js
📚 Learning: 2025-11-24T17:58:07.992Z
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: .cursor/rules/architecture.mdc:0-0
Timestamp: 2025-11-24T17:58:07.992Z
Learning: Applies to src/ai-providers/*.js : src/ai-providers/*.js files should contain provider-specific wrappers for Vercel AI SDK functions and interact directly with Vercel AI SDK adapters
Applied to files:
packages/ai-sdk-provider-mcp-sampling/CHANGELOG.mdpackages/ai-sdk-provider-mcp-sampling/README.mdpackages/ai-sdk-provider-mcp-sampling/src/mcp-sampling-provider.tspackages/ai-sdk-provider-mcp-sampling/src/index.tspackages/ai-sdk-provider-mcp-sampling/package.jsonmcp-server/src/providers/mcp-provider.js
📚 Learning: 2025-11-24T17:57:14.743Z
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: .cursor/rules/ai_providers.mdc:0-0
Timestamp: 2025-11-24T17:57:14.743Z
Learning: Applies to tests/unit/ai-providers/*.test.js : Create unit tests in `tests/unit/ai-providers/<provider-name>.test.js` that mock the provider's AI SDK module and test each exported function for correct client instantiation, parameter passing, result handling, and error handling
Applied to files:
packages/ai-sdk-provider-mcp-sampling/CHANGELOG.mdpackages/ai-sdk-provider-mcp-sampling/README.mdpackages/ai-sdk-provider-mcp-sampling/src/mcp-sampling-provider.tstest-mcp-v2.jspackages/ai-sdk-provider-mcp-sampling/src/index.tspackages/ai-sdk-provider-mcp-sampling/package.jsonmcp-server/src/providers/mcp-provider.js
📚 Learning: 2025-11-24T17:57:14.743Z
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: .cursor/rules/ai_providers.mdc:0-0
Timestamp: 2025-11-24T17:57:14.743Z
Learning: Applies to src/ai-providers/*.js : Provider modules in `src/ai-providers/` must import `generateText`, `streamText`, `generateObject` from the `ai` package, the provider's `create<ProviderName>` function from `ai-sdk/<provider-name>`, and the `log` utility from `../../scripts/modules/utils.js`
Applied to files:
packages/ai-sdk-provider-mcp-sampling/CHANGELOG.mdpackages/ai-sdk-provider-mcp-sampling/README.mdpackages/ai-sdk-provider-mcp-sampling/src/json-extractor.tspackages/ai-sdk-provider-mcp-sampling/src/mcp-sampling-provider.tspackages/ai-sdk-provider-mcp-sampling/src/index.tspackages/ai-sdk-provider-mcp-sampling/package.jsonmcp-server/src/providers/mcp-provider.js
📚 Learning: 2025-11-24T22:09:45.455Z
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-11-24T22:09:45.455Z
Learning: Applies to apps/mcp/src/**/*.{ts,tsx} : MCP (tm/mcp) should be a thin presentation layer that calls tm-core methods and returns MCP-formatted responses; handle only MCP-specific concerns like tool schemas, parameter validation, and response formatting
Applied to files:
packages/ai-sdk-provider-mcp-sampling/README.mdpackages/ai-sdk-provider-mcp-sampling/src/errors.tspackages/ai-sdk-provider-mcp-sampling/src/index.tspackages/ai-sdk-provider-mcp-sampling/tsconfig.jsonpackages/ai-sdk-provider-mcp-sampling/src/types.tspackages/ai-sdk-provider-mcp-sampling/package.jsonpackages/ai-sdk-provider-mcp-sampling/src/message-converter.tsmcp-server/src/providers/mcp-provider.js
📚 Learning: 2025-11-24T17:57:14.743Z
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: .cursor/rules/ai_providers.mdc:0-0
Timestamp: 2025-11-24T17:57:14.743Z
Learning: Use the `models` MCP tool or the `task-master models` CLI command to manage AI configurations
Applied to files:
packages/ai-sdk-provider-mcp-sampling/README.md
📚 Learning: 2025-11-24T18:05:23.901Z
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: assets/AGENTS.md:0-0
Timestamp: 2025-11-24T18:05:23.901Z
Learning: Applies to assets/**/.mcp.json : Configure MCP servers in `.mcp.json` with task-master-ai settings and required API key environment variables
Applied to files:
packages/ai-sdk-provider-mcp-sampling/README.md
📚 Learning: 2025-11-24T18:00:32.617Z
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: .cursor/rules/glossary.mdc:0-0
Timestamp: 2025-11-24T18:00:32.617Z
Learning: Refer to mcp.mdc for guidelines on implementing and interacting with the Task Master MCP Server
Applied to files:
packages/ai-sdk-provider-mcp-sampling/README.md
📚 Learning: 2025-11-24T18:04:43.972Z
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: .cursor/rules/utilities.mdc:0-0
Timestamp: 2025-11-24T18:04:43.972Z
Learning: Applies to **/*.{js,ts} : Include error handling for JSON file operations and validate JSON structure after reading
Applied to files:
packages/ai-sdk-provider-mcp-sampling/src/json-extractor.ts
📚 Learning: 2025-11-24T18:04:43.972Z
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: .cursor/rules/utilities.mdc:0-0
Timestamp: 2025-11-24T18:04:43.972Z
Learning: Applies to **/*.{js,ts} : Use readJSON and writeJSON utilities for all JSON file operations instead of raw fs.readFileSync or fs.writeFileSync
Applied to files:
packages/ai-sdk-provider-mcp-sampling/src/json-extractor.ts
📚 Learning: 2025-11-24T18:04:43.972Z
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: .cursor/rules/utilities.mdc:0-0
Timestamp: 2025-11-24T18:04:43.972Z
Learning: Applies to mcp-server/src/tools/**/*.{js,ts} : Use handleApiResult(result, log, errorPrefix, processFunction) to standardize the formatting of responses returned by direct functions into the MCP response format
Applied to files:
packages/ai-sdk-provider-mcp-sampling/src/json-extractor.tspackages/ai-sdk-provider-mcp-sampling/src/errors.tspackages/ai-sdk-provider-mcp-sampling/src/message-converter.ts
📚 Learning: 2025-11-24T18:01:06.077Z
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: .cursor/rules/mcp.mdc:0-0
Timestamp: 2025-11-24T18:01:06.077Z
Learning: Applies to mcp-server/src/tools/*.js : Use createErrorResponse and createContentResponse utilities from tools/utils.js for formatting MCP responses
Applied to files:
packages/ai-sdk-provider-mcp-sampling/src/json-extractor.tspackages/ai-sdk-provider-mcp-sampling/src/errors.tspackages/ai-sdk-provider-mcp-sampling/src/index.tspackages/ai-sdk-provider-mcp-sampling/src/message-converter.ts
📚 Learning: 2025-11-24T18:04:43.972Z
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: .cursor/rules/utilities.mdc:0-0
Timestamp: 2025-11-24T18:04:43.972Z
Learning: Applies to mcp-server/src/**/*.{js,ts} : Use createContentResponse(content) and createErrorResponse(errorMessage) helper functions to create basic MCP response structures
Applied to files:
packages/ai-sdk-provider-mcp-sampling/src/json-extractor.tspackages/ai-sdk-provider-mcp-sampling/src/errors.tspackages/ai-sdk-provider-mcp-sampling/src/index.tspackages/ai-sdk-provider-mcp-sampling/src/message-converter.ts
📚 Learning: 2025-11-24T18:04:43.972Z
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: .cursor/rules/utilities.mdc:0-0
Timestamp: 2025-11-24T18:04:43.972Z
Learning: Applies to mcp-server/src/tools/**/*.{js,ts} : Use processMCPResponseData(taskOrData, fieldsToRemove) utility to filter potentially sensitive or large fields (like details, testStrategy) from task objects before sending responses
Applied to files:
packages/ai-sdk-provider-mcp-sampling/src/json-extractor.tspackages/ai-sdk-provider-mcp-sampling/src/message-converter.ts
📚 Learning: 2025-11-24T17:57:14.743Z
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: .cursor/rules/ai_providers.mdc:0-0
Timestamp: 2025-11-24T17:57:14.743Z
Learning: Applies to scripts/modules/ai-services-unified.js : In `scripts/modules/ai-services-unified.js`, import new providers and add entries to the `PROVIDER_FUNCTIONS` map with `generateText`, `streamText`, and `generateObject` properties
Applied to files:
packages/ai-sdk-provider-mcp-sampling/src/mcp-sampling-provider.tspackages/ai-sdk-provider-mcp-sampling/src/index.ts
📚 Learning: 2025-11-24T18:01:06.077Z
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: .cursor/rules/mcp.mdc:0-0
Timestamp: 2025-11-24T18:01:06.077Z
Learning: Applies to mcp-server/src/core/direct-functions/*.js : Wrap core function calls and AI calls in try/catch blocks, log errors with appropriate severity and context, and return standardized error objects with code and message
Applied to files:
packages/ai-sdk-provider-mcp-sampling/src/errors.ts
📚 Learning: 2025-11-24T18:01:06.077Z
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: .cursor/rules/mcp.mdc:0-0
Timestamp: 2025-11-24T18:01:06.077Z
Learning: Applies to mcp-server/src/core/direct-functions/*.js : Use consistent error codes across direct function wrappers: INPUT_VALIDATION_ERROR for missing/invalid parameters, FILE_NOT_FOUND_ERROR for file system issues, CORE_FUNCTION_ERROR for errors from core functions, and UNEXPECTED_ERROR for other unexpected errors
Applied to files:
packages/ai-sdk-provider-mcp-sampling/src/errors.ts
📚 Learning: 2025-11-24T18:01:06.077Z
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: .cursor/rules/mcp.mdc:0-0
Timestamp: 2025-11-24T18:01:06.077Z
Learning: Applies to mcp-server/src/core/direct-functions/*.js : Direct functions should include telemetryData from core logic involving AI in their successful data payload following the standard pattern from telemetry.mdc
Applied to files:
packages/ai-sdk-provider-mcp-sampling/src/errors.tspackages/ai-sdk-provider-mcp-sampling/src/index.tspackages/ai-sdk-provider-mcp-sampling/src/message-converter.ts
📚 Learning: 2025-11-24T22:09:45.455Z
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-11-24T22:09:45.455Z
Learning: Applies to apps/mcp/**/*.{spec,test}.ts : In unit tests for apps/mcp, mock tm-core responses but use real MCP framework to test response formatting
Applied to files:
test-mcp-v2.jspackages/ai-sdk-provider-mcp-sampling/src/index.tspackages/ai-sdk-provider-mcp-sampling/src/types.tspackages/ai-sdk-provider-mcp-sampling/package.jsonpackages/ai-sdk-provider-mcp-sampling/src/message-converter.ts
📚 Learning: 2025-11-24T17:57:14.743Z
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: .cursor/rules/ai_providers.mdc:0-0
Timestamp: 2025-11-24T17:57:14.743Z
Learning: Applies to scripts/modules/config-manager.js : In `scripts/modules/config-manager.js`, update `MODEL_MAP` to include the new provider, ensure `VALID_PROVIDERS` includes the provider, update API key handling in `keyMap` and the `switch` statement in `getMcpApiKeyStatus` and `isApiKeySet`
Applied to files:
test-mcp-v2.js
📚 Learning: 2025-11-24T18:03:46.713Z
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: .cursor/rules/tests.mdc:0-0
Timestamp: 2025-11-24T18:03:46.713Z
Learning: Applies to **/*.test.js : Do not import or instantiate real AI service clients. Create fully mocked versions that return predictable responses. Mock the entire module with controlled behavior.
Applied to files:
test-mcp-v2.js
📚 Learning: 2025-11-24T17:58:07.992Z
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: .cursor/rules/architecture.mdc:0-0
Timestamp: 2025-11-24T17:58:07.992Z
Learning: New MCP tools should be imported and registered in mcp-server/src/tools/index.js and tool definitions should be added to mcp.json
Applied to files:
test-mcp-v2.jspackages/ai-sdk-provider-mcp-sampling/src/index.tspackages/ai-sdk-provider-mcp-sampling/package.json
📚 Learning: 2025-11-24T18:01:44.169Z
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: .cursor/rules/new_features.mdc:0-0
Timestamp: 2025-11-24T18:01:44.169Z
Learning: Applies to mcp-server/src/tools/*.js : Create MCP tool definitions in `mcp-server/src/tools/` using kebab-case naming; use zod for parameter validation; make projectRoot optional as the HOF handles fallback; wrap execute method with `withNormalizedProjectRoot`
Applied to files:
test-mcp-v2.jsmcp-server/src/providers/mcp-provider.js
📚 Learning: 2025-11-24T18:01:06.077Z
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: .cursor/rules/mcp.mdc:0-0
Timestamp: 2025-11-24T18:01:06.077Z
Learning: Applies to mcp-server/src/core/direct-functions/*.js : Verify that all helper functions required by a direct function are properly exported from their source modules and imported explicitly at the top of the direct function file
Applied to files:
test-mcp-v2.js
📚 Learning: 2025-11-24T18:01:44.169Z
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: .cursor/rules/new_features.mdc:0-0
Timestamp: 2025-11-24T18:01:44.169Z
Learning: Applies to mcp-server/src/tools/index.js : Register MCP tools by importing and calling registration functions in `mcp-server/src/tools/index.js`
Applied to files:
test-mcp-v2.js
📚 Learning: 2025-11-24T17:58:07.992Z
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: .cursor/rules/architecture.mdc:0-0
Timestamp: 2025-11-24T17:58:07.992Z
Learning: Applies to mcp-server/src/core/direct-functions/*.js : When implementing MCP support for a command, ensure core logic exists and is exported from relevant module in scripts/modules/, then create a direct function file in mcp-server/src/core/direct-functions/ using kebab-case naming with corresponding camelCase Direct suffix function
Applied to files:
test-mcp-v2.js
📚 Learning: 2025-11-24T18:01:44.169Z
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: .cursor/rules/new_features.mdc:0-0
Timestamp: 2025-11-24T18:01:44.169Z
Learning: Applies to mcp-server/src/core/task-master-core.js : Update `task-master-core.js` by importing and re-exporting direct functions and adding them to the directFunctions map
Applied to files:
test-mcp-v2.jsmcp-server/src/providers/mcp-provider.js
📚 Learning: 2025-11-24T18:01:44.169Z
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: .cursor/rules/new_features.mdc:0-0
Timestamp: 2025-11-24T18:01:44.169Z
Learning: Applies to **/*.test.{js,ts} : Follow the mock-first-then-import pattern for Jest mocking; use jest.spyOn() for spy functions; clear mocks between tests; verify mocks with the pattern described in `tests.mdc`
Applied to files:
test-mcp-v2.js
📚 Learning: 2025-11-24T22:09:45.455Z
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-11-24T22:09:45.455Z
Learning: Applies to apps/cli/**/*.{spec,test}.ts : In unit tests for apps/cli, mock tm-core responses but use real Commander/chalk/inquirer/other npm packages to test display logic
Applied to files:
test-mcp-v2.js
📚 Learning: 2025-09-26T19:05:47.555Z
Learnt from: Crunchyman-ralph
Repo: eyaltoledano/claude-task-master PR: 1252
File: packages/ai-sdk-provider-grok-cli/package.json:11-13
Timestamp: 2025-09-26T19:05:47.555Z
Learning: In the eyaltoledano/claude-task-master repository, internal tm/ packages use a specific export pattern where the "exports" field points to TypeScript source files (./src/index.ts) while "main" points to compiled output (./dist/index.js) and "types" points to source files (./src/index.ts). This pattern is used consistently across internal packages like tm/core and tm/ai-sdk-provider-grok-cli because they are consumed directly during build-time bundling with tsdown rather than being published as separate packages.
Applied to files:
packages/ai-sdk-provider-mcp-sampling/src/index.tspackages/ai-sdk-provider-mcp-sampling/tsconfig.jsonpackages/ai-sdk-provider-mcp-sampling/package.json
📚 Learning: 2025-11-24T18:01:06.077Z
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: .cursor/rules/mcp.mdc:0-0
Timestamp: 2025-11-24T18:01:06.077Z
Learning: Applies to mcp-server/src/core/direct-functions/*.js : Do not wrap unified AI service calls (generateTextService, generateObjectService) in silent mode; their logging is handled internally
Applied to files:
packages/ai-sdk-provider-mcp-sampling/src/index.tspackages/ai-sdk-provider-mcp-sampling/src/message-converter.tspackages/ai-sdk-provider-mcp-sampling/src/mcp-sampling-language-model.ts
📚 Learning: 2025-09-26T19:10:32.906Z
Learnt from: Crunchyman-ralph
Repo: eyaltoledano/claude-task-master PR: 1252
File: tsconfig.json:22-28
Timestamp: 2025-09-26T19:10:32.906Z
Learning: In the eyaltoledano/claude-task-master repository, all internal tm/ package path mappings in tsconfig.json consistently point to TypeScript source files (e.g., "./packages/*/src/index.ts") rather than built JavaScript. This is intentional architecture because tsdown bundles internal packages directly from source during build time, eliminating the need for separate compilation of internal packages.
Applied to files:
packages/ai-sdk-provider-mcp-sampling/tsconfig.jsonpackages/ai-sdk-provider-mcp-sampling/package.json
📚 Learning: 2025-09-03T12:16:15.866Z
Learnt from: Crunchyman-ralph
Repo: eyaltoledano/claude-task-master PR: 1178
File: packages/tm-core/package.json:13-64
Timestamp: 2025-09-03T12:16:15.866Z
Learning: For internal packages in the claude-task-master project, Crunchyman-ralph prefers pointing package.json "types" entries to src .ts files rather than dist .d.ts files for better developer experience (DX), as the packages are not being exported as SDKs.
Applied to files:
packages/ai-sdk-provider-mcp-sampling/tsconfig.jsonpackages/ai-sdk-provider-mcp-sampling/package.json
📚 Learning: 2025-11-26T21:57:48.927Z
Learnt from: Crunchyman-ralph
Repo: eyaltoledano/claude-task-master PR: 1451
File: apps/mcp/src/tools/tasks/set-task-status.tool.ts:23-25
Timestamp: 2025-11-26T21:57:48.927Z
Learning: Applies to apps/mcp/src/tools/**/*.ts : In the new apps/mcp MCP tool architecture, projectRoot is a required parameter in Zod schemas (not optional like in the legacy mcp-server structure)
Applied to files:
packages/ai-sdk-provider-mcp-sampling/tsconfig.json
📚 Learning: 2025-09-26T19:03:33.225Z
Learnt from: Crunchyman-ralph
Repo: eyaltoledano/claude-task-master PR: 1252
File: package.json:130-132
Timestamp: 2025-09-26T19:03:33.225Z
Learning: In the eyaltoledano/claude-task-master repository, packages are bundled using tsdown during the build process, which means dependencies imported by the source code (including tm internal packages like tm/ai-sdk-provider-grok-cli) are included in the final bundle and don't need to be available as separate runtime dependencies, so they should remain as devDependencies rather than being moved to dependencies.
Applied to files:
packages/ai-sdk-provider-mcp-sampling/tsconfig.jsonpackages/ai-sdk-provider-mcp-sampling/package.json
📚 Learning: 2025-11-24T18:03:13.456Z
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: .cursor/rules/test_workflow.mdc:0-0
Timestamp: 2025-11-24T18:03:13.456Z
Learning: Applies to jest.config.js : Jest configuration must use ts-jest preset for TypeScript support, configure test environment as 'node', set roots to ['<rootDir>/src', '<rootDir>/tests'], and include testMatch patterns for both *.test.ts and *.spec.ts files with separate projects for unit, integration, and e2e tests
Applied to files:
packages/ai-sdk-provider-mcp-sampling/tsconfig.json
📚 Learning: 2025-09-17T19:09:08.882Z
Learnt from: Crunchyman-ralph
Repo: eyaltoledano/claude-task-master PR: 1211
File: jest.resolver.cjs:8-15
Timestamp: 2025-09-17T19:09:08.882Z
Learning: In the eyaltoledano/claude-task-master project, the team only uses .ts files and does not plan to use .tsx or .mts extensions, so Jest resolver and build tooling should focus on .js → .ts mapping only.
Applied to files:
packages/ai-sdk-provider-mcp-sampling/tsconfig.json
📚 Learning: 2025-09-26T19:07:10.485Z
Learnt from: Crunchyman-ralph
Repo: eyaltoledano/claude-task-master PR: 1252
File: packages/ai-sdk-provider-grok-cli/package.json:21-35
Timestamp: 2025-09-26T19:07:10.485Z
Learning: In the eyaltoledano/claude-task-master repository, the tsdown build configuration uses `noExternal: [/^tm\//]` which means internal tm/ packages are bundled into the final output while external npm dependencies remain external and are resolved from the root package.json dependencies at runtime. This eliminates the need for peer dependencies in internal packages since the root package.json already provides the required external dependencies.
Applied to files:
packages/ai-sdk-provider-mcp-sampling/tsconfig.json
📚 Learning: 2025-11-24T18:03:13.456Z
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: .cursor/rules/test_workflow.mdc:0-0
Timestamp: 2025-11-24T18:03:13.456Z
Learning: Applies to src/**/*.ts : Source code must have corresponding test files either colocated (*.test.ts) or in tests/unit/ directory following established patterns from src/utils/auth.test.ts with proper mocking for external dependencies
Applied to files:
packages/ai-sdk-provider-mcp-sampling/tsconfig.json
📚 Learning: 2025-11-24T22:09:45.455Z
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-11-24T22:09:45.455Z
Learning: Applies to **/*.{ts,tsx} : Import modules with `.js` extension even in TypeScript source files for ESM compatibility
Applied to files:
packages/ai-sdk-provider-mcp-sampling/tsconfig.json
📚 Learning: 2025-11-24T22:09:45.455Z
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-11-24T22:09:45.455Z
Learning: Applies to **/*.spec.ts : Place package and app test files in `packages/<package-name>/src/<module>/<file>.spec.ts` or `apps/<app-name>/src/<module>/<file>.spec.ts` alongside source files
Applied to files:
packages/ai-sdk-provider-mcp-sampling/tsconfig.json
📚 Learning: 2025-11-24T22:09:45.455Z
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-11-24T22:09:45.455Z
Learning: Applies to **/*.{spec,test}.ts : Always use `.ts` for TypeScript tests, never `.js`
Applied to files:
packages/ai-sdk-provider-mcp-sampling/tsconfig.json
📚 Learning: 2025-07-31T20:49:04.638Z
Learnt from: Crunchyman-ralph
Repo: eyaltoledano/claude-task-master PR: 997
File: apps/extension/package.publish.json:2-8
Timestamp: 2025-07-31T20:49:04.638Z
Learning: In the eyaltoledano/claude-task-master repository, the VS Code extension uses a 3-file packaging system where package.json (with name "extension") is for development within the monorepo, while package.publish.json (with name "task-master-hamster") contains the clean manifest for VS Code marketplace publishing. The different names are intentional and serve distinct purposes in the build and publishing workflow.
Applied to files:
packages/ai-sdk-provider-mcp-sampling/package.json
📚 Learning: 2025-09-24T15:46:28.029Z
Learnt from: Crunchyman-ralph
Repo: eyaltoledano/claude-task-master PR: 1114
File: src/ai-providers/gemini-cli.js:12-12
Timestamp: 2025-09-24T15:46:28.029Z
Learning: When AI SDK provider packages are moved from optional dependencies to required dependencies in package.json, static imports should be used instead of dynamic imports with error handling, as the package is guaranteed to be available at runtime.
Applied to files:
packages/ai-sdk-provider-mcp-sampling/package.json
📚 Learning: 2025-09-22T19:45:04.337Z
Learnt from: Crunchyman-ralph
Repo: eyaltoledano/claude-task-master PR: 1232
File: packages/tm-core/package.json:50-51
Timestamp: 2025-09-22T19:45:04.337Z
Learning: In the eyaltoledano/claude-task-master project, Crunchyman-ralph intentionally omits version fields from internal/private packages in package.json files to prevent changesets from releasing new versions of these packages while still allowing them to be processed for dependency updates. The changesets warnings about missing versions are acceptable as they don't break the process and achieve the desired behavior of only releasing public packages.
Applied to files:
packages/ai-sdk-provider-mcp-sampling/package.json
📚 Learning: 2025-11-24T18:01:06.077Z
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: .cursor/rules/mcp.mdc:0-0
Timestamp: 2025-11-24T18:01:06.077Z
Learning: Applies to mcp-server/src/tools/*.js : Use handleApiResult utility to format the result from a *Direct function into a standard MCP response, which automatically handles data processing via processMCPResponseData
Applied to files:
packages/ai-sdk-provider-mcp-sampling/src/message-converter.ts
📚 Learning: 2025-11-24T18:01:06.077Z
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: .cursor/rules/mcp.mdc:0-0
Timestamp: 2025-11-24T18:01:06.077Z
Learning: Applies to mcp-server/src/tools/*.js : Access API keys for AI services via the session.env object in the MCP context rather than reading environment variables directly
Applied to files:
mcp-server/src/providers/mcp-provider.js
📚 Learning: 2025-11-24T18:01:06.077Z
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: .cursor/rules/mcp.mdc:0-0
Timestamp: 2025-11-24T18:01:06.077Z
Learning: Applies to mcp-server/src/core/direct-functions/*.js : Use path.join() instead of string concatenation for file paths, follow established file naming conventions (task_001.txt format), and use path.dirname() and related path utilities for manipulating paths
Applied to files:
mcp-server/src/providers/mcp-provider.js
📚 Learning: 2025-11-24T18:02:49.782Z
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: .cursor/rules/telemetry.mdc:0-0
Timestamp: 2025-11-24T18:02:49.782Z
Learning: Applies to mcp-server/src/tools/**/*.js : MCP tools in mcp-server/src/tools/ must call the corresponding direct function wrapper and pass the result object to handleApiResult(result, log) from mcp-server/src/tools/utils.js
Applied to files:
mcp-server/src/providers/mcp-provider.js
📚 Learning: 2025-11-24T18:01:06.077Z
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: .cursor/rules/mcp.mdc:0-0
Timestamp: 2025-11-24T18:01:06.077Z
Learning: Applies to mcp-server/src/tools/*.js : Use snake_case for MCP tool names exposed to clients (e.g., list_tasks, set_task_status)
Applied to files:
mcp-server/src/providers/mcp-provider.js
📚 Learning: 2025-11-24T18:01:44.169Z
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: .cursor/rules/new_features.mdc:0-0
Timestamp: 2025-11-24T18:01:44.169Z
Learning: Applies to mcp-server/src/core/direct-functions/*.js : Create direct function wrappers in `mcp-server/src/core/direct-functions/` using kebab-case naming; import core logic and use `findTasksJsonPath` from path-utils and silent mode utilities from `utils.js`
Applied to files:
mcp-server/src/providers/mcp-provider.js
📚 Learning: 2025-11-24T18:04:43.972Z
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: .cursor/rules/utilities.mdc:0-0
Timestamp: 2025-11-24T18:04:43.972Z
Learning: Applies to mcp-server/src/**/*.{js,ts} : Use createLogWrapper(log) to create a logger object wrapper with standard methods mapping to the passed MCP log object's methods
Applied to files:
mcp-server/src/providers/mcp-provider.js
📚 Learning: 2025-11-24T17:57:31.417Z
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: .cursor/rules/ai_services.mdc:0-0
Timestamp: 2025-11-24T17:57:31.417Z
Learning: Applies to scripts/modules/task-manager/*.js, scripts/modules/commands.js : Pass the `session` object (from context parameter) to the AI service call when in MCP context
Applied to files:
mcp-server/src/providers/mcp-provider.js
📚 Learning: 2025-11-24T17:57:14.743Z
Learnt from: CR
Repo: eyaltoledano/claude-task-master PR: 0
File: .cursor/rules/ai_providers.mdc:0-0
Timestamp: 2025-11-24T17:57:14.743Z
Learning: Applies to src/ai-providers/*.js : Provider functions must include basic validation and try/catch error handling
Applied to files:
mcp-server/src/providers/mcp-provider.js
🧬 Code graph analysis (6)
packages/ai-sdk-provider-mcp-sampling/src/json-extractor.ts (1)
packages/ai-sdk-provider-mcp-sampling/src/index.ts (1)
extractJson(27-27)
packages/ai-sdk-provider-mcp-sampling/src/mcp-sampling-provider.ts (3)
packages/ai-sdk-provider-mcp-sampling/src/index.ts (5)
createMCPSampling(5-5)MCPSession(13-13)MCPSamplingSettings(11-11)MCPSamplingModelId(10-10)MCPSamplingLanguageModel(6-6)packages/ai-sdk-provider-mcp-sampling/src/types.ts (3)
MCPSession(23-52)MCPSamplingSettings(12-19)MCPSamplingModelId(21-21)packages/ai-sdk-provider-mcp-sampling/src/mcp-sampling-language-model.ts (2)
MCPSamplingLanguageModel(34-341)provider(66-68)
packages/ai-sdk-provider-mcp-sampling/src/types.ts (2)
packages/ai-sdk-provider-mcp-sampling/src/index.ts (5)
MCPSamplingLanguageModelOptions(12-12)MCPSamplingSettings(11-11)MCPSamplingModelId(10-10)MCPSession(13-13)MCPSamplingResponse(14-14)packages/tm-core/src/modules/storage/utils/api-client.ts (1)
request(30-87)
packages/ai-sdk-provider-mcp-sampling/src/message-converter.ts (3)
packages/ai-sdk-provider-mcp-sampling/src/index.ts (3)
convertToMCPFormat(29-29)convertFromMCPFormat(30-30)MCPSamplingResponse(14-14)packages/ai-sdk-provider-mcp-sampling/src/types.ts (1)
MCPSamplingResponse(54-62)mcp-server/src/custom-sdk/message-converter.js (2)
text(46-46)finishReason(48-48)
packages/ai-sdk-provider-mcp-sampling/src/mcp-sampling-language-model.ts (4)
packages/ai-sdk-provider-mcp-sampling/src/types.ts (3)
MCPSamplingSettings(12-19)MCPSession(23-52)MCPSamplingLanguageModelOptions(5-10)packages/ai-sdk-provider-mcp-sampling/src/errors.ts (2)
createMCPSessionError(50-57)mapMCPError(59-103)packages/ai-sdk-provider-mcp-sampling/src/message-converter.ts (2)
createPromptFromMessages(103-125)convertToMCPFormat(11-53)packages/ai-sdk-provider-mcp-sampling/src/json-extractor.ts (1)
extractJson(9-56)
mcp-server/src/providers/mcp-provider.js (2)
packages/ai-sdk-provider-mcp-sampling/src/index.ts (1)
createMCPSampling(5-5)packages/ai-sdk-provider-mcp-sampling/src/mcp-sampling-provider.ts (1)
createMCPSampling(18-64)
🪛 LanguageTool
packages/ai-sdk-provider-mcp-sampling/README.md
[grammar] ~7-~7: Use a hyphen to join words.
Context: ...view This package provides an AI SDK v5 compatible provider for using MCP sampli...
(QB_NEW_EN_HYPHEN)
…ion v2
Closes #1449
What type of PR is this?
Description
Related Issues
How to Test This
# Example commands or stepsExpected result:
Contributor Checklist
npm run changesetnpm testnpm run format-check(ornpm run formatto fix)Changelog Entry
For Maintainers
Summary by CodeRabbit
New Features
Documentation
✏️ Tip: You can customize this high-level summary in your review settings.