-
Notifications
You must be signed in to change notification settings - Fork 762
[Tiny-Agent] Switch to VSCode MCP format + fix headers handling #3166
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Working authentication using the example in the PR description:
|
The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you
@hanouticelina I've updated this PR to update the {
"type": "http",
"url": "https://huggingface.co/mcp",
"headers": {
"Authorization": "Bearer ${input:hf-token}"
}
} this is a breaking change and we'll need to update examples in https://huggingface.co/datasets/tiny-agents/tiny-agents but it's definitely best to do it now rather than later. I'll open the equivalent PR in JS as well. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good, thank you!
Added a reminder for myself to update https://huggingface.co/datasets/tiny-agents/tiny-agents when we release the next minor version of hfh.
Same PR as huggingface/huggingface_hub#3166 in Python. This PR introduces breaking changes but I think it's best to do it now. Goal is to have the same format as [VSCode MCP config](https://code.visualstudio.com/docs/copilot/chat/mcp-servers#_configuration-format) e.g. ```json { "model": "Qwen/Qwen2.5-72B-Instruct", "provider": "nebius", "inputs": [ { "type": "promptString", "id": "hf-token", "description": "Token for Hugging Face API access", "password": true } ], "servers": [ { "type": "http", "url": "https://huggingface.co/mcp", "headers": { "Authorization": "Bearer ${input:hf-token}" } } ] } ``` breaking changes: - no more `config` nested mapping => everything at root level - `headers` at root level instead of inside options.requestInit - updated the way values are pulled from ENV (based on input id) Once this PR and huggingface/huggingface_hub#3166 are approved, we can merge + release them at the same time + update the config in https://huggingface.co/datasets/tiny-agents/tiny-agents to follow the new convention. For now, only [wauplin/library-pr-reviewer](https://huggingface.co/datasets/tiny-agents/tiny-agents/tree/main/wauplin/library-pr-reviewer) has been updated for testing. ``` pnpm run cli run wauplin/library-pr-reviewer ```
* [Tiny-Agent] Fix headers handling + secrets management * no whitespace in id * switch to VSCode config file format
EDIT: PR merged and released. Made a release on JS SDK as well and updated all configs in https://huggingface.co/datasets/tiny-agents/tiny-agents. |
how do you generate the data.parquet file, how of curiosity? |
Using this script. I wanted to add it in a Space and use webhooks to trigger on each update but never did it in end (so I'm running manually when I think about it). Goal is just to make the dataset viewer work. Would be a good use case of HF CI or Jobs. import json
from pathlib import Path
from tempfile import TemporaryDirectory
import pandas as pd
from huggingface_hub import snapshot_download, upload_file
DATASET_ID = "tiny-agents/tiny-agents"
CONFIG_FILE = "agent.json"
PROMPT_FILE = "PROMPT.md"
README_FILE = "README.md"
folder = Path(snapshot_download(repo_id=DATASET_ID, repo_type="dataset"))
def load_agent(agent_path: Path):
"""Load agent configuration from a given path."""
config_path = agent_path / CONFIG_FILE
prompt_path = agent_path / PROMPT_FILE
readme_path = agent_path / README_FILE
if not config_path.exists():
raise FileNotFoundError(f"Configuration file {CONFIG_FILE} not found in {agent_path}")
config = json.dumps(json.loads(config_path.read_text()), indent=2)
prompt = prompt_path.read_text() if prompt_path.exists() else None
readme = readme_path.read_text() if readme_path.exists() else None
return {
"name": f"{agent_path.parent.name}/{agent_path.name}",
"config": config,
"readme": readme,
"prompt": prompt,
}
AGENTS = []
for namespace in folder.iterdir():
if namespace.is_dir():
for agent in namespace.iterdir():
if agent.is_dir():
try:
AGENTS.append(load_agent(agent))
except Exception as e:
print(f"Skipping {agent.name}: {e}")
AGENTS.sort(key=lambda x: x["name"])
# Export as parquet file
with TemporaryDirectory() as tmpdir:
tmp_path = Path(tmpdir) / "data.parquet"
pd.DataFrame(AGENTS).to_parquet(tmp_path, index=False)
upload_file(
path_or_fileobj=tmp_path,
path_in_repo="data.parquet",
repo_id=DATASET_ID,
repo_type="dataset",
commit_message="Update summary for dataset-viewer",
) |
Fix docs example after huggingface/huggingface_hub#3166 / #1556. Since release [0.33.2](https://github.com/huggingface/huggingface_hub/releases/tag/v0.33.2) `tiny-agents` config follow VSCode format. We made the change without a proper deprecation warning as it's still experimental and we wanted to harmonize with VSCode as quickly as possible (to avoid future conflicts). Related PRs: - huggingface/hub-docs#1816 - huggingface/transformers#39245 - huggingface/huggingface_hub#3205 - #1599
EDIT: PR merged and released. Made a release on JS SDK as well and updated all configs in https://huggingface.co/datasets/tiny-agents/tiny-agents.
Currently headers are configured in
tiny-agent
usingservers[].config.options.requestInit.headers
(which we inherited from JS MCP client). However it would be preferable to follow VSCode MCP configuration i.e.servers[].headers
:I also updated the "default env variable loading" logic. Before we were loading based on the key where the value will be used (in this case
Authorization
). With the PR, we now build the ENV_VAR based on "input id"hf-token => HF_TOKEN
. This is a breaking change but more future-proof IMOOnce approved on this side, I'll make the update in the JS client.
Note: this is orthogonal to the MCP + OAuth topic
EDIT: equivalent PR in JS huggingface/huggingface.js#1556