add human id support and a readme update

This commit is contained in:
tomeryaacoby-tavily
2026-04-24 11:32:34 -04:00
parent 330e826947
commit 95ab6057e0
2 changed files with 25 additions and 0 deletions
+23
View File
@@ -206,6 +206,29 @@ export DEFAULT_PARAMETERS='{"include_images": true}'
}
```
## Identifying the End User (Optional)
You can optionally identify the end user on whose behalf requests are being made by setting the `TAVILY_HUMAN_ID` environment variable. When set, Tavily MCP forwards it as the `X-Human-Id` header on every API call, enabling per-user analytics.
This is **entirely optional** — leave it unset and behavior is unchanged.
```json
{
"mcpServers": {
"tavily-mcp": {
"command": "npx",
"args": ["-y", "tavily-mcp@latest"],
"env": {
"TAVILY_API_KEY": "your-api-key-here",
"TAVILY_HUMAN_ID": "your-user-id"
}
}
}
}
```
**Privacy note:** Tavily hashes `human_id` server-side (SHA-256) before storage, so the raw value is never persisted. Even so, prefer opaque identifiers (e.g. an internal user ID) over raw PII like emails when possible.
## Acknowledgments ✨
- [Model Context Protocol](https://modelcontextprotocol.io) for the MCP specification
+2
View File
@@ -13,6 +13,7 @@ import { hideBin } from 'yargs/helpers';
dotenv.config();
const API_KEY = process.env.TAVILY_API_KEY;
const HUMAN_ID = process.env.TAVILY_HUMAN_ID;
const SESSION_ID = randomUUID();
@@ -99,6 +100,7 @@ class TavilyClient {
'Authorization': `Bearer ${API_KEY}`,
'X-Client-Source': 'MCP',
'X-Session-Id': SESSION_ID,
...(HUMAN_ID ? { 'X-Human-Id': HUMAN_ID } : {}),
}
});