Skip to content

[mcp-client] Allow arbitrary endpoint via URL (in both McpClient and Agent) #1396

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 6 commits into from
Apr 29, 2025

Conversation

julien-c
Copy link
Member

@julien-c julien-c commented Apr 29, 2025

for local AI for instance 🔥

To try it

Using LM Studio + this model: https://lmstudio.ai/model/qwen2.5-14b-instruct

# in ./packages/mcp-client
ENDPOINT_URL=http://localhost:1234/v1 MODEL_ID=qwen2.5-14b-instruct tsx cli.ts

@HuggingFaceDocBuilderDev

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.

@julien-c julien-c changed the title [mcp-client] Allow local endpoint via URL (in both McpClient and Agent) [mcp-client] Allow arbitrary endpoint via URL (in both McpClient and Agent) Apr 29, 2025
@julien-c julien-c marked this pull request as ready for review April 29, 2025 10:43
model: string;
apiKey: string;
servers: StdioServerParameters[];
prompt?: string;
}) {
super({ provider, model, apiKey });
super(provider ? { provider, baseUrl, model, apiKey } : { provider, baseUrl, model, apiKey });
/// ^This shenanigan is just here to please an overzealous TS type-checker.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🫠

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cc @coyotte508 if he has an idea to "fix" (in a later PR?)

Copy link
Member

@coyotte508 coyotte508 Apr 29, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I also had to write something like this in #1322 I think (before the force-push)

@gary149 gary149 self-requested a review April 29, 2025 14:37
Copy link
Contributor

@hanouticelina hanouticelina left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@julien-c
Copy link
Member Author

CI red on main so merging :)

@julien-c julien-c merged commit c10c090 into main Apr 29, 2025
4 of 6 checks passed
@julien-c julien-c deleted the mcp-client-local-endpoint branch April 29, 2025 14:45
@redthing1
Copy link

I tried this, I got this error:

Error: We have not been able to find inference provider information for model qwen3-30b-a3b.
    at getInferenceProviderMapping (/code/huggingface.js/packages/inference/dist/index.cjs:1406:11)
    at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
    at async makeRequestOptions (/code/huggingface.js/packages/inference/dist/index.cjs:1462:7)
    at async innerStreamingRequest (/code/huggingface.js/packages/inference/dist/index.cjs:1699:25)
    at async chatCompletionStream (/code/huggingface.js/packages/inference/dist/index.cjs:2031:3)
    at async Agent.processSingleTurnWithTools (/code/huggingface.js/packages/mcp-client/src/McpClient.ts:2:2634)
    at async Agent.run (/code/huggingface.js/packages/mcp-client/src/Agent.ts:8:1013)
    at async main (/code/huggingface.js/packages/mcp-client/cli.ts:4:259)

Node.js v23.9.0
 ELIFECYCLE  Command failed with exit code 7.
 ```

@Wauplin
Copy link
Contributor

Wauplin commented Apr 30, 2025

Hi @redthing1 , could you open a new issue for this + provide the command line/script you are using? Will be easier to help you this way.

Deep-unlearning pushed a commit that referenced this pull request May 13, 2025
…Agent) (#1396)

for local AI for instance 🔥

## To try it

Using LM Studio + this model:
https://lmstudio.ai/model/qwen2.5-14b-instruct

```sh
# in ./packages/mcp-client
ENDPOINT_URL=http://localhost:1234/v1 MODEL_ID=qwen2.5-14b-instruct tsx cli.ts
```

---------

Co-authored-by: Lucain <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants