Skip to content

Commit 3fca9a9

Browse files
authored
Merge branch 'main' into almaleksia/fix-oci-config
2 parents 0b4d5ed + b1ab893 commit 3fca9a9

File tree

3 files changed

+86
-9
lines changed

3 files changed

+86
-9
lines changed

docs/installation-guides/install-claude.md

Lines changed: 26 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,25 @@ echo -e ".env\n.mcp.json" >> .gitignore
2828

2929
### Remote Server Setup (Streamable HTTP)
3030

31+
> **Note**: For Claude Code versions **2.1.1 and newer**, use the `add-json` command format below. For older versions, see the [legacy command format](#for-older-versions-of-claude-code).
32+
3133
1. Run the following command in the terminal (not in Claude Code CLI):
3234
```bash
33-
claude mcp add --transport http github https://api.githubcopilot.com/mcp -H "Authorization: Bearer YOUR_GITHUB_PAT"
35+
claude mcp add-json github '{"type":"http","url":"https://api.githubcopilot.com/mcp","headers":{"Authorization":"Bearer YOUR_GITHUB_PAT"}}'
3436
```
3537

3638
With an environment variable:
3739
```bash
38-
claude mcp add --transport http github https://api.githubcopilot.com/mcp -H "Authorization: Bearer $(grep GITHUB_PAT .env | cut -d '=' -f2)"
40+
claude mcp add-json github '{"type":"http","url":"https://api.githubcopilot.com/mcp","headers":{"Authorization":"Bearer '"$(grep GITHUB_PAT .env | cut -d '=' -f2)"'"}}'
3941
```
42+
43+
> **About the `--scope` flag** (optional): Use this to specify where the configuration is stored:
44+
> - `local` (default): Available only to you in the current project (was called `project` in older versions)
45+
> - `project`: Shared with everyone in the project via `.mcp.json` file
46+
> - `user`: Available to you across all projects (was called `global` in older versions)
47+
>
48+
> Example: Add `--scope user` to the end of the command to make it available across all projects.
49+
4050
2. Restart Claude Code
4151
3. Run `claude mcp list` to see if the GitHub server is configured
4252

@@ -72,6 +82,19 @@ claude mcp list
7282
claude mcp get github
7383
```
7484

85+
### For Older Versions of Claude Code
86+
87+
If you're using Claude Code version **2.1.0 or earlier**, use this legacy command format:
88+
89+
```bash
90+
claude mcp add --transport http github https://api.githubcopilot.com/mcp -H "Authorization: Bearer YOUR_GITHUB_PAT"
91+
```
92+
93+
With an environment variable:
94+
```bash
95+
claude mcp add --transport http github https://api.githubcopilot.com/mcp -H "Authorization: Bearer $(grep GITHUB_PAT .env | cut -d '=' -f2)"
96+
```
97+
7598
---
7699

77100
## Claude Desktop
@@ -161,7 +184,4 @@ Add this codeblock to your `claude_desktop_config.json`:
161184

162185
- The npm package `@modelcontextprotocol/server-github` is deprecated as of April 2025
163186
- Remote server requires Streamable HTTP support (check your Claude version)
164-
- Configuration scopes for Claude Code:
165-
- `-s user`: Available across all projects
166-
- `-s project`: Shared via `.mcp.json` file
167-
- Default: `local` (current project only)
187+
- For Claude Code configuration scopes, see the `--scope` flag documentation in the [Remote Server Setup](#remote-server-setup-streamable-http) section

pkg/inventory/builder.go

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -149,11 +149,14 @@ func (b *Builder) Build() *Inventory {
149149
if len(b.additionalTools) > 0 {
150150
r.additionalTools = make(map[string]bool, len(b.additionalTools))
151151
for _, name := range b.additionalTools {
152-
// Resolve deprecated aliases to canonical names
152+
// Always include the original name - this handles the case where
153+
// the tool exists but is controlled by a feature flag that's OFF.
154+
r.additionalTools[name] = true
155+
// Also include the canonical name if this is a deprecated alias.
156+
// This handles the case where the feature flag is ON and only
157+
// the new consolidated tool is available.
153158
if canonical, isAlias := b.deprecatedAliases[name]; isAlias {
154159
r.additionalTools[canonical] = true
155-
} else {
156-
r.additionalTools[name] = true
157160
}
158161
}
159162
}

pkg/inventory/registry_test.go

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1688,3 +1688,57 @@ func TestForMCPRequest_ToolsCall_FeatureFlaggedVariants(t *testing.T) {
16881688
availableOn[0].FeatureFlagEnable, availableOn[0].FeatureFlagDisable)
16891689
}
16901690
}
1691+
1692+
// TestWithTools_DeprecatedAliasAndFeatureFlag tests that deprecated aliases work correctly
1693+
// when the old tool is controlled by a feature flag. This covers the scenario where:
1694+
// - Old tool "old_tool" has FeatureFlagDisable="my_flag" (available when flag is OFF)
1695+
// - New tool "new_tool" has FeatureFlagEnable="my_flag" (available when flag is ON)
1696+
// - Deprecated alias maps "old_tool" -> "new_tool"
1697+
// - User specifies --tools=old_tool
1698+
// Expected behavior:
1699+
// - Flag OFF: old_tool should be available (not the new_tool via alias)
1700+
// - Flag ON: new_tool should be available (via alias resolution)
1701+
func TestWithTools_DeprecatedAliasAndFeatureFlag(t *testing.T) {
1702+
oldTool := mockToolWithFlags("old_tool", "actions", true, "", "my_flag")
1703+
newTool := mockToolWithFlags("new_tool", "actions", true, "my_flag", "")
1704+
tools := []ServerTool{oldTool, newTool}
1705+
1706+
deprecatedAliases := map[string]string{
1707+
"old_tool": "new_tool",
1708+
}
1709+
1710+
// Test 1: Flag OFF - old_tool should be available via direct name match
1711+
// (not via alias resolution to new_tool, since old_tool still exists)
1712+
regFlagOff := NewBuilder().
1713+
SetTools(tools).
1714+
WithDeprecatedAliases(deprecatedAliases).
1715+
WithToolsets([]string{}). // No toolsets enabled
1716+
WithTools([]string{"old_tool"}). // Explicitly request old tool
1717+
Build()
1718+
availableOff := regFlagOff.AvailableTools(context.Background())
1719+
if len(availableOff) != 1 {
1720+
t.Fatalf("Flag OFF: Expected 1 tool, got %d", len(availableOff))
1721+
}
1722+
if availableOff[0].Tool.Name != "old_tool" {
1723+
t.Errorf("Flag OFF: Expected old_tool, got %s", availableOff[0].Tool.Name)
1724+
}
1725+
1726+
// Test 2: Flag ON - new_tool should be available via alias resolution
1727+
checker := func(_ context.Context, flag string) (bool, error) {
1728+
return flag == "my_flag", nil
1729+
}
1730+
regFlagOn := NewBuilder().
1731+
SetTools(tools).
1732+
WithDeprecatedAliases(deprecatedAliases).
1733+
WithToolsets([]string{}). // No toolsets enabled
1734+
WithTools([]string{"old_tool"}). // Request old tool name
1735+
WithFeatureChecker(checker).
1736+
Build()
1737+
availableOn := regFlagOn.AvailableTools(context.Background())
1738+
if len(availableOn) != 1 {
1739+
t.Fatalf("Flag ON: Expected 1 tool, got %d", len(availableOn))
1740+
}
1741+
if availableOn[0].Tool.Name != "new_tool" {
1742+
t.Errorf("Flag ON: Expected new_tool (via alias), got %s", availableOn[0].Tool.Name)
1743+
}
1744+
}

0 commit comments

Comments
 (0)