golem icon indicating copy to clipboard operation
golem copied to clipboard

Incorporate MCP Server into Golem CLI

Open jdegoes opened this issue 7 months ago β€’ 38 comments

With a new command, Golem CLI enters serve mode:

%> golem-cli --serve --serve-port 1232
%> golem-cli running MCP Server at port 1232

In this mode, Golem CLI creates an MCP Server that exposes different commands as different tools, and exposes relevant resources (the manifest file in the current, ancestor, and children directories) as resources.

When this ticket is completed, it should be possible to use an agent such as Claude Code to perform anything that Golem CLI can do. Moreover, all individual tools and resources must be end-to-end tested with an MCP Client that interacts with the MCP Server.

This library looks like the one to use for Rust, but perhaps there are better options available.

jdegoes avatar Jun 05 '25 13:06 jdegoes

/bounty $3500

jdegoes avatar Jun 05 '25 13:06 jdegoes

πŸ’Ž $3,500 bounty β€’ Golem Cloud

Steps to solve:

  1. Start working: Comment /attempt golemcloud/golem#1926 with your implementation plan
  2. Submit work: Create a pull request including /claim golemcloud/golem#1926 in the PR body to claim the bounty
  3. Receive payment: 100% of the bounty is received 2-5 days post-reward. Make sure you are eligible for payouts

❗ Important guidelines:

  • To claim a bounty, you need to provide a short demo video of your changes in your pull request
  • If anything is unclear, ask for clarification before starting as this will help avoid potential rework
  • Low quality AI PRs will not receive review and will be closed
  • Do not ask to be assigned unless you've contributed before

Thank you for contributing to golemcloud/golem-cli!

Attempt Started (UTC) Solution Actions
🟒 @webbdays Jul 04, 2025, 05:11:56 PM golemcloud/golem-cli#290 Reward
🟒 @benya7 Jun 05, 2025, 05:02:10 PM WIP
🟒 @yarosz Jun 05, 2025, 06:51:51 PM WIP
🟒 @vishalpatil1899 Jun 06, 2025, 12:25:44 AM WIP
🟒 @saurabhhh777 Aug 09, 2025, 06:31:54 AM WIP
🟒 @Harsh9485 Aug 11, 2025, 04:12:01 PM WIP
🟒 @fjkiani Aug 12, 2025, 11:03:09 PM golemcloud/golem-cli#319 Reward
🟒 @kmr-ankitt Jun 17, 2025, 07:29:28 AM WIP
🟒 @Sethrollinsbah Jun 19, 2025, 11:41:27 AM WIP
🟒 @hoangbits Jul 25, 2025, 08:51:50 AM WIP
🟒 @harkam-pro Jul 30, 2025, 09:15:01 AM WIP
🟒 @Aditya-PS-05 Jul 30, 2025, 09:38:31 AM WIP

algora-pbc[bot] avatar Jun 05 '25 13:06 algora-pbc[bot]

Hi @jdegoes . I'd love to work on this one. Could you assign it to me?

benya7 avatar Jun 05 '25 15:06 benya7

Hi @jdegoes, I am interested

its like

  1. keeping cli (exlisting clap lib) in the loop. (simple approach, provide cli docs as context source to generate appropriate cli commands(like we humans do) based on user requirements.) (mcp has just a tool which pass this to clap parser) and another tool to read the manifest files in the app. may be another tool to read app context.
  2. or without clap: write custom tools/handler for actions for mcp like its was done for clap for each command.we need to write custom tool descriptions if we choose this approach.

Thanks.

webbdays avatar Jun 05 '25 15:06 webbdays

@benya7 We cannot assign but feel free to work on, if you like. I don't know if someone else will work on it too, but it's a possibility.

@webbdays Any agent can be taught to figure out a CLI interface, that's not what I want for this issue. Bypassing clap and writing direct custom tools will provide the best agent experience. However, we can leverage existing command docs by tying into Clap metadata associated with commands, to reduce the maintenance burden for the MCP Server.

jdegoes avatar Jun 05 '25 16:06 jdegoes

ok.

webbdays avatar Jun 05 '25 16:06 webbdays

/attempt golemcloud/golem#1926

benya7 avatar Jun 05 '25 17:06 benya7

/attempt golemcloud/golem#1926 πŸš€

yarosz avatar Jun 05 '25 18:06 yarosz

@jdegoes Hey John πŸ‘‹
First time contributor to Golem, but done a couple of bounties here on Algora before. I've got a few questions before I dive into a prototype:

1. Transport default: Should --serve expose an HTTP JSON-RPC endpoint on localhost:<port> by default, or should it speak MCP over stdio unless --serve-port is given?

2. Streaming expectations: For long-running CLI commands, do you want incremental output via MCP logging/notifications, or is returning only the final result acceptable?

3. Resource scope: Beyond the nearest manifest file, should resources/list expose additional project files (e.g. child manifests, logs), or keep scope to a single manifest for v1?

Thanks for taking the time.

yarosz avatar Jun 05 '25 19:06 yarosz

@yarosz

  1. I don't want to support stdio.

  2. Incremental output is useful.

  3. The hierarchy of manifest files (there is not, in general, a single one), as well as any file which could or should be referenced by a command. In order to learn what these are, you should study the CLI reference.

jdegoes avatar Jun 05 '25 19:06 jdegoes

/attempt golemcloud/golem#1926

vishalpatil1899 avatar Jun 06 '25 00:06 vishalpatil1899

Hey @jdegoes I’d like to ask: what exactly do you expect Golem CLI to support when it is running as an MCP server? What kinds of actions or commands should an agent like Claude Code be able to perform through the server?

Harsh9485 avatar Jun 07 '25 15:06 Harsh9485

/attempt golemcloud/golem#1926

kmr-ankitt avatar Jun 17 '25 07:06 kmr-ankitt

/attempt golemcloud/golem#1926

sethryanrollins avatar Jun 19 '25 11:06 sethryanrollins

@Harsh9485 Claude Code should be able to do anything (for you) that CLI can do itself.

jdegoes avatar Jun 19 '25 12:06 jdegoes

Is anybody working on this?

kartikmandar avatar Jun 29 '25 15:06 kartikmandar

Is anybody working on this? Yes. Almost done. Will put out the pr today or tomorrow.

webbdays avatar Jun 29 '25 17:06 webbdays

Is anybody working on this? Yes. Almost done. Will put out the pr today or tomorrow.

Hey..that's awesome. Good luck for the PR.

kartikmandar avatar Jun 29 '25 20:06 kartikmandar

Hey algora, /attempt golemcloud/golem#1926

webbdays avatar Jul 04 '25 17:07 webbdays

/attempt https://github.com/golemcloud/golem/issues/1926

hoangbits avatar Jul 25 '25 08:07 hoangbits

@jdegoes Hey, Do you want to closing this issue with implementation from @webbdays or want impelmentation differently? It's already 3 weeks ago.

hoangbits avatar Jul 25 '25 13:07 hoangbits

/attempt golemcloud/golem#1926

harkam-pro avatar Jul 30 '25 09:07 harkam-pro

/attempt golemcloud/golem#1926

Aditya-PS-05 avatar Jul 30 '25 09:07 Aditya-PS-05

/attempt golemcloud/golem#1926

saurabhhh777 avatar Aug 09 '25 06:08 saurabhhh777

/attempt golemcloud/golem#1926

Harsh9485 avatar Aug 11 '25 16:08 Harsh9485

/attempt golemcloud/golem#1926

Implementation plan:

  • Flags and entry:
    • Add --serve and --serve-port to GolemCliGlobalFlags
    • Early branch to start serve mode and print β€œgolem-cli running MCP Server at port {port}”
  • Server (optional feature mcp-serve):
    • Introduce golem-cli/src/serve/mod.rs
    • Use rust-mcp-sdk SSE server; implement:
      • tools.list from Clap leaf commands (names like app.build)
      • tools.call with generic { args: string[] } β†’ re-invoke existing CLI handlers
      • resources.list/read for golem.yaml in cwd, ancestors, one-level children
  • DRY principle: generate tools from Clap; don’t hard-code schemas
  • Tests:
    • E2E with SDK client: list tools, call a simple command, list/read resources
  • Docs: brief usage and feature flag notes

SDK reference: https://github.com/rust-mcp-stack/rust-mcp-sdk

fjkiani avatar Aug 12 '25 23:08 fjkiani

/attempt golemcloud/golem#1926

Phase 1 (submitted): Serve mode scaffold

  • PR: https://github.com/golemcloud/golem-cli/pull/319
  • Adds flags: --serve, --serve-port
  • On run, prints: β€œgolem-cli running MCP Server at port {port}”
  • Placeholder server enumerates CLI tools/resources and waits for Ctrl‑C
  • How to run: cargo run -p golem-cli -- --serve --serve-port 1232

Phase 2 (next PR): MCP integration + tests

  • Optional feature: mcp-serve
  • Use rust-mcp-sdk (SSE) for MCP server:
    • tools.list from Clap leaves (e.g., app.build)
    • tools.call with generic { args: string[] } β†’ re-invoke existing CLI handlers
    • resources.list/read for golem.yaml (cwd, ancestors, one-level children)
  • E2E tests with an SDK client

SDK reference: https://github.com/rust-mcp-stack/rust-mcp-sdk

fjkiani avatar Aug 13 '25 01:08 fjkiani

/attempt #1926

dohrisalim avatar Aug 19 '25 14:08 dohrisalim

/attempt #1926

BenraouaneSoufiane avatar Aug 20 '25 09:08 BenraouaneSoufiane

/attempt #1926

SamarthShukla17 avatar Sep 14 '25 18:09 SamarthShukla17