Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions packages/mcp-client/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,16 +44,16 @@ The agent will load available MCP tools (by default, connecting to a filesystem

### Configuration (Environment Variables)

* `HF_TOKEN` (Required): Your Hugging Face API token.
* `HF_TOKEN` (Optional): Your Hugging Face API token. Required if you use an Inference Provider on HF.
* `MODEL_ID` (Optional): The model ID to use for the agent's inference. Defaults to `Qwen/Qwen2.5-72B-Instruct`.
* `PROVIDER` (Optional): The inference provider. Defaults to `together`. See `@huggingface/inference` for available providers.
* `EXPERIMENTAL_HF_MCP_SERVER` (Optional): Set to `true` to enable connection to an experimental Hugging Face MCP server (requires separate setup).
* `ENDPOINT_URL` or `BASE_URL` (Optional): A custom base URL (local for instance) to call.

Example with custom model:

```bash
export HF_TOKEN="hf_..."
export MODEL_ID="mistralai/Mixtral-8x7B-Instruct-v0.1"
export MODEL_ID="Qwen/Qwen2.5-72B-Instruct"
pnpm agent
```

Expand Down
4 changes: 2 additions & 2 deletions packages/mcp-client/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ async function main() {
process.exit(0);
}

if (!process.env.HF_TOKEN) {
console.error(`a valid HF_TOKEN must be present in the env`);
if (!ENDPOINT_URL && !process.env.HF_TOKEN) {
console.error(`To use a remote inference provider, a valid HF_TOKEN must be present in the env`);
process.exit(1);
}

Expand Down
2 changes: 1 addition & 1 deletion packages/mcp-client/src/Agent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ export class Agent extends McpClient {
}
) & {
model: string;
apiKey: string;
apiKey?: string;
servers: (ServerConfig | StdioServerParameters)[];
prompt?: string;
}) {
Expand Down
2 changes: 1 addition & 1 deletion packages/mcp-client/src/McpClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ export class McpClient {
}
) & {
model: string;
apiKey: string;
apiKey?: string;
}) {
this.client = endpointUrl ? new InferenceClient(apiKey, { endpointUrl: endpointUrl }) : new InferenceClient(apiKey);
this.provider = provider;
Expand Down
2 changes: 1 addition & 1 deletion packages/mcp-client/test/McpClient.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ describe("McpClient", () => {
const client = new McpClient({
provider: "together",
model: "Qwen/Qwen2.5-72B-Instruct",
apiKey: process.env.HF_TOKEN ?? "",
apiKey: process.env.HF_TOKEN,
});
expect(client).toBeDefined();
expect(client.availableTools.length).toBe(0);
Expand Down