mods icon indicating copy to clipboard operation
mods copied to clipboard

Feature Request: Add MCP Support

Open roychri opened this issue 1 year ago • 9 comments

Is your feature request related to a problem? Please describe.

Anthropic just released MCP which will simplify how we can integrate new and diverse tools to LLM apps like this one. It would be useful and it would augment the value of mods if users could indicate if they want mods to talk to their SQLlite, or access files on their filesystem, or query some API, etc... This would not only be supported by Anthropic models but any models which understand tools/function calling. Anthropic released Python and Typescript SDK but people have started making GO equivalent. Here's one: https://github.com/mark3labs/mcp-go (not affiliated) And I think more will have appeared once you read this :-)

Describe the solution you'd like

Add in support for MCP Client to Mods and Allow the user to specify in the config the various MCP Server they would like the LLM to access.

Something like:

mcpServers:
    sqlite:
        command: "uvx",
        args: ["mcp-server-sqlite", "--db-path", "/Users/YOUR_USERNAME/test.db"]

And then the user would be able to do:

$ mods how many users do I have in my sqlite?

and it would send the requests/calls using JSONRPC over Stdio or SSE Transports to fetch the data necessary to get a response. There's already a number of MPC Server available like fetching web pages and sending messages on slack to name a few: https://github.com/modelcontextprotocol/servers

Describe alternatives you've considered

No alternative since this might be the one common solution that will be the most successful/popular. I do not know golang and I do not know if that go mcp sdk is mature enough to be used in this way yet. But I thought I would see if anyone would be interested in using or implementing this.

Additional context

  • https://www.anthropic.com/news/model-context-protocol
  • https://modelcontextprotocol.io/docs/concepts/architecture
  • https://spec.modelcontextprotocol.io/
  • https://github.com/modelcontextprotocol/typescript-sdk

roychri avatar Nov 28 '24 21:11 roychri

+1 to this!!!

ezynda3 avatar Dec 01 '24 10:12 ezynda3

I'm the creator of the the Go SDK mentioned. It already supports clients for both the stdio and SSE transports. The Claude desktop app currently only supports stdio clients and most of the currently available servers as well.

Also this is my first go library so would be happy to have some more experienced Go devs have a look and possibly contribute even if just suggesting improvements.

Cheers!

ezynda3 avatar Dec 01 '24 10:12 ezynda3

this would be awesome to add indeed! happy to help implementing/reviewing it if anyone is interested in helping :D

caarlos0 avatar Jan 14 '25 14:01 caarlos0

+1

ivishalgandhi avatar Feb 08 '25 11:02 ivishalgandhi

I've been trying to make progress on this... just a proof of concept really...

I have no experience in Go. I've been using AI to try to make progress on this. I can add the various data structure changes and call the Claude LLM which respond with a stream to call a tool/function, BUT, I cannot have "mods" see this tool call request, so I am not even at the step of calling the function and loop back. I am not familiar with how BubbleTea works. And the AI doesn't seem to know how that works either 😆

I could use some help here. I'll work on getting my current progress on a fork so you can see... and perhaps someone could even contribute? Maybe if I can get passed this hurdle I can continue with AI a bit more...

I'm focusing on getting it to work on Anthropic Claude as a first step, before trying to make it work on ALL models.

roychri avatar Feb 09 '25 16:02 roychri

@roychri thanks for writing this up - I took a stab at starting this in #460 but there's plenty more to do if you wanna collab

@ezynda3 i can't speak for the internals, but the SDK you made worked like a charm, super easy to use and felt really idiomatic!

dexhorthy avatar Mar 08 '25 09:03 dexhorthy

This is awesome! Glad the SDK is useful. Also open to any PRs if you feel anything is missing or can be improved.

ezynda3 avatar Mar 08 '25 10:03 ezynda3

@dexhorthy Nice job! I was also having trouble getting the tool's response back to the LLM for a loop. What do you think about having the ability to assign mpc servers for a role? I could have a CLI Troubleshooter role with an MCP server that can execute cli commands for example. Roles being already handled by MCP, it would be simply being able to indicate that this role have these mcp servers by default or something... just a thought.

roychri avatar Mar 10 '25 13:03 roychri

@roychri from a UX perspective I really like that, and fits with agent paradigm of "agent is system prompt + tools" - I can't believe I didn't think of that.

It would require breaking change to roles, since today roles value is just a list of strings. Unless we added some kind of mcp::fetch mcp::sqlite sort of coding which feels kinda janky

Maybe there's a new thing called toolroles or agents that supports

toolroles:
  default:
    prompt: []
    mcpServers:
      - sqlite
      - fetch

and would be mutually exclusive with roles (maybe even honoring the same -r flags, etc)

just riffing here, and tbh not sure exactly when I'll be able to put in more time on this

dexhorthy avatar Mar 11 '25 20:03 dexhorthy

This is merged on main!

Pleas, if you can, give it a try and let us know what you thinkg 🙏🏻

caarlos0 avatar May 23 '25 17:05 caarlos0

just went here to check if it's ready once in while and it's been merged 20 minutes ago🙏🙏 certainly need to try this

thedenisnikulin avatar May 23 '25 18:05 thedenisnikulin