llm-functions icon indicating copy to clipboard operation
llm-functions copied to clipboard

Documentation for using mcp bridge with agents

Open kiil opened this issue 9 months ago • 5 comments

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

After looking thoroughly at both the documentation for the mcp bridge and the example agents, and after spending many hours doing my own experiments:

I have NOT found a way to use the functions provided by the mcp bridge inside the agents.

(I have used the mcp functions directly in roles without issue.)

Describe the solution you'd like

I would like a clear and concise, and preferably working, example of how to use mcp bridge with agents.

In general the documentation is very good, and the examples are plentiful and excellent. But I find this particular combination to be undocumented so far.

kiil avatar Mar 26 '25 07:03 kiil

This would be useful useful, I am assuming just building the function.json with argc build and using that inside an agent configuration (replace the function.json) ensuring the mcp server has started would not work?

captalphabet avatar Apr 23 '25 07:04 captalphabet

@captalphabet

I am assuming just building the function.json with argc build and using that inside an agent configuration (replace the function.json) ensuring the mcp server has started would not work

In my experience that does not suffice.

kiil avatar Apr 23 '25 07:04 kiil

The way I got it working was by generating the functions.json using argc mcp start, which will place the file in the root of the repo, then copying it into the agent folder. This works as long as you don't have any other agent tool defined in the agent folder, for example tools.txt, which would overwrite functions.json when running argc build.

I see this as a workaround because it involves manual steps, conflicts with native tools and doesn't allow to specify MCP servers per agent but only globally.

edobez avatar Jul 25 '25 13:07 edobez

In the meantime, I've been using a custom workaround for this that I pushed out to this fork if anyone wants to use it.

Basically it enables you to use MCP servers in your agents, and you can still use your agents with or without the bridge MCP server running.

The short version is: You'll update your agent's index.yaml with a new field:

mcp_tools:
  - github
  - sqlite

This is ignored when you run argc build. So if you have a tools.sh in your agent's directory, the functions.json generated is untouched and remains exactly the same as before.

So you can still use your agent without an MCP server.

However, if you now run argc mcp start, which as you mentioned merges the main functions.json together with the functions for each MCP server, it will do the following:

  1. Merge the main functions.json with the functions for each MCP server
  2. Find every agent that has a non-empty mcp_tools field in its index.yaml
  3. Use the names of the tools in the mcp_tools field to filter out only tools from the main functions.json that correspond to those MCP servers
  4. Merge each MCP-enabled agent's functions.json with the additional functions from the main functions.json

This process is reversed when you run argc mcp stop so your agent's config goes back to normal.

The name of the MCP servers directly corresponds to the key of each MCP server in your mcp.json under the mcpServers key.

I've included an example in the fork by updating both the README and index.yaml for the demo agent.

A new dependency was also added to be sure to install yq.

I hope this helps someone as much as it helped me!

Dark-Alex-17 avatar Aug 22 '25 23:08 Dark-Alex-17

Hi! What @Dark-Alex-17 did seems like a good solution, separating the tools and the mcp servers. Maybe it could be merged ?

0fflineuser avatar Sep 12 '25 09:09 0fflineuser