feat: add support for mcp #44
Merged
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.
What does this PR do?
This pull request introduces support for MCP (Model Context Protocol) tools, enabling the Grok CLI to integrate with external services like Linear and GitHub. The changes include updates to the CLI, core agent logic, and configuration management to support MCP servers and tools. Below are the most significant changes:
Enhancements to CLI and User Documentation
stdio,http,sse). [1] [2]add,add-json,remove,list,test) via thesrc/commands/mcp.tsmodule. These commands allow users to configure and interact with MCP servers directly from the CLI.Core Agent Updates
GrokAgentfor initializing MCP servers (initializeMCP) and ensuring MCP readiness before processing user messages. This includes loading configuration, connecting to servers, and handling errors gracefully. [1] [2]GrokAgentto dynamically load tools, including MCP tools, using thegetAllGrokToolsmethod. This ensures that tools from MCP servers are seamlessly integrated into the agent's capabilities. [1] [2]Tool Execution and Management
GrokAgent, parsing arguments and handling results or errors. [1] [2]src/grok/tools.tsto convert MCP tools into Grok-compatible tools and merge them with existing tools. [1] [2]Dependency and Configuration Updates
@modelcontextprotocol/sdklibrary topackage.jsonfor MCP support.Integration with Main CLI
src/index.ts), making it accessible to users. [1] [2]Fixes #17
Checklist