Skip to content

FR: MCP support #62

Open
Open
@hemanth

Description

@hemanth

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:

  1. Broader Model Access: Connect to local models (Ollama, llama.cpp), alternative cloud providers, and custom endpoints
  2. Standardized Protocol: Consistent interface reducing provider-specific implementations
  3. Enhanced Tooling: Support for resources, executable tools, and reusable prompts
  4. Local Development: Use local models without cloud connectivity or GitHub auth

Proposed Implementation

Core Changes

  • Abstract current azuremodels.Client into generic ModelClient 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

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions