Run MCP tools

The Custom Data Commons services container includes the Data Commons MCP server as a component. This page describes how to connect from an AI agent to a local MCP server. This is step 4 of the recommended workflow.

Important: This feature is available starting from the stable release of 2026-02-10. To use it, you must sync your code to a stable release from that date or later, rebuild your image, and redeploy.

Configure the MCP server

The MCP server runs by default, in HTTP streaming mode, when you start up the services. You don’t need an API key for the server or for any agent connecting to it.

There are a few additional environment variables you can configure in your env.list file:

  • ENABLE_MCP: By default this is set to true. If you want to disable the MCP server from running, set it to false.
  • DC_SEARCH_SCOPE: This controls the datasets (base and/or custom) that are searched in response to AI queries. By default it is set to search both base and custom data (base_and_custom). If you would like to search only your custom data, set it to custom_only.

Connect an AI agent to a locally running server

You can use any AI agent to connect to the MCP server. The server is accessible at the /mcp endpoint.

Below we provide procedures for Gemini CLI and for a sample Google ADK agent provided in the GitHub Data Commons agent-toolkit repo. You should be able to adapt the configuration to any other MCP-compliant agent, including your own custom-built agent.

Use Gemini CLI

  1. If you don’t have it on your system, install Node.js.
  2. Install Google Gemini CLI.
  3. Start the service container if it’s not already running.
  4. Configure Gemini CLI to connect to the Data Commons MCP server: edit the relevant settings.json file (e.g. ~/.gemini/settings.json) to add the following:
     {
       ...
       "mcpServers": {
           "datacommons-mcp": {         
              "httpUrl": "http://localhost:8080/mcp"
           }
       }
       ...
     }
     
  5. From any directory, start Gemini as described in Run Gemini CLI.

Use the sample agent

  1. Install uv, a Python package manager.
  2. Start the services container if it’s not already running.
  3. From the desired directory, clone the agent-toolkit repo:
    git clone https://github.com/datacommonsorg/agent-toolkit.git
    

    Tip: You do not need to install the Google ADK; when you use the command we provide to start the agent, it downloads the ADK dependencies at run time.

  4. Modify packages/datacommons-mcp/examples/sample_agents/basic_agent/agent.py to set the url parameter of the StreamableHTTPConnectionParams object.
    ...
    tools=[McpToolset(
          connection_params=StreamableHTTPConnectionParams(
             url="http://localhost:8080/mcp",
             ...
           )
          )
         ]
    ...
    
  5. Customize the agent as desired, as described in Customize the agent.
  6. Start the agent as described in Run the startup commands.

Page last updated: February 24, 2026 • Send feedback about this page