How to use a remote MCP server tool in Dataiku

JohnB
JohnB Registered Posts: 37 ✭✭✭✭✭

Is there a doc about how to do this in a recipe or notebook?

I have created an MCP server following the tutorial here:

Building your MCP Server in Dataiku - Dataiku Developer Guide

I have tested this via MCP Inspector. Now I'd like to see how I can test this or an external MCP server from a Dataiku project.
The "wrapping up" section of the above tutorial says this:

"You can also access remote MCP servers in Dataiku using Python Recipe or Code Agent."

We're on DSS 14.2.3

Operating system used: RHEL

Best Answer

  • JohnB
    JohnB Registered Posts: 37 ✭✭✭✭✭
    Answer ✓

    Got this working from DSS 14.3.1

    • create a "Remote MCP connection" (uncheck SSE transport, use bearer token)
      • note that the tutorial's URL example needs a trailing slash after "/mcp" to work i.e. "…/mcp/"
    • in project, create an agent tool "Use an MCP Server"
      • specify the connection name created earlier
      • enable the tool listed under MCP tools
      • fill query and test (shows what the raw payload should look like)
    • in a notebook (for example) we can then call the tool
    import dataiku
    client = dataiku.api_client()
    project = client.get_default_project() tool_id = [t['id'] for t in project.list_agent_tools() if t['name'] == 'use_mcp_tool'][0] tool = project.get_agent_tool(tool_id) tool.run({"query": "what is the price of eggs"}, context=None, subtool_name="egg_prices_tool")

    This could then be used in a code agent.

Answers

  • FlorentD
    FlorentD Dataiker, Dataiku DSS Core Designer, Registered Posts: 41 Dataiker

    Hi,

    This tutorial is composed of two main sections:

    1. Create a Python file/script that runs an MCP server with a Tool.
    2. A Code Studio template to run and expose this script (so the MCP server with a Tool).

    In 14.2.1 (and above), there is an Agent Tool to run a local MCP server (https://doc.dataiku.com/dss/latest/agents/tools/local-mcp.html), and then you can use this tool in a Code Agent, so in a Notebook.

    Isn't it what you need?

  • JohnB
    JohnB Registered Posts: 37 ✭✭✭✭✭

    My question is about how to use a tool presented by an MCP server (remote or local) within a code agent.

    I was hoping there would be a starter code template for it in the current list that starts with "Simple LLM Mesh integration with streaming" …

  • JohnB
    JohnB Registered Posts: 37 ✭✭✭✭✭

    Just installed 14.3.0 which has a Remote MCP Connection. I can get it to test "OK" into the MCP server I created (i.e. it looks back at itself). Looks like there is an agent tool type to use this that I now need to explore

Setup Info
    Tags
      Help me…