Skip to main content

HTTP bridge that exposes VS Code + GitHub Copilot Chat to external Python scripts and agents

Project description

Copilot Bridge

CI VS Code Marketplace PyPI License: MIT

A local HTTP bridge that exposes VS Code and GitHub Copilot Chat to any external process — Python scripts, agents, CLIs, or other tools.

External process
    ↕  HTTP (localhost:5150)
copilot-bridge-extension   ← VS Code extension (the server)
    ↕  VS Code API
GitHub Copilot Chat

Components

Path Purpose
copilot-bridge-extension/ VS Code extension — starts the HTTP server inside VS Code
copilot-bridge-dist/ Python client library (CopilotBridge, CopilotAgent)

Quickstart

1 — Install the VS Code extension

From GitHub Releases (no build required):

  1. Download copilot-bridge.vsix from the latest release
  2. In VS Code: Ctrl+Shift+P → "Extensions: Install from VSIX..." → select the file

From source:

cd copilot-bridge-extension
npm install
npm run package          # produces copilot-bridge-x.x.x.vsix
code --install-extension copilot-bridge-*.vsix

The extension auto-starts an HTTP server on localhost:5150 when VS Code opens.

2 — Install the Python client

pip install copilot-bridge

From source:

cd copilot-bridge-dist
pip install .

3 — Use it

from copilot_bridge import CopilotBridge, CopilotAgent

# One-shot question
client = CopilotBridge()
print(client.ask("Explain this function in one sentence"))

# Stateful chat
client.set_system_prompt("You are a terse code reviewer.")
reply = client.chat("Review my PR diff")

# Agentic loop — reads/writes files, runs commands, etc.
agent = CopilotAgent()
agent.run("Refactor src/auth.py to use async/await")

CLI:

python -m copilot_bridge              # interactive chat
python -m copilot_bridge agent        # interactive agent
python -m copilot_bridge ask "Hello"  # one-shot
python -m copilot_bridge status       # connection check

API overview

CopilotBridge exposes the full VS Code surface over HTTP:

Category Methods
Chat ask, chat, chat_stream, chat_with_image
Files read_file, write_file, edit_file, multi_edit, delete_file, rename_file, copy_file, list_directory
Search search_text, search_files, find_files, semantic_search
Code intelligence search_symbols, find_definition, find_usages, hover, document_symbols, rename_symbol, call_hierarchy
Git git_status, git_diff, git_log, git_branches, git_add, git_commit, git_push, git_pull, git_merge, git_checkout, git_stash
Diagnostics get_diagnostics, get_errors
Editor get_editor, open_file, insert_text, get_selection
Terminal create_terminal, send_to_terminal, get_terminal_output, dispose_terminal
UI notify_info, notify_warn, notify_error, prompt_input, prompt_quickpick
Workspace get_workspace, get_workspace_index, get_workspace_files, get_related_files, get_import_graph, reindex

See copilot-bridge-dist/copilot_bridge.pyi for the full typed interface.

Authentication

The bridge uses an API key to protect all endpoints. The key is generated automatically the first time the VS Code extension starts.

Key location: ~/.copilot-bridge/config.json

{ "apiKey": "a3f8c2d19e4b7a6f..." }

The Python client reads this file automatically — no extra setup needed:

client = CopilotBridge()  # key loaded from ~/.copilot-bridge/config.json

To use a custom key (e.g. in CI or a container):

client = CopilotBridge(api_key="your-key-here")

Or set it via environment variable in your own wrapper:

import os
client = CopilotBridge(api_key=os.environ["COPILOT_BRIDGE_KEY"])

To rotate the key: delete ~/.copilot-bridge/config.json and restart VS Code. A new key is generated automatically.

Note: /health is intentionally unauthenticated so the client can auto-discover the port.

Configuration

In VS Code settings (Ctrl+,, search "Copilot Bridge"):

Setting Default Description
copilotBridge.port 5150 HTTP server port (auto-increments if busy)
copilotBridge.autoStart true Start server when VS Code opens

Requirements

  • VS Code 1.90+
  • GitHub Copilot Chat extension
  • Python ≥ 3.10 (client library)
  • Node.js ≥ 18 (to build the extension from source)

License

MIT — see copilot-bridge-extension/LICENSE.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

copilot_bridge-5.1.5.tar.gz (18.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

copilot_bridge-5.1.5-py3-none-any.whl (18.5 kB view details)

Uploaded Python 3

File details

Details for the file copilot_bridge-5.1.5.tar.gz.

File metadata

  • Download URL: copilot_bridge-5.1.5.tar.gz
  • Upload date:
  • Size: 18.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for copilot_bridge-5.1.5.tar.gz
Algorithm Hash digest
SHA256 f2e02b7a98037354824da30faced33420db8c646ed61d234abcac12a72e369c4
MD5 95a1d5dd9bc0504123c7095d86f9ea77
BLAKE2b-256 34310a790be094678dc1276da27b45f8c5a840a244f772452a1acc57fc2914d8

See more details on using hashes here.

Provenance

The following attestation bundles were made for copilot_bridge-5.1.5.tar.gz:

Publisher: release.yml on rakshithbn-proj/copilot-bridge

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file copilot_bridge-5.1.5-py3-none-any.whl.

File metadata

  • Download URL: copilot_bridge-5.1.5-py3-none-any.whl
  • Upload date:
  • Size: 18.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for copilot_bridge-5.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 872ee01f88d666f724f8da5ec41f01b28515bf17e7a47dca72f569db786b28f4
MD5 412e39841588e73c78f31b7ea81e59af
BLAKE2b-256 cb0425fc784004eb37cc96b41b83930b7aa4c3eccf68f102e5a36b50d6015555

See more details on using hashes here.

Provenance

The following attestation bundles were made for copilot_bridge-5.1.5-py3-none-any.whl:

Publisher: release.yml on rakshithbn-proj/copilot-bridge

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page