GitHub MCP Client for Codeoba
Background
Codeoba needs to integrate with GitHub's MCP (Model Context Protocol) server to enable voice-driven GitHub operations. MCP is a standardized client-server protocol where:
- MCP Server (GitHub's): Hosted at
https://api.githubcopilot.com/mcp/, implements tools for GitHub operations
- MCP Client (Codeoba): Connects to server, discovers available tools, executes tool calls via JSON-RPC
Architecture Overview
Voice Input → OpenAI Realtime API → Tool Call Event → Codeoba MCP Client
↓ (JSON-RPC over HTTP)
GitHub MCP Server (api.githubcopilot.com/mcp/)
↓
GitHub API Operations
↓
Result
Implementation Requirements
1. MCP Protocol Layer
File: core/src/commonMain/kotlin/.../data/mcp/McpProtocol.kt
Implement JSON-RPC 2.0 messages per MCP spec:
initialize - Establish connection with server capabilities
tools/list - Discover available tools from server
tools/call - Execute a tool with arguments
- Handle responses with result/error structure
2. HTTP Transport Layer
File: core/src/commonMain/kotlin/.../data/mcp/McpTransport.kt
- Use Ktor HTTP client for communication with
https://api.githubcopilot.com/mcp/
- Support OAuth or PAT-based authentication via Authorization header
- Handle JSON-RPC request/response serialization
- Implement error handling and retries
3. MCP Client Implementation
File: core/src/commonMain/kotlin/.../data/McpClientImpl.kt
class McpClientImpl(private val githubToken: String) : McpClient {
// Connect to GitHub MCP server
suspend fun connect()
// Fetch and cache available tools from server
suspend fun discoverTools(): List<ToolDefinition>
// Execute tool call via server
override suspend fun handleToolCall(name: String, argsJson: String): McpResult
}
4. Tool Discovery & Caching
- On initialization, call
tools/list to discover available GitHub tools
- Cache tool definitions (name, description, input schema)
- No hardcoded tool implementations - server handles all execution
5. Approval Flow Integration
- Check if tool requires approval based on operation type
- Use existing
ApprovalManager for user consent
- Pass approved calls to GitHub MCP server
6. Configuration
- Load GitHub token from
local.properties as DANGEROUS_GITHUB_TOKEN
- Configure MCP server URL (default:
https://api.githubcopilot.com/mcp/)
- Support optional enterprise endpoints
Key Differences from Current Implementation
Remove:
- All custom GitHub API REST client code (
GitHubApiClientImpl.kt)
- Manual tool handlers (
handlers/GitHubToolHandlers.kt)
- Custom tool registry with hardcoded handlers
- Direct GitHub API v3 calls
Keep:
ApprovalManager for user consent
McpClient interface
- Configuration via
local.properties
- Integration with
CodeobaApp.handleToolCall()
Testing Strategy
- Mock MCP server responses for unit tests
- Test JSON-RPC message serialization
- Test tool discovery flow
- Test tool execution with approval
- Optional: Integration test with real GitHub MCP server (requires token)
References
Success Criteria
- MCP client connects to GitHub's server
- Dynamically discovers all available GitHub tools
- Successfully executes tool calls through server
- No custom GitHub REST API code
- All operations go through MCP protocol
GitHub MCP Client for Codeoba
Background
Codeoba needs to integrate with GitHub's MCP (Model Context Protocol) server to enable voice-driven GitHub operations. MCP is a standardized client-server protocol where:
https://api.githubcopilot.com/mcp/, implements tools for GitHub operationsArchitecture Overview
Implementation Requirements
1. MCP Protocol Layer
File:
core/src/commonMain/kotlin/.../data/mcp/McpProtocol.ktImplement JSON-RPC 2.0 messages per MCP spec:
initialize- Establish connection with server capabilitiestools/list- Discover available tools from servertools/call- Execute a tool with arguments2. HTTP Transport Layer
File:
core/src/commonMain/kotlin/.../data/mcp/McpTransport.kthttps://api.githubcopilot.com/mcp/3. MCP Client Implementation
File:
core/src/commonMain/kotlin/.../data/McpClientImpl.kt4. Tool Discovery & Caching
tools/listto discover available GitHub tools5. Approval Flow Integration
ApprovalManagerfor user consent6. Configuration
local.propertiesasDANGEROUS_GITHUB_TOKENhttps://api.githubcopilot.com/mcp/)Key Differences from Current Implementation
Remove:
GitHubApiClientImpl.kt)handlers/GitHubToolHandlers.kt)Keep:
ApprovalManagerfor user consentMcpClientinterfacelocal.propertiesCodeobaApp.handleToolCall()Testing Strategy
References
https://api.githubcopilot.com/mcp/Success Criteria