-
Notifications
You must be signed in to change notification settings - Fork 146
DRAFT - initial stab at MCP support #460
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: main
Are you sure you want to change the base?
DRAFT - initial stab at MCP support #460
Conversation
Done: - `mcp-servers` in config - `default-mcp-servers` in config - `mcp-servers-from` in config - `--mcp-servers`, `-T` flag - `--all-mcp-servers`, `-A` flag - `--mcp-servers-from` flag - `--list-mcp-servers` command flag - `--list-mcp-tools` command flag - passing mcp tools models (openai only) - printing model tool calls to terminal - collecting tool call stream chunks into final pendingToolCalls struct field To Do: - execute tool calls after response stream closed - send tool call results to model - loop until no more tool calls - support for multiple tool calls - support for non-openai models - this is kinda messy overall and might need some cleanup in places DRAFT - initial stab at MCP support Done: - `mcp-servers` in config - `default-mcp-servers` in config - `mcp-servers-from` in config - `--mcp-servers`, `-T` flag - `--all-mcp-servers`, `-A` flag - `--mcp-servers-from` flag - `--list-mcp-servers` command flag - `--list-mcp-tools` command flag - passing mcp tools models (openai only) - printing model tool calls to terminal - collecting tool call stream chunks into final pendingToolCalls struct field To Do: - execute tool calls after response stream closed - send tool call results to model - loop until no more tool calls - support for multiple tool calls - support for non-openai models - some stuff that could be unit tested - this is kinda messy overall and might need some cleanup in places
7688a87
to
8e2b851
Compare
@@ -118,3 +118,76 @@ mods --delete='naturals' --delete='a2e2' | |||
|
|||
Keep in mind that these operations are not reversible. | |||
You can repeat the delete flag to delete multiple conversations at once. | |||
|
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.
could you remove this extra line, please?
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.
sure - in the future, is there a formatter/checker that can detect these sorts of style things for me?
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.
There's https://github.com/DavidAnson/markdownlint, and if you use VS Code you can use their extension and it renders a yellow wiggle underline that you can either hover over or list in the "problems" view, or cycle through problems with F8, like this:
```bash | ||
mods --list-mcp-tools | ||
``` | ||
|
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.
could you remove these extra lines to the end?
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.
hey, thanks for this!
in general, it looks good to me!
I'm not sure about some of the options though:
- I think we can either have mcp-servers or mcp-servers-from. If the user uses Claude desktop, they will already have the config file, so maybe that's the way to go?
- I don't think we need list-mcp-* thing 🤔
- Also, not sure if the user would want to optionally enable/disable MCPs... judging by how claude desktop works, it's kind of always there. I think if you have them setup, they should always be there 🤔
I think I would greatly simplify it to just add either mcp-servers
or mcp-servers-from
and that's pretty much it 🤔
In other MCP clients you can choose to disable servers in a chat session, like in VS Code with the agent mode: I think it can be useful if you have many MCP servers running with a lot of tools each, some overlapping and similar tool description, and the LLM chooses the wrong tools. Then you can disable the problematic one, and reduce the "search space" for the LLM. |
Or in your config file: | ||
|
||
```yaml | ||
mcp-servers-from: ~/.config/mcp/servers.json | ||
``` | ||
|
||
### Specifying MCP servers in the mods settings |
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.
I think it's worth describing the expected file schema or show an example file somewhere in this section, because it's not described anywhere yet, right?
Or in your config file: | |
```yaml | |
mcp-servers-from: ~/.config/mcp/servers.json | |
``` | |
### Specifying MCP servers in the mods settings | |
Or in your config file: | |
```yaml | |
mcp-servers-from: ~/.config/mcp/servers.json | |
``` | |
That file should look like this: | |
```json | |
{ | |
"mcpServers": { | |
"fetch": { | |
"command": "uvx", | |
"args": ["mcp-server-fetch"] | |
} | |
} | |
} | |
``` | |
### Specifying MCP servers in the mods settings |
go 1.23 | ||
|
||
toolchain go1.24.0 |
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.
Is the latest toolchain required? If not, I think this can stay at whichever Go version is minimally required by the dependencies. mcp-go
only requires Go 1.23. People are still free to use Go 1.24 compiler to build this, but they won't have to.
(Technically, since Go 1.21, Go checks for the version in the go.mod
file and implicitly downloads and uses newer versions behind the scenes if necessary, so theoretically users could still just have Go 1.23 installed. But I think it's still better/cleaner to just declare the version that's actually required, at least as long as it's officially supported)
More info on that: https://go.dev/doc/go1.21#tools
go 1.23 | |
toolchain go1.24.0 | |
go 1.23.0 |
ah, gotcha so, probably have them all enabled by default, with options to disable all, or individually disable I would suggest something like:
with |
ok, here's my simplified api proposal: keep:
remove:
Some comments on the TODO list:
all that being said, I have some time this week to help with this if you want. |
I like all these simplifications and they make sense as defaults. I don't know if I'll have time to get hands on with this thing this week.
Re: running the tools after the stream closes…
Basically with the current setup of mods, when OpenAI or whoever streams back a chunk, we print it to the console and then we're done.
With tool calling, we print it to the console and also aggregate/merge those chunks into an in memory json object, which we will later parse and send to the locally running mcp server over stdio.
Then we take the results of that execution in mcp land and send it back to the model, and repeat these steps until the model returns text and not tool calls
Then we stream that final text to the console
So there's quite a bit left to do here and perhaps a bit outside my skill level with bubble tea, at least as it stands today
…On Mon, Apr 14, 2025 at 12:14 PM, Carlos Alexandro Becker < ***@***.*** > wrote:
ok, here's my simplified api proposal:
keep:
* mcp-servers in config
* --list-mcp-servers command flag
* --list-mcp-tools command flag
remove:
* default-mcp-servers in config: default is always all mcp servers
configured
* mcp-servers-from in config: just for the sake of simplicity, can be added
later if people really want it - i have a feeling they might not need it
* --mcp-servers , -T flag: I think we should leave all enabled by default,
and add a --disable-mcp-server=[name|*] instead
* --all-mcp-servers , -A flag: should be the default
* --mcp-servers-from flag: should only use from the config file
Some comments on the TODO list:
* execute tool calls after response stream closed: not sure what this
means, can you clarify?
all that being said, I have some time this week to help with this if you
want.
—
Reply to this email directly, view it on GitHub (
#460 (comment) ) ,
or unsubscribe (
https://github.com/notifications/unsubscribe-auth/AA4OZLO2JKKPKYEFWBUYWZD2ZQCHZAVCNFSM6AAAAABYS2JDQKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDQMBSG42DSNJWGY
).
You are receiving this because you authored the thread. Message ID: <charmbracelet/mods/pull/460/c2802749566
@ github. com>
*caarlos0* left a comment (charmbracelet/mods#460) (
#460 (comment) )
ok, here's my simplified api proposal:
keep:
* mcp-servers in config
* --list-mcp-servers command flag
* --list-mcp-tools command flag
remove:
* default-mcp-servers in config: default is always all mcp servers
configured
* mcp-servers-from in config: just for the sake of simplicity, can be added
later if people really want it - i have a feeling they might not need it
* --mcp-servers , -T flag: I think we should leave all enabled by default,
and add a --disable-mcp-server=[name|*] instead
* --all-mcp-servers , -A flag: should be the default
* --mcp-servers-from flag: should only use from the config file
Some comments on the TODO list:
* execute tool calls after response stream closed: not sure what this
means, can you clarify?
all that being said, I have some time this week to help with this if you
want.
—
Reply to this email directly, view it on GitHub (
#460 (comment) ) ,
or unsubscribe (
https://github.com/notifications/unsubscribe-auth/AA4OZLO2JKKPKYEFWBUYWZD2ZQCHZAVCNFSM6AAAAABYS2JDQKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDQMBSG42DSNJWGY
).
You are receiving this because you authored the thread. Message ID: <charmbracelet/mods/pull/460/c2802749566
@ github. com>
|
nice, thanks for the response. i might try to give a stab at those cleanups/changes this week then 🙏🏻 |
quick demo - https://www.loom.com/share/85fa41a6876d456bbbf07ff558f47102
fixes #397
Done:
mcp-servers
in configdefault-mcp-servers
in configmcp-servers-from
in config--mcp-servers
,-T
flag--all-mcp-servers
,-A
flag--mcp-servers-from
flag--list-mcp-servers
command flag--list-mcp-tools
command flagTo Do: