Skip to content

Question: How to correctly add mcp server #123

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

Open
alexiokay opened this issue Apr 10, 2025 · 7 comments
Open

Question: How to correctly add mcp server #123

alexiokay opened this issue Apr 10, 2025 · 7 comments
Assignees

Comments

@alexiokay
Copy link

alexiokay commented Apr 10, 2025

He, I'm trying to work with simple client chat implementation and add mcp server for example: https://smithery.ai/server/@turkyden/weather

this is my config:

# MCP server configuration
[mcp]
[[mcp.server]]
name = "weather"
protocol = "sse"
url = "https://server.smithery.ai/@turkyden/weather"
api_key = ""

how to correctly connect to this server and correctly pass api key?

from server docs:

const transport = createTransport("https://server.smithery.ai/@turkyden/weather", {}, "your-smithery-api-key")

but i dont really understand how to structure the url., when i init chat i get

Failed to create MCP clients: Transport error: HTTP status client error (404 Not Found) for url (https://server.smithery.ai/@turkyden/weather)

diffrent servers has diffrent configuration schemas, so the case will be diffrent right? then how the configuration.rs should be written to work universally for diffrent servers? I want to simply allow my app users to add mcp servers

@jokemanfire
Copy link
Collaborator

jokemanfire commented Apr 10, 2025

from the smithery's sdk code,it looks like the transport url use /ws , it is websocket , but now we not support the transport directly. If we should support it ? @4t145
Image
now ,we have a example for ws, you can have a look first , example

@4t145
Copy link
Collaborator

4t145 commented Apr 11, 2025

@jokemanfire @alexiokay As they mentioned in #95, we can add some extra lib like rmcp-ws to support this. Sounds good?

@alexiokay
Copy link
Author

alexiokay commented Apr 11, 2025

@jokemanfire Thanks for the example, I'll try it at daytime.

@4t145
Yes it sounds good if it's a feature to the current library, but I think it should use rust-tls for wss and clean tokio implementation for ws, bcs I know there are some other libraries to build websockets and network tools but some ppl use different ones and it would kind of derby their repos + everyone use tokio.

Idk, I'm new to rust btw. But it's just what I realized.

When can the feature be expected?

@4t145
Copy link
Collaborator

4t145 commented Apr 11, 2025

@alexiokay rcmp relies on tokio so I would assume every one use tokio. And current ws example transport can be built on an async stream so it is irrelevant to client or server implementation.

@jokemanfire
Copy link
Collaborator

jokemanfire commented Apr 11, 2025

@jokemanfire @alexiokay As they mentioned in #95, we can add some extra lib like rmcp-ws to support this. Sounds good?正如他们在 #95 中提到的,我们可以添加一些额外的库如 rmcp-ws 来支持这个功能。好吗?

I agree, After all, most projects now support. We should move it to milestone

@alexiokay
Copy link
Author

alexiokay commented Apr 15, 2025

I tried to connect the client to different servers via websockets, from my code and also tried from testing apps for websockets connection, the result is always -> websocket connected -> disconnected.. without any response.

I tried typing the urls from documentation, looked at other repos to find how they convert the urls, but I ended up using stdio npx command. Only that works.

And I had to add env to the server config to find npx system path, otherwise "npx is not a command" , bla bla bla.. it kind of sucks, should be global and path should be detected automatically or mentioned in the example readme.

Also the simple-client-example didn't work for me, I used open AI models, and I had API response errors, then problems with reading response, it didn't want to call any tool, so I had to change the code to make it actually work.

@jokemanfire
Copy link
Collaborator

jokemanfire commented Apr 15, 2025

I tried to connect the client to different servers via websockets, from my code and also tried from testing apps for websockets connection, the result is always -> websocket connected -> disconnected.. without any response.

I think use rust-sdk to interact with smithery.ai may be hard now, because they may be changed some sdk impl in their own repo. But you can provide more information to let us know.

Also the simple-client-example didn't work for me, I used open AI models, and I had API response errors, then problems
with reading response, it didn't want to call any tool, so I had to change the code to make it actually work.

If there are some bugs or some confusions, you can share with me , let's to fix it. . All discussion will be welcome. Just support more info. :)

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

No branches or pull requests

3 participants