Skip to content

Commit 8cea55e

Browse files
committed
one-shot a README using Gemini 2.5 Pro
1 parent df2fb7d commit 8cea55e

File tree

1 file changed

+72
-0
lines changed

1 file changed

+72
-0
lines changed

packages/mcp-client/README.md

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
# @huggingface/mcp-client
2+
3+
Client for the Model Context Protocol (MCP).
4+
5+
This package provides a client implementation for interacting with MCP servers, built on top of our Inference Providers client, `@huggingface/inference`.
6+
7+
It includes an example CLI smol Agent that can leverage MCP tools.
8+
9+
## Installation
10+
11+
This package is part of the Hugging Face JS monorepo. To install dependencies for all packages, run from the root of the repository:
12+
13+
```bash
14+
pnpm install
15+
```
16+
17+
## Usage (CLI Agent)
18+
19+
The package includes a command-line interface (CLI) agent that demonstrates how to use the MCP client.
20+
21+
### Prerequisites
22+
23+
* **Hugging Face API Token:** You need a Hugging Face API token with appropriate permissions. Set it as an environment variable:
24+
```bash
25+
export HF_TOKEN="hf_..."
26+
```
27+
28+
### Running the Agent
29+
30+
Navigate to the package directory and run the agent script:
31+
32+
```bash
33+
cd packages/mcp-client
34+
pnpm agent
35+
```
36+
37+
Alternatively, run from the root of the monorepo:
38+
39+
```bash
40+
pnpm --filter @huggingface/mcp-client agent
41+
```
42+
43+
The agent will load available MCP tools (by default, connecting to a filesystem server for your Desktop and a Playwright server) and prompt you for input (`>`).
44+
45+
### Configuration (Environment Variables)
46+
47+
* `HF_TOKEN` (Required): Your Hugging Face API token.
48+
* `MODEL_ID` (Optional): The model ID to use for the agent's inference. Defaults to `Qwen/Qwen2.5-72B-Instruct`.
49+
* `PROVIDER` (Optional): The inference provider. Defaults to `together`. See `@huggingface/inference` for available providers.
50+
* `EXPERIMENTAL_HF_MCP_SERVER` (Optional): Set to `true` to enable connection to an experimental Hugging Face MCP server (requires separate setup).
51+
52+
Example with custom model:
53+
54+
```bash
55+
export HF_TOKEN="hf_..."
56+
export MODEL_ID="mistralai/Mixtral-8x7B-Instruct-v0.1"
57+
pnpm agent
58+
```
59+
60+
## Development
61+
62+
Common development tasks can be run using pnpm scripts:
63+
64+
* `pnpm build`: Build the package.
65+
* `pnpm lint`: Lint and fix code style.
66+
* `pnpm format`: Format code using Prettier.
67+
* `pnpm test`: Run tests using Vitest.
68+
* `pnpm check`: Type-check the code using TypeScript.
69+
70+
## License
71+
72+
MIT

0 commit comments

Comments
 (0)