{"id":50646929,"url":"https://github.com/fkucukkara/copilot-sdk-playground","last_synced_at":"2026-06-07T13:02:45.432Z","repository":{"id":352501865,"uuid":"1169971383","full_name":"fkucukkara/copilot-sdk-playground","owner":"fkucukkara","description":"A demonstration of GitHub Copilot SDK capabilities using .NET 10 and .NET Aspire.","archived":false,"fork":false,"pushed_at":"2026-05-02T14:40:32.000Z","size":70,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-05-02T16:28:24.116Z","etag":null,"topics":["aspire","copilot-sdk","net10"],"latest_commit_sha":null,"homepage":"","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/fkucukkara.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"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-03-01T14:09:13.000Z","updated_at":"2026-05-02T14:40:36.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/fkucukkara/copilot-sdk-playground","commit_stats":null,"previous_names":["fkucukkara/copilot-sdk-playground"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/fkucukkara/copilot-sdk-playground","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fkucukkara%2Fcopilot-sdk-playground","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fkucukkara%2Fcopilot-sdk-playground/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fkucukkara%2Fcopilot-sdk-playground/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fkucukkara%2Fcopilot-sdk-playground/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fkucukkara","download_url":"https://codeload.github.com/fkucukkara/copilot-sdk-playground/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fkucukkara%2Fcopilot-sdk-playground/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34022032,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-07T02:00:07.652Z","response_time":124,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["aspire","copilot-sdk","net10"],"created_at":"2026-06-07T13:02:43.533Z","updated_at":"2026-06-07T13:02:45.426Z","avatar_url":"https://github.com/fkucukkara.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# CopilotSDK Playground\n\nA comprehensive demonstration of [GitHub Copilot SDK for .NET](https://github.com/github/copilot-sdk) capabilities, spanning five API projects that cover core chat, **RAG (Retrieval-Augmented Generation)**, **MCP tool servers**, and **multi-agent orchestration** — all wired together with **.NET 10** and **.NET Aspire**.\n\n## Solution Overview\n\n| Project | Port | Purpose |\n|---------|------|---------|\n| `CopilotSDKPlayground.Api` | 5100 | Core chat API with streaming SSE, tool calling, prompt templates, and Redis memory |\n| `CopilotSDKPlayground.RagApi` | 5200 | RAG pipeline: ingest documents → TF-IDF retrieval → grounded Copilot responses |\n| `CopilotSDKPlayground.McpServer` | 5300 | Standalone MCP tool server (Weather, Calculator, Time) |\n| `CopilotSDKPlayground.McpApi` | 5400 | Copilot sessions powered by MCP tools via ModelContextProtocol SDK |\n| `CopilotSDKPlayground.AgentsApi` | 5500 | Multi-agent patterns: Coordinator/Specialist + Orchestrator/SubAgent |\n\n```\n+------------------------------------------------------------------+\n|                     .NET Aspire AppHost                          |\n|                   (Aspire Dashboard + Redis)                     |\n|                                                                  |\n|  +----------+  +----------+  +-----------+  +------------+      |\n|  |    Api   |  |  RagApi  |  | McpServer |  | AgentsApi  |      |\n|  |streaming |  | TF-IDF   |  |  Weather  |  |Coordinator |      |\n|  |  tools   |  | retrieval|  |  Calc     |  |Orchestrator|      |\n|  |prompts   |  | grounded |  |  Time     |  |            |      |\n|  |  Redis   |  | answers  |  +-----+-----+  +------------+      |\n|  +----------+  +----------+        |                            |\n|                             +------v------+                     |\n|                             |   McpApi    |                     |\n|                             |Copilot+tools|                     |\n|                             +-------------+                     |\n+------------------------------------------------------------------+\n```\n\n## Prerequisites\n\n| Requirement | Notes |\n|-------------|-------|\n| [.NET 10 SDK](https://dotnet.microsoft.com/download/dotnet/10.0) | Version pinned in `global.json` |\n| GitHub CLI | `winget install GitHub.cli` |\n| Copilot CLI extension | `gh extension install github/gh-copilot` |\n| GitHub authentication | `gh auth login` |\n| GitHub Copilot subscription | Required for API access |\n| Docker Desktop | Required by Aspire for the Redis container |\n| Visual Studio 2022 17.13+ or VS Code + C# Dev Kit | |\n\n## Quick Start\n\n```bash\n# 1. Clone\ngit clone https://github.com/yourusername/CopilotSDKPlayground.git\ncd CopilotSDKPlayground\n\n# 2. Restore\ndotnet restore\n\n# 3. Run all projects via Aspire (recommended)\ndotnet run --project CopilotSDKPlayground.AppHost\n```\n\nAspire starts all five projects plus a Redis container and opens the **dashboard** at `https://localhost:17146`.\n\nEach project also runs standalone for focused development:\n\n```bash\ndotnet run --project CopilotSDKPlayground.Api\ndotnet run --project CopilotSDKPlayground.RagApi\ndotnet run --project CopilotSDKPlayground.McpServer  # start first when testing McpApi\ndotnet run --project CopilotSDKPlayground.McpApi\ndotnet run --project CopilotSDKPlayground.AgentsApi\n```\n\n---\n\n## Project Details\n\n### 1. Api — Core Chat + Extended Features\n\n**Path:** `CopilotSDKPlayground.Api/`\n**HTTP examples:** `CopilotSDKPlayground.Api/chat-examples.http`\n\nDemonstrates the full breadth of the Copilot SDK session capabilities.\n\n| Feature | Endpoint group | Description |\n|---------|---------------|-------------|\n| **Basic chat** | `/api/chat` | Create / query / history / delete sessions |\n| **Streaming SSE** | `/api/streaming` | Server-Sent Events responses via `Channel\u003cstring\u003e` |\n| **Tool calling** | `/api/tools` | AI-invoked functions (weather, calculator, clock) using `AIFunctionFactory.Create` |\n| **Prompt templates** | `/api/prompts` | Parameterised system prompts with `SystemMessageMode.Replace` |\n| **Redis memory** | `/api/memory` | Persistent conversation summaries stored in Redis |\n\n**Key SDK patterns:**\n- `SessionConfig { Streaming = true }` → `AssistantMessageDeltaEvent.Data.DeltaContent`\n- `AIFunctionFactory.Create` with local methods + `[Description]` attributes on parameters\n- `SessionConfig.Tools = [ tool1, tool2, tool3 ]`\n- `SessionConfig.SystemMessage = new SystemMessageConfig { Mode = SystemMessageMode.Replace, Content = \"...\" }`\n\n---\n\n### 2. RagApi — Retrieval-Augmented Generation\n\n**Path:** `CopilotSDKPlayground.RagApi/`\n**HTTP examples:** `CopilotSDKPlayground.RagApi/rag-examples.http`\n\nA complete RAG pipeline built in pure C# with no vector database dependencies.\n\n#### Architecture\n\n```\nUser query\n    |\n    v\nInMemoryVectorStore.Search(query, topK=3)   \u003c- TF-IDF cosine similarity\n    |                                          Sentence-aware sliding window chunking\n    v                                          Sparse Dictionary\u003cstring, double\u003e vectors\nRagCopilotService.BuildAugmentedPrompt()    \u003c- Injects retrieved chunks + similarity scores\n    |\n    v\nCopilot SDK session                         \u003c- Grounded response with inline citations\n```\n\n**Documents are pre-seeded on startup:**\n- `.NET 10 Key Features`\n- `.NET Aspire Overview`\n- `GitHub Copilot SDK for .NET`\n\n**Key implementation details:**\n- Chunking: sentence-aware sliding window (`TargetChunkWords=512`, `OverlapWords=52`)\n- Vectorisation: `log(1 + tf)` weighting; stop-word filtered\n- Similarity: cosine on sparse dictionaries (no ML dependency)\n- System prompt: `SystemMessageMode.Replace` with explicit \"only answer from context\" instruction\n\n| Endpoint | Method | Description |\n|----------|--------|-------------|\n| `/api/rag/documents` | GET | List ingested documents |\n| `/api/rag/documents` | POST | Ingest a new document (title + content + optional source) |\n| `/api/rag/documents/{id}` | DELETE | Remove document and its chunks |\n| `/api/rag/sessions` | POST | Create a RAG chat session |\n| `/api/rag/{sessionId}/query` | POST | Query with retrieval — response includes `retrievedChunks` |\n| `/api/rag/{sessionId}` | DELETE | Delete session |\n\n---\n\n### 3. McpServer — Model Context Protocol Tool Server\n\n**Path:** `CopilotSDKPlayground.McpServer/`\n**Package:** `ModelContextProtocol.AspNetCore 1.2.0`\n\nA stateless HTTP MCP server exposing three tools.\n\n```csharp\n// The complete MCP server registration in Program.cs\nbuilder.Services\n    .AddMcpServer()\n    .WithHttpTransport(options =\u003e options.Stateless = true)\n    .WithTools\u003cWeatherTool\u003e()\n    .WithTools\u003cCalculatorTool\u003e()\n    .WithTools\u003cTimeTool\u003e();\n\napp.MapMcp(\"/mcp\");\n```\n\n| Tool | Name | Description |\n|------|------|-------------|\n| `WeatherTool` | `get_weather` | Mock weather for 10 cities (Celsius/Fahrenheit) |\n| `CalculatorTool` | `calculate` | Safe arithmetic via `DataTable.Compute` |\n| `TimeTool` | `get_current_time` | Current time in any IANA timezone |\n\n**Key pattern:** `[McpServerToolType]` on the class + `[McpServerTool(Name=\"...\")]` on each method. Stateless transport is recommended for HTTP-hosted servers that don't need server-initiated requests.\n\n---\n\n### 4. McpApi — Copilot + MCP Bridge\n\n**Path:** `CopilotSDKPlayground.McpApi/`\n**HTTP examples:** `CopilotSDKPlayground.McpApi/mcp-examples.http`\n**Packages:** `GitHub.Copilot.SDK 0.1.29`, `ModelContextProtocol 1.2.0`\n\nBridges the MCP server's tools into a Copilot SDK session. Copilot automatically calls tools during conversation.\n\n#### Initialization flow\n\n```\nMcpCopilotService.InitializeAsync()\n    |\n    +- HttpClientTransport({ Endpoint = \"http://mcp-server/mcp\" }, httpClient)\n    |   +- Aspire service discovery resolves \"mcp-server\" hostname automatically\n    |\n    +- McpClient.CreateAsync(transport)\n    |\n    +- McpClient.ListToolsAsync()  -\u003e  IList\u003cMcpClientTool\u003e\n                                        McpClientTool : AIFunction\n                                                          |\n                                         SessionConfig.Tools = [.. _mcpTools]\n                                                          |\n                                         Copilot SDK invokes tools transparently\n```\n\n**Key insight:** `McpClientTool` inherits `AIFunction` (from `Microsoft.Extensions.AI`), so MCP tools plug directly into `SessionConfig.Tools` without any adapter code.\n\n| Endpoint | Method | Description |\n|----------|--------|-------------|\n| `/api/mcp/tools` | GET | List discovered MCP tools |\n| `/api/mcp/sessions` | POST | Create Copilot session with MCP tools loaded |\n| `/api/mcp/{sessionId}/messages` | POST | Chat — Copilot calls MCP tools as needed |\n| `/api/mcp/{sessionId}` | DELETE | Delete session |\n\n---\n\n### 5. AgentsApi — Multi-Agent Orchestration\n\n**Path:** `CopilotSDKPlayground.AgentsApi/`\n**HTTP examples:** `CopilotSDKPlayground.AgentsApi/agents-examples.http`\n\nDemonstrates two multi-agent patterns using only the Copilot SDK and ephemeral sessions.\n\n#### Pattern A: Coordinator / Specialist\n\n```\nUser task\n    |\n    v\nCoordinator agent (ephemeral session)\n    Returns JSON: { \"agent\": \"Code|Research|Writing|Data\", \"reasoning\": \"...\" }\n    |\n    v\nSpecialist agent (ephemeral session, dedicated system prompt)\n    Returns: final answer\n```\n\nSpecialists: `Research`, `Code`, `Writing`, `Data` — each with a focused system prompt via `SystemMessageMode.Replace`.\n\n**Endpoint:** `POST /api/agents/coordinator`\n\n#### Pattern B: Orchestrator / SubAgents (Parallel)\n\n```\nUser goal\n    |\n    v\nOrchestrator agent (ephemeral session)\n    Returns JSON array: [{ \"id\", \"description\", \"assignedAgent\" }, ...]\n    |\n    v  Task.WhenAll  (true parallelism)\n    +- SubAgent: Researcher  (ephemeral)\n    +- SubAgent: Developer   (ephemeral)\n    +- SubAgent: Analyst     (ephemeral)\n    +- SubAgent: Writer      (ephemeral)\n    |\n    v\nSynthesis agent (ephemeral session)\n    Combines all sub-task results into a final response\n```\n\n**Endpoint:** `POST /api/agents/orchestrator`\n\n**Key pattern:** All agent invocations use `await using var session = await _client.CreateSessionAsync(...)` — ephemeral sessions auto-disposed after each call, preventing accumulation.\n\n---\n\n## Configuration\n\nAll projects share these configuration keys:\n\n```json\n{\n  \"CopilotSDK\": {\n    \"DefaultModel\": \"gpt-4o\",\n    \"LogLevel\": \"info\"\n  }\n}\n```\n\n| Key | Default | Description |\n|-----|---------|-------------|\n| `DefaultModel` | `gpt-4o` | Fallback model when none is specified in the request |\n| `LogLevel` | `info` | SDK log verbosity: `debug` \\| `info` \\| `warn` \\| `error` |\n\nMcpApi also reads `McpServer:BaseUrl` (default: `http://localhost:5300`) when running without Aspire.\n\n### Available models\n\n- `gpt-4o` (default)\n- `gpt-4`\n- `claude-sonnet-4.5`\n- `o1`\n\n---\n\n## Repository Structure\n\n```\nCopilotSDKPlayground/\n+-- CopilotSDKPlayground.Api/           # Core chat + streaming/tools/prompts/memory\n|   +-- Endpoints/\n|   |   +-- ChatEndpoints.cs\n|   |   +-- StreamingEndpoints.cs\n|   |   +-- ToolsEndpoints.cs\n|   |   +-- PromptTemplateEndpoints.cs\n|   |   +-- MemoryEndpoints.cs\n|   +-- Models/ChatModels.cs, ExtendedModels.cs\n|   +-- Services/CopilotService.cs, StreamingCopilotService.cs, ToolCopilotService.cs, ...\n|   +-- chat-examples.http\n+-- CopilotSDKPlayground.RagApi/        # RAG pipeline\n|   +-- Endpoints/DocumentEndpoints.cs, RagChatEndpoints.cs\n|   +-- Models/RagModels.cs\n|   +-- Services/DocumentChunker.cs, InMemoryVectorStore.cs, RagCopilotService.cs\n|   +-- rag-examples.http\n+-- CopilotSDKPlayground.McpServer/     # MCP tool server\n|   +-- Tools/WeatherTool.cs, CalculatorTool.cs, TimeTool.cs\n|   +-- Program.cs\n+-- CopilotSDKPlayground.McpApi/        # Copilot + MCP bridge\n|   +-- Endpoints/McpEndpoints.cs\n|   +-- Models/McpModels.cs\n|   +-- Services/McpCopilotService.cs\n|   +-- mcp-examples.http\n+-- CopilotSDKPlayground.AgentsApi/     # Multi-agent patterns\n|   +-- Endpoints/AgentEndpoints.cs\n|   +-- Models/AgentModels.cs\n|   +-- Services/CoordinatorAgentService.cs, OrchestratorAgentService.cs\n|   +-- agents-examples.http\n+-- CopilotSDKPlayground.AppHost/       # Aspire orchestration (Redis + all 5 projects)\n+-- CopilotSDKPlayground.ServiceDefaults/ # Shared OTel, health checks, resilience\n+-- Directory.Build.props               # Shared build settings\n+-- global.json                         # .NET 10 SDK pin\n```\n\n---\n\n## Observability\n\nRun via Aspire for the full observability stack at `https://localhost:17146`:\n\n| Signal | What you get |\n|--------|-------------|\n| **Traces** | Distributed tracing across all HTTP requests |\n| **Metrics** | ASP.NET Core, HTTP client, and runtime counters |\n| **Logs** | Structured logs correlated with trace and span IDs |\n| **Resources** | Live view of all 5 APIs + Redis container |\n\n---\n\n## Building\n\n```bash\ndotnet build\ndotnet build -p:TreatWarningsAsErrors=true\n```\n\n---\n\n## Troubleshooting\n\n### `Copilot CLI executable not found`\n\n```bash\nwinget install GitHub.cli\ngh extension install github/gh-copilot\ngh auth login\ngh copilot --version  # verify\n```\n\n### McpApi cannot connect to McpServer\n\nWhen running standalone (without Aspire), start McpServer first, then McpApi.\nOverride the URL in `CopilotSDKPlayground.McpApi/appsettings.Development.json`:\n```json\n{ \"McpServer\": { \"BaseUrl\": \"http://localhost:5300\" } }\n```\n\n### Redis connection failure\n\nRedis is provided as a container by Aspire. For standalone development, start Redis locally:\n```bash\ndocker run -p 6379:6379 redis:alpine\n```\n\n### Port conflicts\n\nAdjust ports in each project's `Properties/launchSettings.json`.\n\n---\n\n## Contributing\n\n1. Fork the repository\n2. Create a feature branch: `git checkout -b feature/my-feature`\n3. Commit your changes: `git commit -m 'Add my feature'`\n4. Push: `git push origin feature/my-feature`\n5. Open a Pull Request\n\n## License\n\nMIT — see [LICENSE](LICENSE).\n\n## Resources\n\n- [GitHub Copilot SDK for .NET](https://github.com/github/copilot-sdk)\n- [Model Context Protocol C# SDK](https://github.com/modelcontextprotocol/csharp-sdk)\n- [.NET Aspire](https://learn.microsoft.com/dotnet/aspire/)\n- [Microsoft.Extensions.AI](https://learn.microsoft.com/dotnet/ai/microsoft-extensions-ai)\n- [ASP.NET Core Minimal APIs](https://learn.microsoft.com/aspnet/core/fundamentals/minimal-apis)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffkucukkara%2Fcopilot-sdk-playground","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffkucukkara%2Fcopilot-sdk-playground","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffkucukkara%2Fcopilot-sdk-playground/lists"}