JD.SemanticKernel.Connectors.ClaudeCode
Wire your local Claude Code session — or a standard Anthropic API key — into any Semantic Kernel application with a single extension method call.
var kernel = Kernel.CreateBuilder()
.UseClaudeCodeChatCompletion(apiKey: "sk-ant-api...")
.Build();
For local interactive development, you can also enable Claude Code OAuth session support.
Compliance-first defaults
- API keys are the default path.
- Claude Code OAuth support is disabled unless you explicitly set
ClaudeSession:EnableOAuthTokenSupport=true. - OAuth paths are restricted to interactive sessions and are not intended for unattended automation.
- Reference terms: Consumer Terms, Commercial Terms.
Why this package?
Claude Code uses OAuth tokens (sk-ant-oat*) that require a special HTTP request signature
before api.anthropic.com will accept them. The standard x-api-key header flow does not work
for these tokens. This package handles that signature transparently — including the
anthropic-beta, user-agent, and x-app headers required by the OAuth path — while falling
back cleanly to standard API key auth when a sk-ant-api* key is supplied instead.
Quick links
| Topic | Description |
|---|---|
| Getting Started | Minimal working example — SK kernel in five lines |
| Credential Resolution | How tokens are found and which source wins |
| Kernel Builder Integration | Full UseClaudeCodeChatCompletion() reference |
| Service Collection Integration | DI/IServiceCollection registration |
| HTTP Client Factory | Bring-your-own-provider scenarios |
| Configuration Reference | All options, environment variables, JSON config |
| Sample Tools | Four sample projects demonstrating agentic workflows |
| API Reference | Full generated API docs |
Sample tools
Four sample projects built on this package demonstrate real-world agentic workflows:
| Tool | Command | Description |
|---|---|---|
| Gherkin Generator | jdgerkinator |
Acceptance criteria → .feature files |
| PR Review Agent | jdpr |
AI code review for GitHub / ADO / GitLab |
| Codebase Explorer | jdxplr |
Profile a codebase → markdown knowledgebase |
| Todo Extractor | (library demo) | Extract structured todos from natural language |
See the Sample Tools overview for installation and architecture details.
Supported targets
| TFM | SK extensions | Core auth types |
|---|---|---|
netstandard2.0 |
— | ✓ |
net8.0 |
✓ | ✓ |
net10.0 |
✓ | ✓ |