How to get a list of all tools from the current server? #219
Replies: 2 comments 8 replies
-
If it's the same application, then an in-memory transport is an option. You should be able to find some of the test code setups doing that and I think someone is working on making that transport an explicitly available option alongside the other transport. But why not simply call the tools directly if you're hosting the server in the same application? |
Beta Was this translation helpful? Give feedback.
-
Hi @PederHP – I'm working on something very similar to what @jaywork2020 did. Specifically, I'm implementing an Orchard Core module that provides a feature allowing users to provide an MCP server from within the tenant, so that it can be accessed by external MCP clients. In addition to that, I also want to give users the ability to connect to their own MCP server from within the app itself (i.e., the app would act as a client as well). You can see the current state of my work in this PR: My library lets users define an "AI Profile" via AI—a way to configure everything related to a model, including deployment settings, system messages, parameters, MCP connection settings, etc. One option I’m trying to support is allowing a model to connect to the MCP server that's hosted within the currently running Orchard Core tenant. Here’s where I enable the MCP server inside the Orchard Core tenant: And this is the spot where I attempt to create an in-memory MCP client to connect to the local server and register its tools into the current chat request: Do you have any suggestions for improving this setup? Especially when it comes to correctly creating an in-memory transport for the MCP client to talk to the local server? I'd really appreciate your thoughts. |
Beta Was this translation helpful? Give feedback.
-
Pre-submission Checklist
Question Category
Your Question
I'm following the example from the MCP C# SDK:
https://github.com/modelcontextprotocol/csharp-sdk/blob/f135355bf985297d03ce6084dd131a31f231672f/src/ModelContextProtocol.AspNetCore/README.md
In that example, the server is explicitly configured with:
However, in my setup, I'm not using this
ConfigureKestrel
configuration at all.Is this a valid approach, or do I need to explicitly enable Kestrel to host the MCP server?
Also, I want to connect to this server from another part of the same application, essentially having the app act as both an MCP server and an MCP client (connecting to itself locally).
What’s the best way to do this without explicitly specifying a port?
Beta Was this translation helpful? Give feedback.
All reactions