Skip to content
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

Update mcp tool URI to handle multiple tools #3462

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

ajshedivy
Copy link
Contributor

@ajshedivy ajshedivy commented Dec 19, 2024

Description

Update mcp tool URI to handle multiple tools.

changes made

  • update type of config.experimental.modelContextProtocolServers to TransportOptions[]
  • update MCP server parsing logic
  • add MCP server id as the hostname in mcp uri (MCPConnection.modifyConfig)
    • mcp://{MCPID}/{TOOL_NAME}

Checklist

  • The relevant docs, if any, have been updated or created
  • The relevant tests, if any, have been updated or created

Screenshots

[ For visual changes, include screenshots. ]

Testing instructions

make sure to change modelContextProtocolServer -> modelContextProtocolServers in your config.json
example config:

"experimental": {
    "useTools": true,
    "modelContextProtocolServers": {
      "filesystem": {
        "type": "stdio",
        "command": "node",
        "args": [
          "/Users/adamshedivy/.nvm/versions/node/v22.6.0/lib/node_modules/@modelcontextprotocol/server-filesystem/dist/index.js",
          "/Users/adamshedivy/Documents/test"
        ]
      },
      "db2i": {
        "type": "stdio",
        "command": "uv",
        "args": [
          "--directory",
          "/Users/adamshedivy/Documents/anthro/db2i-mcp-server",
          "run",
          "db2i-mcp-server"
        ]
      }
    }
  }

Note that db2i is a custom MCP server.

Here is an example of calling 2 tools from different MCP servers:
image

Copy link

netlify bot commented Dec 19, 2024

Deploy Preview for continuedev ready!

Name Link
🔨 Latest commit 2c2e6ac
🔍 Latest deploy log https://app.netlify.com/sites/continuedev/deploys/6764a10098b5760008f03ae1
😎 Deploy Preview https://deploy-preview-3462--continuedev.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@YanxingLiu
Copy link

Hello, Thanks for your work. I have modified the config and updated the continue to pre-release. But after that, the continue will stay in loading state.
image
The modified config is:
image
I am sure that the npx can work:
image
I would like to ask if you know why this is.

@ajshedivy
Copy link
Contributor Author

ajshedivy commented Dec 20, 2024

@YanxingLiu the @MCP context provider only looks at available server resources -> https://modelcontextprotocol.io/docs/concepts/resources

the server-filesystem mcp server does not expose any external resources, so this the context provider wont return any items. The context provider could be updated with a message saying "no available" resources.

The server-filesystem does expose a resource: https://github.com/modelcontextprotocol/servers/tree/main/src/filesystem#resources but I can can't find the resource referenced in the source 🤔

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants