-
Notifications
You must be signed in to change notification settings - Fork 51
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
Possible to launch a server and client in separate processes? #84
Comments
I am not sure I fully understand. MCP is a client / server architecture. Clients and Servers operate independently and speak over a transport to each other. Implementing a clientIf you want to implement a client, you likely want to connect to servers either via STDIO or HTTP+SSE. For STDIO you spawn a server executable via Since you mentioned 'in the same script'. If you want to have a stdio client, you need to spawn a server. However, this is not the same script. STDIO Servers are just programs that listen for JSON-RPC messages on STDIN and write JSON-RPC messages to stdout. It might help to take https://modelcontextprotocol.io/llms-full.txt, put it into Claude and ask the model for more help to understand the concept. Implementing a serverIf you are only interested in implementing a server, you never need to start a client. I would recommend a framework like https://github.com/jlowin/fastmcp for ease of use. I hope this helps. Let me know if you have more questions., |
@dsp-ant yea yea I guess I'm just confused. The example in the readme is something like:
But in this example, it seems like the client depends on variables that you can only get from launching the server? How do you launch them separately? I may have missed where this was documented. An example for the target usage I am looking for:
If we can achieve something similar to the above, would love to add it to llama-index, but so far I haven't found a way to achieve the above using the current mcp package/docs. |
When looking at the examples, it seems like you always need to launch the server and client in the same script, because they share the read/write variables.
Is there a way to launch these two pieces in their own scripts? If so, is it documented? This feels like an extremely common use case that might be missing.
Trying to write an MCP server integration for tools in llama-index and realized I can't figure it out.
Thanks for any help!
The text was updated successfully, but these errors were encountered: