GitHub Copilot Integration

Coming Soon — V2.00: MCP integration is coming as part of Kubeshark V2.00. Read the announcement.

GitHub Copilot supports the Model Context Protocol (MCP), allowing you to connect Kubeshark and query Kubernetes network traffic using natural language directly from VS Code or the Copilot coding agent.


VS Code (Copilot Chat)

Option 1: Workspace Configuration

Create .vscode/mcp.json in your project root:

{
  "servers": {
    "kubeshark": {
      "command": "kubeshark",
      "args": ["mcp", "--url", "https://kubeshark.example.com"]
    }
  }
}

This configuration is shared with your team when committed to version control.

Option 2: User Configuration

For personal configuration across all projects, add to your VS Code settings (settings.json):

{
  "mcp.servers": {
    "kubeshark": {
      "command": "kubeshark",
      "args": ["mcp", "--url", "https://kubeshark.example.com"]
    }
  }
}

Requires VS Code 1.99+ — MCP support is generally available starting from VS Code 1.102.


Copilot Coding Agent (GitHub.com)

Configure MCP servers for the Copilot coding agent in your repository settings on GitHub.com.

Navigate to Settings → Copilot → Coding agent and add:

{
  "type": "stdio",
  "command": "kubeshark",
  "args": ["mcp", "--url", "https://kubeshark.example.com"]
}

Supported transport types: "local", "stdio", "http", or "sse"

Remote MCP servers: Copilot coding agent supports remote MCP servers, allowing you to connect to Kubeshark deployments without local binary installation.


Copilot CLI

If you’re using Copilot CLI, add Kubeshark with:

/mcp add kubeshark -- kubeshark mcp --url https://kubeshark.example.com

Configuration is saved to ~/.copilot directory.


Connection Modes

ModeCommandUse When
URL Modekubeshark mcp --url <url>Kubeshark is already running and accessible
Proxy Modekubeshark mcp --kubeconfig ~/.kube/configLet the CLI proxy into your cluster

Proxy Mode Example

{
  "servers": {
    "kubeshark": {
      "command": "kubeshark",
      "args": ["mcp", "--kubeconfig", "/path/to/.kube/config"]
    }
  }
}

To enable cluster management operations (start/stop Kubeshark):

{
  "servers": {
    "kubeshark": {
      "command": "kubeshark",
      "args": ["mcp", "--allow-destructive", "--kubeconfig", "/path/to/.kube/config"]
    }
  }
}

Verifying the Connection

In VS Code with Copilot Chat, you can verify the MCP server is connected by checking the MCP status in the Copilot panel or running:

@workspace What MCP servers are available?

For Copilot CLI:

/mcp list

Example Prompts

Once connected, try asking Copilot:

“What services are running in my Kubernetes cluster?”

“Show me any HTTP 500 errors in the last hour.”

“Which pods are communicating with the payment service?”

“Find slow API calls with response times over 500ms.”


Enterprise Configuration

Admin approval may be required: MCP in Copilot is disabled by default for organizations and enterprises. An administrator must enable the “MCP servers in Copilot” policy.

Administrators can:

  • Enable/disable MCP for the organization
  • Configure an MCP registry URL for approved servers
  • Set access control policies for which servers developers can use

See GitHub’s MCP access documentation for details.


Troubleshooting

MCP server not appearing

  • Verify the Kubeshark binary is in your PATH or use an absolute path
  • Check that VS Code version is 1.99 or later
  • Restart VS Code after adding the configuration

Connection errors

# Test the binary directly
kubeshark mcp --list-tools --url https://kubeshark.example.com

# If using proxy mode, verify kubectl access
kubectl get pods -l app=kubeshark-hub

Organization restrictions

If you receive permission errors, contact your organization administrator to enable MCP servers in Copilot settings.


What’s Next