--- layout: default title: Configure the MCP server nav_order: 6 parent: Build your own Data Commons redirect_from: /run_mcp_tools include_scripts: /assets/js/customdc-doc-tabs.js --- {:.no_toc} # Configure the MCP server The Custom Data Commons services container includes the [Data Commons MCP server](/mcp/index.html) as a component. This page describes how to set additional options on the server and connect from an AI agent to a locally running server. This is step 3 of the [recommended workflow](/custom_dc/index.html#workflow). 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. You can use any MCP-compliant agent. See [Query data interactively with an AI agent](/mcp/run_tools.html) for examples, and substitute your own application URL. * TOC {:toc} ## Set options There are a few additional environment variables you can configure, all of which are optional: - `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`. - `DC_INSTRUCTIONS_DIR`: This allows you to provide customized instructions for the server tools and agents making tool calls. For details, see [below](#instructions). To set the options on a locally running server, specify them in your `env.list` file, and restart the services, for example:
./run_cdc_dev_docker.sh --container service
docker run -it \
-p 8080:8080 \
-e DEBUG=true \
--env-file $PWD/custom_dc/env.list \
-v INPUT_DIRECTORY:INPUT_DIRECTORY \
-v OUTPUT_DIRECTORY:OUTPUT_DIRECTORY \
gcr.io/datcom-ci/datacommons-services:stable
INSTRUCTIONS_DIRECTORY/
├── server.md
└── tools/
└──TOOL_NAME.md
You can provide a Markdown file for each tool you want to customize. Any file you provide will completely replace the default version of the file. For any tool file you don't provide, the server will just use the default instructions.
> Tip: Most AI agents ignore `server.md` so there is little benefit to overriding this file specifically.
### Run the server locally
1. Create a new directory anywhere in your file system, as described above. For example:
```
cd projectdir
mkdir instructions
```
1. Go to
./run_cdc_dev_docker.sh --container service
docker run -it \
-p 8080:8080 \
-e DEBUG=true \
--env-file $PWD/custom_dc/env.list \
-v INPUT_DIRECTORY:INPUT_DIRECTORY \
-v OUTPUT_DIRECTORY:OUTPUT_DIRECTORY \
-v INSTRUCTIONS_DIRECTORY:INSTRUCTIONS_DIRECTORY \
gcr.io/datcom-ci/datacommons-services:stable
{
"mcpServers": {
"SERVER_NAME": {
"serverUrl": "http://localhost:8080/mcp"
}
}
}
The server name can be anything you want; for example, `datacommons-mcp-local`.
1. Run the IDE or CLI as usual.
1. Start sending [natural-language queries](/mcp/run_tools.html#sample-queries).
### Use the sample agent
1. Install [`uv`](https://docs.astral.sh/uv/getting-started/installation/), a Python package manager.
1. Start the services container if it's not already running.
1. From the desired directory, clone the `agent-toolkit` repo:
```bash
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](/mcp/run_tools.html#run-sample) to start the agent, it downloads the ADK dependencies at run time.
1. Modify [`packages/datacommons-mcp/examples/sample_agents/basic_agent/agent.py`](https://github.com/datacommonsorg/agent-toolkit/blob/main/packages/datacommons-mcp/examples/sample_agents/basic_agent/agent.py){: target="_blank"} to set the `url` parameter of the `StreamableHTTPConnectionParams` object.
...
tools=[McpToolset(
connection_params=StreamableHTTPConnectionParams(
url="http://localhost:8080/mcp",
...
)
)
]
...
1. Customize the agent as desired, as described in [Customize the agent](/mcp/run_tools.html#customize-agent).
1. Start the agent as described in [Run the startup commands](/mcp/run_tools.html#run-sample).