Open
Description
Feature Request: Add Model Context Protocol (MCP) Support
Summary
Add support for the Model Context Protocol (MCP) to enable users to connect to MCP-compatible model servers beyond the current Azure-based GitHub Models integration.
Background
The Model Context Protocol (MCP) is an open standard by Anthropic that standardizes how AI applications connect to external data sources, tools, and model providers. Currently, gh-models
is limited to GitHub Models via Azure AI services.
Motivation
Benefits of MCP Integration:
- Broader Model Access: Connect to local models (Ollama, llama.cpp), alternative cloud providers, and custom endpoints
- Standardized Protocol: Consistent interface reducing provider-specific implementations
- Enhanced Tooling: Support for resources, executable tools, and reusable prompts
- Local Development: Use local models without cloud connectivity or GitHub auth
Proposed Implementation
Core Changes
- Abstract current
azuremodels.Client
into genericModelClient
interface - Implement MCP client that satisfies this interface
- Maintain backward compatibility with Azure integration
- Add MCP server configuration and management
User Experience
# Connect to servers
gh models connect ollama --command "ollama serve --mcp"
gh models connect custom --url "https://api.example.com/mcp"
# Use MCP models
gh models mcp list # Shows models from all connected servers
# Use model with MCP tools/resources
gh models run custom-server/gpt-4 "Analyze my codebase" --with-tools
Configuration File
{
"mcp_servers": {
"ollama": {
"transport": "stdio",
"command": ["ollama", "serve", "--mcp"]
},
"custom": {
"transport": "http",
"url": "https://api.example.com/mcp",
"env": {
"API_KEY": "${CUSTOM_API_KEY}"
}
}
}
}
Metadata
Metadata
Assignees
Labels
No labels