-
Notifications
You must be signed in to change notification settings - Fork 159
feat: mcp support, openai update, refactor #486
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
Conversation
Co-authored-by: Dex <[email protected]>
Signed-off-by: Carlos Alexandro Becker <[email protected]>
Signed-off-by: Carlos Alexandro Becker <[email protected]>
- migrating to new lib - adding mcp support todo: - fix azure - test copilot
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.
Pull Request Overview
This PR aims to support multiple MCP providers while refactoring and standardizing client interactions for OpenAI, Anthropic, Cohere, Ollama, and Google streams. The key changes include:
- Replacing the legacy openai package with the new "github.com/openai/openai-go" package and updating client configuration types.
- Refactoring stream handling methods and message conversion logic across multiple modules.
- Adding support and CLI flags for MCP functionality (listing MCP servers and tools).
Reviewed Changes
Copilot reviewed 17 out of 18 changed files in this pull request and generated 1 comment.
Show a summary per file
File | Description |
---|---|
stream.go | Updated client configuration and message role remapping for OpenAI streams. |
openai.go | Introduced new OpenAI client config and stream logic with minor error formatting issues. |
ollama.go | Adjusted stream response types and error handling to match new API types. |
mods.go | Updated config usage, error handling, and stream command logic. |
mcp.go | Added MCP support functions and tool-calling logic. |
main.go | Introduced new CLI flags for MCP features and updated flag registration. |
google.go, format.go, config.go, cohere.go, cache.go, anthropic.go | Updated type conversions, error handling, and message encoding/decoding. |
Files not reviewed (1)
- go.mod: Language not supported
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.
Pull Request Overview
This PR introduces support for MCP servers while refactoring and updating various API clients (Google, OpenAI, Anthropic, Cohere) along with improvements in caching and configuration. Key changes include:
- Adding MCP server configuration options and command-line flags.
- Refactoring client implementations and their types (e.g., renaming token structs in Copilot).
- Migrating to generic cache implementations and updating dependency versions.
Reviewed Changes
Copilot reviewed 39 out of 39 changed files in this pull request and generated 1 comment.
Show a summary per file
File | Description |
---|---|
internal/google/google.go | Added Google client streaming support with minor error message inconsistency. |
internal/google/format.go | Refactored conversion from proto messages to Google-specific content. |
internal/copilot/copilot.go | Updated Copilot authentication handling and renamed types for clarity. |
internal/cohere/* | Integrated and refactored support for the Cohere API client streaming. |
internal/cache/* | Introduced generic expiring and conversation cache implementations. |
internal/anthropic/* | Enhanced Anthropic streaming client and message conversion functions. |
config.go & config_template.yml | Added and documented MCP server options in configuration. |
go.mod & README.md | Updated dependencies and usage documentation to reflect new MCP support. |
Comments suppressed due to low confidence (1)
internal/copilot/copilot.go:46
- [nitpick] The field name 'cache' is ambiguous as it appears to store the cache directory. Renaming it to 'cacheDir' would better indicate its purpose.
cache string
Co-authored-by: Copilot <[email protected]>
BTW, some more MCP servers to use in testing: mcp-servers:
github:
command: docker
args:
- run
- "-i"
- "--rm"
- "-e"
- GITHUB_PERSONAL_ACCESS_TOKEN
- "ghcr.io/github/github-mcp-server"
puppeteer:
command: docker
args:
- run
- "-i"
- "--rm"
- "--init"
- "-e"
- DOCKER_CONTAINER=true
- mcp/puppeteer
sequentialthinking:
command: docker
args:
- run
- --rm
- -i
- mcp/sequentialthinking
time:
command: docker
args:
- run
- -i
- --rm
- mcp/time
- --local-timezone=America/Sao_Paulo
memory:
command: docker
args:
- run
- -i
- --rm
- mcp/memory
fetch:
command: docker
args:
- run
- -i
- --rm
- mcp/fetch |
Signed-off-by: Carlos Alexandro Becker <[email protected]>
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.
Pull Request Overview
This PR introduces support for MCP servers for selected providers (Anthropic and OpenAI), updates the OpenAI and Anthropics libraries, and refactors client implementations along with better code organization and a new streaming client interface. Key changes include the addition of MCP server configuration in the config files, major refactoring and renaming in the copilot and client packages, and removal of legacy code files.
Reviewed Changes
Copilot reviewed 39 out of 39 changed files in this pull request and generated 1 comment.
Show a summary per file
File | Description |
---|---|
internal/google/google.go | Refactored Google API client implementation with an incorrect API reference in comments. |
internal/copilot/copilot.go | Renamed and refactored Copilot client components to improve clarity. |
internal/cohere/(format.go, cohere.go) | Updated Cohere client implementation and message conversion logic. |
internal/cache/(expiring.go, convo.go, cache.go) | Updated caching mechanisms and associated tests. |
internal/anthropic/(format.go, anthropic.go) | Refactored Anthropic client code and added MCP tool integration. |
config_template.yml, config.go | Extended configuration support for MCP servers and renamed config fields. |
go.mod, README.md | Updated dependencies and documentation to reflect new features. |
This ended up being a way bigger change than I thought it would, and I think we should probably refactor further.
So far, this is what I've done:
proto
package with generic types to use with all clientsSince we support a myriad of providers, for now I think we can add MCP to only anthropic and openai to get a feel on how it'll hold up.
It looks like this:
closes #460
closes #397