Skip to content

Commit f90dc35

Browse files
kmoscoeclincoln8gemini-code-assist[bot]
authored
Add headers for agents connecting to remote servers (#664)
* remove references to dataclass objects * Fix a copy-paste error. * remove extra file * Create placeholders for LLM pages * rename to MCP * complete rename * remove old file * Changes from Keyur * Add target tag * Rewording suggested by Keyur * Remove extraneous text * Fix a copy-paste error. * Migrate MCP docs to docsite * Restructuring * Remove unused file * Add TOCs etc. * Update var formatting * comments from Keyur * another change from Keyur * Update mcp/index.md Co-authored-by: Christie Ellks <calinc@google.com> * Changes from Christie * Apply suggestion from @clincoln8 Co-authored-by: Christie Ellks <calinc@google.com> * More changes from Christie * Changes from Dan * Link fixes * Remove MCP inspector info * Add more context to agent dev doc * fix formatting * Create placeholders for LLM pages * merge * Slight rewording based on comment from Christie * Lots of restructuring * More work on Gemini CLI extension * More changes * more changes * more changes * Update mcp/run_tools.md Co-authored-by: Christie Ellks <calinc@google.com> * implement suggestions from Christie * Add some bullets to comparison section * Fix update section * rename "prompt" to "context" * add mention of Gemini CLI extension for custom DC * Update custom DC vars procedure * Remove reference to .env file in extension run * slight fix * Add section on creating a custom extension * Some rewording * Fix formatting * More revisions and edits * Remove file from other branch * minor edits * Add Windows command * Add warning about nvm * Remove warning * Remove reference to node.js * Update mcp/run_tools.md Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> * Add required header to connect to a remote server * Add additional accept type * Add code for sample agent headers * Apply suggestion from @gemini-code-assist[bot] Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> --------- Co-authored-by: Christie Ellks <calinc@google.com> Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
1 parent f363ca5 commit f90dc35

File tree

2 files changed

+16
-5
lines changed

2 files changed

+16
-5
lines changed

mcp/index.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ At this time, there is no centrally deployed server; you run your own server, an
2323

2424
![alt text](/assets/images/mcp.png)
2525

26+
You can run the server and client locally, or you can run the server and client on different machines.
27+
2628
## Tools
2729

2830
The server currently supports the following tools:

mcp/run_tools.md

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,11 @@ To configure Gemini CLI to recognize the Data Commons server, edit the relevant
230230
{
231231
"mcpServers": {
232232
"datacommons-mcp": {
233-
"httpUrl": "http://<var>HOST</var>:<var>PORT</var>/mcp"
233+
"httpUrl": "http://<var>HOST</var>:<var>PORT</var>/mcp",
234+
"headers": {
235+
"Content-Type": "application/json",
236+
"Accept": "application/json, text/event-stream"
237+
},
234238
// other settings as above
235239
}
236240
}
@@ -313,10 +317,15 @@ root_agent = LlmAgent(
313317
# ...
314318
tools=[McpToolset(
315319
connection_params=StreamableHTTPConnectionParams(
316-
url=f"http://<host>:<port>/mcp"
317-
)
318-
)],
319-
)
320+
url=f"http://<host>:<port>/mcp",
321+
headers={
322+
"Content-Type": "application/json",
323+
"Accept": "application/json, text/event-stream"
324+
},
325+
),
326+
)
327+
],
328+
)
320329
```
321330

322331
## Sample queries

0 commit comments

Comments
 (0)