I need to reimplement the server side of the ../explain/ in a separate folder/package

---

no I want yo uto reimplement it in go here in netbird repo as a new package

---

now create a main or cmd package to run it

---

use yaml config style for this

---

output a yaml for anthropic with github mcp server support

---

write it to config.yaml

---

all tools allowed

---

Access to fetch at 'http://localhost:3080/api/ai/chat' from origin 'http://localhost:3000' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Fix this

---

Anthropic API error 400: {"type":"error","error":{"type":"invalid_request_error","message":"tools.0: Input tag 'mcp' found using 'type' does not match any of the expected tags: 'bash_20250124', 'code_execution_20250522', 'code_execution_20250825', 'code_execution_20260120', 'custom', 'memory_20250818', 'text_editor_20250124', 'text_editor_20250429', 'text_editor_20250728', 'tool_search_tool_bm25', 'tool_search_tool_bm25_20251119', 'tool_search_tool_regex', 'tool_search_tool_regex_20251119', 'web_fetch_20250910', 'web_fetch_20260209', 'web_fetch_20260309', 'web_search_20250305', 'web_search_20260209'"},"request_id":"REDACTED"}

---

Sorry, I couldn't get a response. Error: 502: {"error":"Anthropic API error 400: {"type":"error","error":{"type":"invalid_request_error","message":"mcp_servers.0.type: Field required"},"request_id":"req_011CZhEKMsatvensD47nkMnx"}"}

---

this request structure works: curl https://api.anthropic.com/v1/messages \
  -H "Content-Type: application/json" \
  -H "X-API-Key: $ANTHROPIC_KEY" \
  -H "anthropic-version: 2023-06-01" \
  -H "anthropic-beta: mcp-client-2025-11-20" \
  -d '{
    "model": "claude-opus-4-6",
    "max_tokens": 1000,
    "messages": [{"role": "assistant", "content": "What tools do you have available?"}],
    "mcp_servers": [
      {
        "type": "url",
        "url": "https://api.githubcopilot.com/mcp/x/repos",
        "name": "github-mcp",
        "authorization_token": “$GITHUB_MCP_KEY"
      }
    ],
    "tools": [
      {
        "type": "mcp_toolset",
        "mcp_server_name": "example-mcp"
      }
    ]
  }'

---

[Request interrupted by user]

---

this works: curl https://api.anthropic.com/v1/messages \
  -H "Content-Type: application/json" \
  -H "X-API-Key: $ANTHROPIC_KEY" \
  -H "anthropic-version: 2023-06-01" \
  -H "anthropic-beta: mcp-client-2025-11-20" \
  -d '{
  "model": "claude-opus-4-6",
  "max_tokens": 4096,
  "messages": [
    {
      "role": "user",
      "content": "Use the GitHub MCP tool to read relevant GitHub repository netbirdio/docs and page src/pages/manage/reverse-proxy/index.mdx. Then explain what the Reverse Proxy feature is"
    }
  ],
  "mcp_servers": [
    {
      "type": "url",
      "url": "https://api.githubcopilot.com/mcp/x/repos",
      "name": "github-mcp",
      "authorization_token": "'"$GITHUB_MCP_KEY"'"
    }
  ],
  "tools": [
    {
      "type": "mcp_toolset",
      "mcp_server_name": "github-mcp"
    }
  ]
}'

---

I need to improve the system prompt and move it to the config yaml. E.g., I want to give it direct doc pages from the repository. The pages are coming in the context. What would be the structure of the client lib to send context? I want generic one. This is the one: {"messages":[{"role":"context","content":"Docs: https://docs.netbird.io/manage/reverse-proxy, https://docs.netbird.io/manage/reverse-proxy/authentication, https://docs.netbird.io/manage/reverse-proxy#services"},{"role":"user","content":"Explain \"Service Type\" on Add Service modal in Reverse Proxy"}]}

---

I will be sending direct references to doc pages