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()   // reads ~/.claude/.credentials.json automatically
    .Build();

No tokens to manage. No configuration files to maintain. If you are logged in to Claude Code locally (claude login), the package finds and validates your session automatically.


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.


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