-
Notifications
You must be signed in to change notification settings - Fork 529
PoC: InferenceClient
is also a McpClient
#1351
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
Merged
Merged
Changes from 9 commits
Commits
Show all changes
37 commits
Select commit
Hold shift + click to select a range
4abd81f
Add dependency (hard dep for now)
julien-c 9ffab69
First draft
julien-c 44e4ff8
implement tool calling
julien-c 07bd67c
scaffolding done by Gemini 2.5 Pro ✨
julien-c a50dd62
Update tsconfig.json
julien-c de8477b
move file around
julien-c 47d6b3c
fixes
julien-c 7c5f6c6
revert those changes
julien-c e1c4e65
Fix + improve types following #1367
julien-c 63d8db0
Update .github/workflows/mcp-client-publish.yml
julien-c ad4d1a0
move types/node dep to root cc @coyotte508
julien-c 0d8d6aa
Get version number from package.json
julien-c 01d2d54
Better API + `addMcpServers`
julien-c b56258a
Add smol Agent
julien-c 21649b2
better
julien-c d936c51
Add Smol agent implem
julien-c aa49d3d
improvements
julien-c daccdb4
improvements
julien-c 46c7e62
very basic test
julien-c df2fb7d
Add playwright-mcp as default tool
julien-c 8cea55e
one-shot a README using Gemini 2.5 Pro
julien-c f18d904
doc
julien-c e3d39ee
add tiny comment
julien-c a3af347
Switch to streaming mode
julien-c 07fb0e3
Better default provider for this model + better formatting
julien-c a7ef69b
easier debugging
julien-c a710db0
[cli] better formatting
julien-c 8f4858a
Fix for some providers
julien-c ebea1fb
clearer var name
julien-c 765a5b8
easier to debug
julien-c f057aca
better var names...
julien-c 4bb2ff0
Simpler loop
julien-c ee831d8
handle an `AbortSignal`
julien-c fdd548b
[cli] better formatting
julien-c 7124e26
add prettier ignore
SBrandeis b38c0ac
add eslintignore
SBrandeis 9734a91
Merge branch 'main' into mcp-client
SBrandeis File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
name: MCP Client - Version and Release | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
newversion: | ||
type: choice | ||
description: "Semantic Version Bump Type" | ||
default: patch | ||
options: | ||
- patch | ||
- minor | ||
- major | ||
|
||
concurrency: | ||
group: "push-to-main" | ||
|
||
defaults: | ||
run: | ||
working-directory: packages/mcp-client | ||
|
||
jobs: | ||
version_and_release: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
token: ${{ secrets.BOT_ACCESS_TOKEN }} | ||
- run: npm install -g corepack@latest && corepack enable | ||
- uses: actions/setup-node@v3 | ||
with: | ||
node-version: "20" | ||
cache: "pnpm" | ||
cache-dependency-path: | | ||
packages/mcp-client/pnpm-lock.yaml | ||
packages/doc-internal/pnpm-lock.yaml | ||
registry-url: "https://registry.npmjs.org" | ||
- run: pnpm install | ||
- run: git config --global user.name machineuser | ||
- run: git config --global user.email [email protected] | ||
- run: | | ||
PACKAGE_VERSION=$(node -p "require('./package.json').version") | ||
BUMPED_VERSION=$(node -p "require('semver').inc('$PACKAGE_VERSION', '${{ github.event.inputs.newversion }}')") | ||
# Update package.json with the new version | ||
node -e "const fs = require('fs'); const package = JSON.parse(fs.readFileSync('./package.json')); package.version = '$BUMPED_VERSION'; fs.writeFileSync('./package.json', JSON.stringify(package, null, '\t') + '\n');" | ||
pnpm --filter doc-internal run fix-cdn-versions | ||
git add ../.. | ||
git commit -m "🔖 @huggingface/mcp-client $BUMPED_VERSION" | ||
git tag "mcp-client-v$BUMPED_VERSION" | ||
|
||
# Add checks for dependencies if needed, similar to hub-publish.yml | ||
# - name: "Check Deps are published before publishing this package" | ||
# run: pnpm -w check-deps <dependency_name> | ||
|
||
- run: pnpm publish --no-git-checks . | ||
env: | ||
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | ||
- run: git pull --rebase && git push --follow-tags | ||
# hack - reuse actions/setup-node@v3 just to set a new registry | ||
- uses: actions/setup-node@v3 | ||
with: | ||
node-version: "20" | ||
registry-url: "https://npm.pkg.github.com" | ||
# Disable for now, until github supports PATs for writing github packages (https://github.com/github/roadmap/issues/558) | ||
# - run: pnpm publish --no-git-checks . | ||
# env: | ||
# NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
- name: "Update Doc" | ||
uses: peter-evans/repository-dispatch@v2 | ||
with: | ||
event-type: doc-build | ||
token: ${{ secrets.BOT_ACCESS_TOKEN }} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
{ | ||
"name": "@huggingface/mcp-client", | ||
"packageManager": "[email protected]", | ||
"version": "0.0.1", | ||
"description": "Client for the Model Context Protocol", | ||
"repository": "https://github.com/huggingface/huggingface.js.git", | ||
"publishConfig": { | ||
"access": "public" | ||
}, | ||
"main": "./dist/index.js", | ||
"module": "./dist/index.mjs", | ||
"types": "./dist/index.d.ts", | ||
"exports": { | ||
".": { | ||
"types": "./dist/index.d.ts", | ||
"require": "./dist/index.js", | ||
"import": "./dist/index.mjs" | ||
} | ||
}, | ||
"engines": { | ||
"node": ">=18" | ||
}, | ||
"source": "index.ts", | ||
"scripts": { | ||
"lint": "eslint --quiet --fix --ext .cjs,.ts .", | ||
"lint:check": "eslint --ext .cjs,.ts .", | ||
"format": "prettier --write .", | ||
"format:check": "prettier --check .", | ||
"prepublishOnly": "pnpm run build", | ||
"build": "tsup src/index.ts --format cjs,esm --clean && tsc --emitDeclarationOnly --declaration", | ||
"prepare": "pnpm run build", | ||
"test": "vitest run", | ||
"check": "tsc" | ||
}, | ||
"files": [ | ||
"src", | ||
"dist", | ||
"index.ts", | ||
"tsconfig.json" | ||
], | ||
"keywords": [ | ||
"huggingface", | ||
"model context protocol", | ||
"mcp", | ||
"client", | ||
"hugging", | ||
"face" | ||
], | ||
"author": "Hugging Face", | ||
"license": "MIT", | ||
"devDependencies": { | ||
"@types/node": "^22.14.1" | ||
}, | ||
julien-c marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
"dependencies": { | ||
"@huggingface/inference": "workspace:^", | ||
"@huggingface/tasks": "workspace:^", | ||
"@modelcontextprotocol/sdk": "^1.9.0" | ||
} | ||
} |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.