Skip to content

Conversation

@jonathannorris
Copy link
Member

@jonathannorris jonathannorris commented Jul 15, 2025

Improve MCP Server Installation and User Experience

This PR enhances the DevCycle MCP server installation and usability with several key improvements:

🔧 Cross-Platform Installation Support

  • Added platform-specific bin wrappers (bin/mcp, bin/mcp.cmd) for better Windows/Unix compatibility
  • Updated package.json to use bin wrappers instead of direct dist file reference

📚 Enhanced Documentation & Setup

  • Comprehensive installation guide with global and project-specific options
  • Step-by-step configuration instructions for Cursor and Claude Desktop
  • Added verification commands and troubleshooting section

Quick Verification Support

  • Added --version/-v and --help/-h flags to MCP server
  • Dynamic version reporting from package.json (fixes hardcoded 0.0.1)

🚨 Improved Error Handling

  • Categorized startup errors with specific resolution guidance
  • Enhanced authentication and project configuration error messages
  • Rich tool error responses with actionable suggestions

Impact

Makes MCP server installation more reliable across platforms and significantly improves the developer experience when encountering issues. Users now get clear, actionable guidance instead of cryptic error messages.

This comment was marked as outdated.

Comment on lines +156 to +160
### Option 1: Global Installation (Recommended)
```bash
npm install -g @devcycle/cli
# This installs both 'dvc' CLI and 'dvc-mcp' server
```
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

don't we have a brew package that we also maintain?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not sure, I'll add a ticket for looking at that later.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'Please verify your DEVCYCLE_CLIENT_ID and DEVCYCLE_CLIENT_SECRET are correct, ' +
'or run "dvc login sso" to authenticate with SSO.',
)
} else {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you don't need an else here - you're throwing

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yea, reads cleaner this way thou.

@jonathannorris jonathannorris requested a review from JamieSinn July 15, 2025 20:31
@jonathannorris jonathannorris requested a review from Copilot July 15, 2025 20:35
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR enhances the DevCycle MCP server by improving cross-platform installation, adding version/help flags, and enriching error handling with actionable suggestions.

  • Introduced detailed, contextual error messages in authentication utilities and tool handlers
  • Implemented --version/-v and --help/-h flags with dynamic version reporting
  • Updated documentation with step-by-step installation, verification, and troubleshooting

Reviewed Changes

Copilot reviewed 7 out of 10 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
src/mcp/utils/auth.ts Enhanced authentication errors with env var vs. SSO guidance
src/mcp/server.ts Centralized tool error handling, added categorization & suggestions
src/mcp/index.ts Added CLI flags, dynamic version lookup, and improved startup errors
src/api/zodClient.ts Refined VariableValidationEntity schema types
package.json Switched dvc-mcp bin entry to use cross-platform wrapper
oclif.manifest.json Bumped manifest version
README.md Added MCP installation guide, updated TOC and troubleshooting
Comments suppressed due to low confidence (3)

README.md:25

  • The TOC entry links to a section that doesn't exist, causing a broken link. Update or remove this entry to match actual headings.
* [This installs both 'dvc' CLI and 'dvc-mcp' server](#this-installs-both-dvc-cli-and-dvc-mcp-server)

README.md:204

  • [nitpick] This heading duplicates the earlier 'Option 2: Project-Specific Installation' section and may confuse readers. Consider renaming or consolidating to avoid duplication.
### For Project-Specific Installation

src/mcp/server.ts:87

  • The new error handling methods (handleToolError, categorizeError, getErrorSuggestions) currently lack unit tests. Consider adding tests to validate categorization logic and suggestion outputs.
    private handleToolError(error: unknown, toolName: string) {

Comment on lines +156 to +159
case lowerMessage.includes('project') &&
lowerMessage.includes('not found'):
return 'PROJECT_ERROR'

Copy link

Copilot AI Jul 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The PROJECT_ERROR case comes after the more general RESOURCE_NOT_FOUND case, so errors with 'not found' are always classified as RESOURCE_NOT_FOUND. Consider moving the PROJECT_ERROR case before RESOURCE_NOT_FOUND to correctly capture project-specific 'not found' errors.

Suggested change
case lowerMessage.includes('project') &&
lowerMessage.includes('not found'):
return 'PROJECT_ERROR'

Copilot uses AI. Check for mistakes.
Comment on lines +94 to +96
(error.message.includes('authentication') ||
error.message.includes('project') ||
error.message.includes('DEVCYCLE_'))
Copy link

Copilot AI Jul 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The includes checks on error.message are case-sensitive, so messages starting with an uppercase 'Authentication' won't match. Normalize error.message to lowercase before matching (e.g., const msg = error.message.toLowerCase()).

Suggested change
(error.message.includes('authentication') ||
error.message.includes('project') ||
error.message.includes('DEVCYCLE_'))
(() => {
const msg = error.message.toLowerCase();
return (
msg.includes('authentication') ||
msg.includes('project') ||
msg.includes('devcycle_')
);
})()

Copilot uses AI. Check for mistakes.
'No authentication found. Please set DEVCYCLE_CLIENT_ID and DEVCYCLE_CLIENT_SECRET environment variables, ' +
'or run "dvc login sso" in the CLI first.',
)
const hasEnvVars =
Copy link

Copilot AI Jul 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] The variable hasEnvVars is assigned a string or undefined, relying on truthiness. Consider explicitly converting to boolean for clarity, e.g., const hasEnvVars = Boolean(process.env.DEVCYCLE_CLIENT_ID && process.env.DEVCYCLE_CLIENT_SECRET).

Copilot uses AI. Check for mistakes.
@jonathannorris jonathannorris merged commit e9507cc into chore-mcp-planning-doc Jul 17, 2025
9 checks passed
@jonathannorris jonathannorris deleted the feat-dvc-mcp-deployment branch July 17, 2025 16:31
jonathannorris added a commit that referenced this pull request Jul 23, 2025
* feat: improve MCP server installation

* fix: update yarn.lock

* fix: error handling

* fix: switch to path.resolve()

* chore: refactor and cleanup error handling code

* chore: address PR comments
jonathannorris added a commit that referenced this pull request Jul 25, 2025
* feat: improve MCP server installation

* fix: update yarn.lock

* fix: error handling

* fix: switch to path.resolve()

* chore: refactor and cleanup error handling code

* chore: address PR comments
jonathannorris added a commit that referenced this pull request Aug 11, 2025
* feat: improve MCP server installation

* fix: update yarn.lock

* fix: error handling

* fix: switch to path.resolve()

* chore: refactor and cleanup error handling code

* chore: address PR comments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants