-
Notifications
You must be signed in to change notification settings - Fork 115
feat: add MCP file support for ACP server configuration #214
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
Draft
35C4n0r
wants to merge
10
commits into
main
Choose a base branch
from
35C4n0r/acp-mcp
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
a9637f6
feat: add MCP file support for ACP server configuration
35C4n0r f607202
feat: add tests for MCP file handling and validation in server commands
35C4n0r 2fbafff
fix: improve error messages for MCP file handling in server commands
35C4n0r 12ecfa4
refactor: update MCP file handling to support new configuration forma…
35C4n0r 8183c5f
refactor: rename variable for MCP configuration to improve clarity
35C4n0r bf48373
docs: add MCP configuration section to README for experimental ACP tr…
35C4n0r 28158f3
feat: add AgentapiMcpConfig and AgentapiMcpServer types with conversi…
35C4n0r a9d80dc
refactor: update test case description for clarity in MCP server comm…
35C4n0r f31782b
chore: rename
35C4n0r c891ece
feat: enhance MCP server configuration with support for SSE type and …
35C4n0r 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
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,85 @@ | ||
| package acpio | ||
|
|
||
| import ( | ||
| "slices" | ||
|
|
||
| "github.com/coder/acp-go-sdk" | ||
| "golang.org/x/xerrors" | ||
| ) | ||
|
|
||
| // AgentapiMcpConfig represents the Claude MCP JSON format where mcpServers is a map | ||
| // with server names as keys. | ||
| type AgentapiMcpConfig struct { | ||
| McpServers map[string]AgentapiMcpServer `json:"mcpServers"` | ||
| } | ||
35C4n0r marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| // AgentapiMcpServer represents a single MCP server in Claude's format. | ||
| type AgentapiMcpServer struct { | ||
| // Type can be "stdio", "sse" or "http" | ||
| Type string `json:"type"` | ||
| // Stdio transport fields | ||
35C4n0r marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| Command string `json:"command,omitempty"` | ||
| Args []string `json:"args,omitempty"` | ||
| Env map[string]string `json:"env,omitempty"` | ||
| // HTTP | SSE transport fields | ||
| URL string `json:"url,omitempty"` | ||
| Headers map[string]string `json:"headers,omitempty"` | ||
| } | ||
|
|
||
| // convertAgentapiMcpToAcp converts a Claude MCP server config to the ACP format. | ||
| func (a *AgentapiMcpServer) convertAgentapiMcpToAcp(name string) (acp.McpServer, error) { | ||
| serverType := a.Type | ||
| acpMCPServer := acp.McpServer{} | ||
|
|
||
| if serverType == "stdio" { | ||
| if a.Command == "" { | ||
| return acp.McpServer{}, xerrors.Errorf("stdio server %q missing command", name) | ||
| } | ||
| // Convert env map to []EnvVariable | ||
| var envVars []acp.EnvVariable | ||
| for key, value := range a.Env { | ||
| envVars = append(envVars, acp.EnvVariable{ | ||
| Name: key, | ||
| Value: value, | ||
| }) | ||
| } | ||
35C4n0r marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| acpMCPServer.Stdio = &acp.McpServerStdio{ | ||
| Name: name, | ||
| Command: a.Command, | ||
| Args: a.Args, | ||
| Env: envVars, | ||
| } | ||
| } else if slices.Contains([]string{"http", "sse"}, serverType) { | ||
| if a.URL == "" { | ||
| return acp.McpServer{}, xerrors.Errorf("http server %q missing url", name) | ||
| } | ||
| // Convert headers map to []HttpHeader | ||
| var headers []acp.HttpHeader | ||
| for key, value := range a.Headers { | ||
| headers = append(headers, acp.HttpHeader{ | ||
| Name: key, | ||
| Value: value, | ||
| }) | ||
| } | ||
35C4n0r marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| if serverType == "sse" { | ||
| acpMCPServer.Sse = &acp.McpServerSse{ | ||
| Name: name, | ||
| Type: "sse", | ||
| Url: a.URL, | ||
| Headers: headers, | ||
| } | ||
| } else { | ||
| acpMCPServer.Http = &acp.McpServerHttp{ | ||
| Name: name, | ||
| Type: "http", | ||
| Url: a.URL, | ||
| Headers: headers, | ||
| } | ||
| } | ||
| } else { | ||
| return acp.McpServer{}, xerrors.Errorf("unsupported server type %q for server %q", serverType, name) | ||
| } | ||
| return acpMCPServer, nil | ||
| } | ||
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.