-
Notifications
You must be signed in to change notification settings - Fork 56
Make AIShell an MCP client to expose MCP tools to its agents #392
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 all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
6b79089
Basic MCP support -- config, manager, server, tool. Use 'AIFunction' …
daxian-dbw 3b5d412
Basic end-to-end support in the openai agent
daxian-dbw b321f8a
Add '/mcp' command to display MCP servers and tools
daxian-dbw 4050bec
Update the Unicode symbol used to indicate 'Alert'
daxian-dbw 553e0c8
Simplify package reference
daxian-dbw 4a0cdfa
Add XML comment to a method
daxian-dbw 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
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
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
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,40 @@ | ||
using System.CommandLine; | ||
using AIShell.Abstraction; | ||
|
||
namespace AIShell.Kernel.Commands; | ||
|
||
internal sealed class McpCommand : CommandBase | ||
{ | ||
public McpCommand() | ||
: base("mcp", "Command for managing MCP servers and tools.") | ||
{ | ||
this.SetHandler(ShowMCPData); | ||
|
||
//var start = new Command("start", "Start an MCP server."); | ||
//var stop = new Command("stop", "Stop an MCP server."); | ||
//var server = new Argument<string>( | ||
// name: "server", | ||
// getDefaultValue: () => null, | ||
// description: "Name of an MCP server.").AddCompletions(AgentCompleter); | ||
|
||
//start.AddArgument(server); | ||
//start.SetHandler(StartMcpServer, server); | ||
|
||
//stop.AddArgument(server); | ||
//stop.SetHandler(StopMcpServer, server); | ||
} | ||
|
||
private void ShowMCPData() | ||
{ | ||
var shell = (Shell)Shell; | ||
var host = shell.Host; | ||
|
||
if (shell.McpManager.McpServers.Count is 0) | ||
{ | ||
host.WriteErrorLine("No MCP server is available."); | ||
return; | ||
} | ||
|
||
host.RenderMcpServersAndTools(shell.McpManager); | ||
} | ||
} |
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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should these commends be removed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The code was left intentionally. The code was for adding
/mcp start
and/mcp stop
, which are follow-up work listed in the PR description.