Skip to content

MCP improvements#393

Merged
Swiftwork merged 18 commits intomainfrom
feat/mcp-improvements
Apr 9, 2025
Merged

MCP improvements#393
Swiftwork merged 18 commits intomainfrom
feat/mcp-improvements

Conversation

@Swiftwork
Copy link
Contributor

@Swiftwork Swiftwork commented Mar 28, 2025

Change highlights ✨

  • New feature access command enabling feature for users, companies, and segments.
  • New rules command to add bucket specific rules to Cursor.
  • Improved README around MCP.

AI Summary

This pull request includes several updates to the packages/cli project, focusing on updating command usage in the documentation, enhancing feature access commands, and introducing AI-assisted development capabilities. Below are the most important changes:

Documentation Updates:

  • Updated all command examples in packages/cli/README.md to use npx for executing commands instead of the previous direct method. [1] [2] [3] [4] [5] [6]

Feature Access Enhancements:

  • Refactored feature access commands to support enabling/disabling features for multiple targets (companies, segments, users) and moved the logic from companies.ts to features.ts. [1] [2] [3] [4] [5] [6]

AI-Assisted Development:

  • Introduced new sections in the documentation for AI-assisted development, including Bucket Rules and Model Context Protocol (MCP). Added commands for setting up AI-specific rules and starting an MCP server. [1] [2] [3] [4] [5]

These changes enhance the usability of the CLI by ensuring consistency in command execution, improving the flexibility of feature management, and providing tools for AI-assisted development.

@Swiftwork Swiftwork added the enhancement New feature or request label Mar 28, 2025
@Swiftwork Swiftwork self-assigned this Mar 28, 2025
@Swiftwork Swiftwork requested a review from Copilot April 2, 2025 15:45
@Swiftwork Swiftwork marked this pull request as ready for review April 2, 2025 15:45
Copy link
Contributor

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 improves MCP functionality in the CLI by introducing a detailed feature flagging guide based on the Bucket feature management service, updating CLI commands to use npx for improved compatibility, and simplifying the codebase by removing redundant methods.

  • Added comprehensive documentation and guidelines for feature flagging.
  • Revised CLI commands and options (e.g. renaming and description adjustments) for consistency.
  • Removed obsolete methods in companies.ts to simplify the code.

Reviewed Changes

Copilot reviewed 15 out of 17 changed files in this pull request and generated no comments.

Show a summary per file
File Description
packages/cli/utils/options.ts Updated option names and descriptions for clarity.
packages/cli/utils/json.ts Exported JSONPrimitive type for broader reuse.
packages/cli/utils/errors.ts Enhanced error messaging with additional error detail.
packages/cli/services/users.ts Introduced new users service with proper schema validations.
packages/cli/services/stages.ts Refactored updateFeatureStage function and schema for clarity.
packages/cli/services/features.ts Added feature access functionality and updated target handling.
packages/cli/services/companies.ts Removed unnecessary methods and unused imports.
packages/cli/services/bootstrap.ts Renamed user type to BucketUser and added segments retrieval.
packages/cli/mcp/tools.ts Integrated new response helpers and segments support in MCP tools.
packages/cli/mcp/responses.ts Introduced consistent text response functions.
packages/cli/index.ts Updated fetch method for user data to use getBucketUser.
packages/cli/commands/mcp.ts Revised MCP command options and error messages for punctuation.
packages/cli/commands/features.ts Added new feature access command with interactive prompts.
packages/cli/commands/companies.ts Removed obsolete company feature access command.
packages/cli/README.md Updated CLI usage documentation to reflect npx command changes.
Files not reviewed (2)
  • .cursor/rules/bucket.mdc: Language not supported
  • packages/cli/package.json: Language not supported
Comments suppressed due to low confidence (1)

packages/cli/mcp/tools.ts:158

  • The dynamic enum schema for segmentNames may throw a runtime error if the segments array is empty. Consider adding a check to ensure the segments array is non-empty or provide a default/fallback value.
segmentNames: z.array(z.enum(segmentNames as [string, ...string[]])).optional().describe(`Segment names to target. Must be one of the following: ${segmentNames.join(", ")}`,),

@Swiftwork Swiftwork requested review from pavkam and roncohen April 3, 2025 11:00
Copy link
Contributor

@pavkam pavkam left a comment

Choose a reason for hiding this comment

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

Left comments -- I'm no expert on RAG/LLM dance so a lot of this will need to be seen in the wild.

One thing to note -- if we update the rules in the future, would it make sense to have some sort of a check in the CLI that could see if the users use an older version of the rules? Also would need to understand if the user made manual updates to the rules (we can make a hash of the file after copy and append to it, if it doesn't match in the future we know the user has tinkered with it).

@Swiftwork
Copy link
Contributor Author

@pavkam I rewrote the cursor rules to contain less fluff and be more relevant. Thoughts?

@Swiftwork Swiftwork requested a review from pavkam April 7, 2025 08:18
@roncohen
Copy link
Contributor

roncohen commented Apr 7, 2025

Couple of nit picks on the cursor rules:

The @ sign doing something funny here:
Screenshot 2025-04-07 at 21 48 15

The front matter is jumping a bit:
Screenshot 2025-04-07 at 21 48 01

@roncohen
Copy link
Contributor

roncohen commented Apr 7, 2025

I forgot, but is there a reason why we don't just tell people to always use supergateway or mcp-server instead of giving them the two different options? Feels like the experience of getting your editor to automatically start the MCP server is much better:

Screenshot 2025-04-07 at 21 51 49

@Swiftwork
Copy link
Contributor Author

Couple of nit picks on the cursor rules:

The @ sign doing something funny here: Screenshot 2025-04-07 at 21 48 15

The front matter is jumping a bit: Screenshot 2025-04-07 at 21 48 01

I forgot, but is there a reason why we don't just tell people to always use supergateway or mcp-server instead of giving them the two different options? Feels like the experience of getting your editor to automatically start the MCP server is much better:

Screenshot 2025-04-07 at 21 51 49

First issue is actually just the way cursor renders .MDC files. The link is a normal markdown one, was also surprised by that.

Second I fixed, thanks!

Third, it doesn't call our CLI starting the server, it only starts/creates a proxy server converting SSE events into STDERR output that then the IDE/Client can read. It wouldn't help automate anything and you still need the npx bucket mcp command :)

Co-authored-by: Ron Cohen <ron@bucket.co>
Copy link
Contributor

@roncohen roncohen left a comment

Choose a reason for hiding this comment

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

lets get this in!

@Swiftwork Swiftwork enabled auto-merge April 9, 2025 12:39
@Swiftwork Swiftwork added this pull request to the merge queue Apr 9, 2025
Merged via the queue into main with commit 5837506 Apr 9, 2025
5 checks passed
@Swiftwork Swiftwork deleted the feat/mcp-improvements branch April 9, 2025 12:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants