{"id":45034069,"url":"https://github.com/jerrettdavis/jd.semantickernel.connectors.claudecode","last_synced_at":"2026-05-04T17:03:03.306Z","repository":{"id":339313249,"uuid":"1161389596","full_name":"JerrettDavis/JD.SemanticKernel.Connectors.ClaudeCode","owner":"JerrettDavis","description":"A Semantic Kernel connector that bridges your local Claude Code OAuth session into Microsoft Semantic Kernel — no manual API key management needed.","archived":false,"fork":false,"pushed_at":"2026-04-06T15:08:56.000Z","size":837,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-04-06T17:03:34.669Z","etag":null,"topics":["ai","ai-agents","claude","claude-code","csharp","dotnet","semantic-kernel"],"latest_commit_sha":null,"homepage":"https://jerrettdavis.github.io/JD.SemanticKernel.Connectors.ClaudeCode/","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/JerrettDavis.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-02-19T03:44:02.000Z","updated_at":"2026-04-06T15:07:55.000Z","dependencies_parsed_at":"2026-04-06T17:00:59.188Z","dependency_job_id":null,"html_url":"https://github.com/JerrettDavis/JD.SemanticKernel.Connectors.ClaudeCode","commit_stats":null,"previous_names":["jerrettdavis/jd.semantickernel.connectors.claudecode"],"tags_count":48,"template":false,"template_full_name":null,"purl":"pkg:github/JerrettDavis/JD.SemanticKernel.Connectors.ClaudeCode","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JerrettDavis%2FJD.SemanticKernel.Connectors.ClaudeCode","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JerrettDavis%2FJD.SemanticKernel.Connectors.ClaudeCode/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JerrettDavis%2FJD.SemanticKernel.Connectors.ClaudeCode/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JerrettDavis%2FJD.SemanticKernel.Connectors.ClaudeCode/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/JerrettDavis","download_url":"https://codeload.github.com/JerrettDavis/JD.SemanticKernel.Connectors.ClaudeCode/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JerrettDavis%2FJD.SemanticKernel.Connectors.ClaudeCode/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32361477,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-27T20:07:02.737Z","status":"ssl_error","status_checked_at":"2026-04-27T20:07:00.910Z","response_time":128,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ai","ai-agents","claude","claude-code","csharp","dotnet","semantic-kernel"],"created_at":"2026-02-19T06:08:29.374Z","updated_at":"2026-04-28T01:00:38.341Z","avatar_url":"https://github.com/JerrettDavis.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# JD.SemanticKernel.Connectors.ClaudeCode\r\n\r\n[![NuGet](https://img.shields.io/nuget/v/JD.SemanticKernel.Connectors.ClaudeCode.svg)](https://www.nuget.org/packages/JD.SemanticKernel.Connectors.ClaudeCode)\r\n[![NuGet Downloads](https://img.shields.io/nuget/dt/JD.SemanticKernel.Connectors.ClaudeCode.svg)](https://www.nuget.org/packages/JD.SemanticKernel.Connectors.ClaudeCode)\r\n[![CI](https://github.com/JerrettDavis/JD.SemanticKernel.Connectors.ClaudeCode/actions/workflows/ci.yml/badge.svg)](https://github.com/JerrettDavis/JD.SemanticKernel.Connectors.ClaudeCode/actions/workflows/ci.yml)\r\n[![CodeQL](https://github.com/JerrettDavis/JD.SemanticKernel.Connectors.ClaudeCode/actions/workflows/codeql-analysis.yml/badge.svg)](https://github.com/JerrettDavis/JD.SemanticKernel.Connectors.ClaudeCode/actions/workflows/codeql-analysis.yml)\r\n[![codecov](https://codecov.io/gh/JerrettDavis/JD.SemanticKernel.Connectors.ClaudeCode/graph/badge.svg)](https://codecov.io/gh/JerrettDavis/JD.SemanticKernel.Connectors.ClaudeCode)\r\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)\r\n\r\nA **Semantic Kernel connector** for Anthropic models with API-key-first authentication and optional local Claude Code OAuth support.\r\n\r\n## Features\r\n\r\n- **API-key-first authentication** — supports `sk-ant-api*` via options or `ANTHROPIC_API_KEY`\r\n- **Optional local OAuth support** — `sk-ant-oat*` is opt-in and interactive-only\r\n- **Multi-source credential resolution** — options/env API key first, then local OAuth sources\r\n- **Full Semantic Kernel integration** — `IKernelBuilder.UseClaudeCodeChatCompletion()` one-liner\r\n- **DI-friendly** — `IServiceCollection.AddClaudeCodeAuthentication()` for ASP.NET Core / Generic Host\r\n- **Broad TFM support** — `netstandard2.0`, `net8.0`, `net10.0`\r\n\r\n## Compliance Defaults\r\n\r\n- OAuth token support is **disabled by default**.\r\n- OAuth usage requires `EnableOAuthTokenSupport = true` and an interactive session.\r\n- Unattended or automated OAuth workflows are intentionally blocked.\r\n- For service, CI, or unattended usage, use Anthropic API keys (`sk-ant-api*`).\r\n- Anthropic Consumer Terms (effective October 8, 2025) apply to consumer-service usage:\r\n  \u003chttps://www.anthropic.com/legal/consumer-terms\u003e\r\n- Anthropic API keys are governed by Anthropic Commercial Terms:\r\n  \u003chttps://www.anthropic.com/legal/commercial-terms\u003e\r\n\r\n## Quick Start\r\n\r\n### Install\r\n\r\n```bash\r\ndotnet add package JD.SemanticKernel.Connectors.ClaudeCode\r\n```\r\n\r\n### Kernel Builder (Recommended)\r\n\r\n```csharp\r\nusing JD.SemanticKernel.Connectors.ClaudeCode;\r\n\r\nvar builder = Kernel.CreateBuilder();\r\nbuilder.UseClaudeCodeChatCompletion(apiKey: \"sk-ant-api...\"); // defaults to ClaudeModels.Default (Sonnet)\r\nvar kernel = builder.Build();\r\n\r\nvar result = await kernel.InvokePromptAsync(\"Hello, Claude!\");\r\nConsole.WriteLine(result);\r\n```\r\n\r\n### Service Collection (ASP.NET Core)\r\n\r\n```csharp\r\nbuilder.Services.AddClaudeCodeAuthentication(options =\u003e\r\n{\r\n    options.CredentialsPath = \"/custom/path/.credentials.json\"; // optional\r\n    options.EnableOAuthTokenSupport = true; // only for local interactive OAuth use\r\n});\r\n```\r\n\r\n### Configuration Binding\r\n\r\n```json\r\n{\r\n  \"ClaudeSession\": {\r\n    \"ApiKey\": null,\r\n    \"OAuthToken\": null,\r\n    \"EnableOAuthTokenSupport\": false,\r\n    \"CredentialsPath\": null\r\n  }\r\n}\r\n```\r\n\r\n```csharp\r\nbuilder.Services.AddClaudeCodeAuthentication(builder.Configuration);\r\n```\r\n\r\n## Credential Resolution Order\r\n\r\n| Priority | Source | Description |\r\n|----------|--------|-------------|\r\n| 1 | `ClaudeSession:ApiKey` | Explicit API key in options/config |\r\n| 2 | `ANTHROPIC_API_KEY` env var | Environment variable |\r\n| 3 | `ClaudeSession:OAuthToken` | Explicit OAuth token (requires `EnableOAuthTokenSupport = true`) |\r\n| 4 | `~/.claude/.credentials.json` | Local Claude Code session (requires `EnableOAuthTokenSupport = true`) |\r\n\r\n## Sample CLI Tools\r\n\r\n![CLI tools demo](docs/images/cli-help.png)\r\n\r\nThis repo includes sample projects demonstrating agentic workflows with Semantic Kernel:\r\n\r\n| Tool | Command | Description |\r\n|------|---------|-------------|\r\n| **Gherkin Generator** | `jdgerkinator` | Converts acceptance criteria into Gherkin/Reqnroll specs |\r\n| **PR Review Agent** | `jdpr` | Multi-provider PR review (GitHub, Azure DevOps, GitLab) |\r\n| **Codebase Explorer** | `jdxplr` | Profiles codebases into structured knowledgebases |\r\n| **Todo Extractor** | *(library demo)* | Extracts structured todos from natural language |\r\n\r\nInstall the CLI tools as global tools:\r\n\r\n```bash\r\ndotnet tool install -g JD.Tools.GherkinGenerator\r\ndotnet tool install -g JD.Tools.PullRequestReviewer\r\ndotnet tool install -g JD.Tools.CodebaseExplorer\r\n```\r\n\r\n## Models\r\n\r\nWell-known model constants are available via `ClaudeModels`:\r\n\r\n```csharp\r\nbuilder.UseClaudeCodeChatCompletion(ClaudeModels.Opus);   // claude-opus-4-6\r\nbuilder.UseClaudeCodeChatCompletion(ClaudeModels.Sonnet);  // claude-sonnet-4-6 (default)\r\nbuilder.UseClaudeCodeChatCompletion(ClaudeModels.Haiku);   // claude-haiku-4-5\r\n```\r\n\r\n## Documentation\r\n\r\nFull documentation is available at the [DocFX site](docs/) including:\r\n\r\n- [Getting Started](docs/articles/getting-started.md)\r\n- [Credential Resolution](docs/articles/credential-resolution.md)\r\n- [Kernel Builder Integration](docs/articles/kernel-builder-integration.md)\r\n- [Service Collection Integration](docs/articles/service-collection-integration.md)\r\n- [HttpClientFactory](docs/articles/http-client-factory.md)\r\n- [Configuration Reference](docs/articles/configuration-reference.md)\r\n- [Sample Tools Guide](docs/samples/index.md)\r\n\r\n## Building\r\n\r\n```bash\r\ndotnet build\r\ndotnet test\r\n```\r\n\r\n### Build Documentation\r\n\r\n```bash\r\ncd docs\r\ndotnet tool restore\r\ndotnet docfx docfx.json\r\n```\r\n\r\n## Shared Abstractions\r\n\r\nThis connector implements the **JD.SemanticKernel.Connectors.Abstractions** interfaces,\r\nenabling multi-provider bridging:\r\n\r\n| Interface | Implementation |\r\n|---|---|\r\n| `ISessionProvider` | `ClaudeCodeSessionProvider` — credential resolution with `IsAuthenticatedAsync()` |\r\n| `IModelDiscoveryProvider` | `ClaudeModelDiscovery` — returns known Claude model catalogue |\r\n| `SessionOptionsBase` | `ClaudeCodeSessionOptions` — inherits `DangerouslyDisableSslValidation`, `CustomEndpoint` |\r\n\r\nUse the same abstractions across providers:\r\n\r\n```csharp\r\nISessionProvider provider = isClaudeCode\r\n    ? claudeCodeProvider\r\n    : copilotProvider;\r\n\r\nvar creds = await provider.GetCredentialsAsync();\r\n```\r\n\r\n### Related Projects\r\n\r\n- **[JD.SemanticKernel.Connectors.GitHubCopilot](https://github.com/JerrettDavis/JD.SemanticKernel.Connectors.GitHubCopilot)** — Same pattern for GitHub Copilot subscriptions\r\n- **[JD.SemanticKernel.Extensions](https://github.com/JerrettDavis/JD.SemanticKernel.Extensions)** — SK extensions for skills, hooks, plugins, compaction, and semantic memory\r\n\r\n## License\r\n\r\n[MIT](LICENSE)\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjerrettdavis%2Fjd.semantickernel.connectors.claudecode","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjerrettdavis%2Fjd.semantickernel.connectors.claudecode","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjerrettdavis%2Fjd.semantickernel.connectors.claudecode/lists"}