- Explore MCP Servers
- vscodecontext
Vscodecontext
What is Vscodecontext
vscodecontext is a Model Context Protocol server designed to provide configurable context from VSCode Context APIs to the model, allowing for enhanced integration and data handling.
Use cases
Use cases include enhancing debugging processes, improving task management, facilitating collaboration through shared context information, and optimizing development workflows by understanding the current environment.
How to use
To use vscodecontext, install the VSCode extension from the marketplace, which will extract context information as JSON output. Future updates will enable writing context data to an MCP memory server.
Key features
Key features include capturing workspace context (folders, file structure), window context (active editors, terminal state), language context (active language ID), debug context (session information), source control context (repository info), tasks context (task configurations), and extension context (version and state).
Where to use
vscodecontext can be utilized in software development environments, particularly for developers using Visual Studio Code who need detailed insights into their workspace and project context.
Clients Supporting MCP
The following are the main client software that supports the Model Context Protocol. Click the link to visit the official website for more information.
Overview
What is Vscodecontext
vscodecontext is a Model Context Protocol server designed to provide configurable context from VSCode Context APIs to the model, allowing for enhanced integration and data handling.
Use cases
Use cases include enhancing debugging processes, improving task management, facilitating collaboration through shared context information, and optimizing development workflows by understanding the current environment.
How to use
To use vscodecontext, install the VSCode extension from the marketplace, which will extract context information as JSON output. Future updates will enable writing context data to an MCP memory server.
Key features
Key features include capturing workspace context (folders, file structure), window context (active editors, terminal state), language context (active language ID), debug context (session information), source control context (repository info), tasks context (task configurations), and extension context (version and state).
Where to use
vscodecontext can be utilized in software development environments, particularly for developers using Visual Studio Code who need detailed insights into their workspace and project context.
Clients Supporting MCP
The following are the main client software that supports the Model Context Protocol. Click the link to visit the official website for more information.
Content
VSCode Context Extension
Gain deep insights into your VSCode environment with comprehensive context information.
This project currently provides a VSCode extension as the client to extract your context as a
JSON output. In the near future, it will soon be able to write the context to your MCP memory
server as entities, relations, and observations. Next, it will be the client to a standalone
VSCode Context MCP Server.
Table of Contents
Features
The VSCode Context extension provides detailed insights into your development
environment. The following data is captured:
Workspace Context
- Workspace folders and file structure
- Editor configuration (font size, tab size, etc.)
- File and search settings
Window Context
- Active text editor information
- Visible text editors and their documents
- Terminal information and state
- Window focus and state changes
Language Context
- Active editor language ID
- Available languages
- Language diagnostics and capabilities
Debug Context
- Active debug session information
- Breakpoints and their types
- Debug configurations
Source Control Context
- Repository information
- Source control state (changes, conflicts, branch)
Tasks Context
- Available tasks and their configurations
- Task execution information
- Problem matchers and presentation options
Extension Context
- Extension version and state
- Global and workspace extension state
- Activation events and commands
The extension provides these features through:
- Command palette integration
- Dedicated output channel for context data
- Event subscriptions for real-time updates
Quick Start
- Install the VSIX extension the source directory where you installed this project and ran npm run build.
- Open the Command Palette (
Ctrl+Shift+PorCmd+Shift+P) - Run the command:
VSCode Context: Extract Context - View the output in the “VSCode Context” output channel
Configuration
The extension can be configured through VSCode settings. Use the VS Code settings UI and filter to "vscode-context":
You can configure which context categories are included in the extracted context:
- Workspace: Includes information about your workspace folders,
file system, and recently opened files - Window: Includes information about the active window,
editors, terminals, selections, and window state - Language: Includes information about the current language,
diagnostics, available languages, and language features - Debug: Includes information about the active debug session,
breakpoints, and debug configurations - Source Control: Includes information about your git repositories,
branches, and commit templates - Tasks: Includes information about your configured tasks,
execution settings, and problem matchers - Extension: Includes information about the extension itself
(version, state, settings) - Extension Host: Includes information about the VS Code Extension host
(platform, process) - Settings: Includes the current VS Code settings
- Keybindings: Includes the current VS Code Keybindings
- Theme: Includes the current VS Code theme
- Views: Includes information about the current VS Code views
- Custom Editors: Includes information about any custom editors you have open
How to Generate Context
To capture a more complete context, actively use VS Code features
before running the context extraction command. Here’s how:
General Setup:
- Open VS Code:
Start your Visual Studio Code instance - Open a Workspace/Folder:
Open a folder or workspace (File > Open Folder...
orFile > Open Workspace from File...) - Open Files:
Open one or more files (double-click orFile > Open File...).
Use different languages to test language-specific context - Interact with Files:
- Make a text selection
- Ensure one file has focus
Populating Specific Context Areas:
- Workspace: Open a workspace that contains multiple folders to test
workspaceFolders - Window:
- Open a file, and make sure it has focus
- Make a selection
- Open an integrated terminal (
Ctrl+orCmd+``)
- Debug:
- Open a file
- Set a breakpoint
- Go to the Run and Debug view (
Ctrl+Shift+DorCmd+Shift+D) - Click “Run and Debug” (the session does not need to complete)
- Source Control:
- Open a folder or workspace initialized as a Git repository
- Optionally make changes to a file (do not commit yet)
Executing the Context Extraction:
- Open the Command Palette (
Ctrl+Shift+PorCmd+Shift+P) - Run the
VSCode Context: Extract Contextcommand - View the output in the “VSCode Context” output channel
Important Notes:
- Execute the extraction command after performing the above steps.
The context reflects the state at the exact moment the command is run - Repeat these steps in different scenarios to get a full view of the
data accessible to the extension
Development
The extension uses a modern development workflow with:
- TypeScript for type-safe development
- Webpack for optimized production builds
- ESLint for code quality
- Prettier for code formatting
- TypeDoc for documentation generation
- MarkdownLint for documentation quality
Build Configuration Files
The project uses JSON configuration files to customize the build process:
Available Configuration Files
webpack.config.js: Webpack build configuration.eslintrc.cjs: ESLint configuration.prettierrc.json: Prettier formatting rules.markdownlint.json: Markdown linting rulestypedoc.json: TypeDoc documentation settings
Customizing Build Configuration
To modify build settings:
- Edit the appropriate configuration file
- Add custom settings following the JSON format
- Common customizations include:
- Adding new Webpack loaders
- Extending ESLint rules
- Customizing Prettier formatting
- Adding TypeDoc plugins
Example: Adding a New Webpack Loader
- Open
webpack.config.js - Add the loader configuration:
module.exports = {
module: {
rules: [
{
test: /\.custom$/,
use: ['custom-loader'],
},
],
},
};
- Install the required loader:
npm install custom-loader --save-dev
Linting and Formatting Setup
The project uses a comprehensive quality assurance setup:
ESLint Configuration
- Configuration file:
.eslintrc.cjs(only ESLint configuration file) - Linting scope: Focused on
src/directory, excluding test files - Ignored patterns:
node_modules/,dist/,out/,coverage/,*.min.js,*.d.ts - Extends:
eslint:recommended,@typescript-eslint/recommended,prettier/recommended - Overrides: Specific rules for source files in
src/directory
Prettier Integration
- Configuration file:
.prettierrc.json - Integrated with ESLint through
eslint-config-prettier - Automatic formatting on save
MarkdownLint
- Configuration file:
.markdownlint.json - Lints all documentation files except
node_modules/,dist/,out/,coverage/ - Enforces consistent markdown formatting
Pre-commit Hooks
The project uses husky
to run quality checks before each commit. The following
command is run before each commit:
npm run format && npm run lint && npm run lint:markdown
TypeDoc Documentation
- Configuration file:
typedoc.json - Generates API documentation
- Enforces documentation standards
Documentation Standards
All code should be documented using TypeDoc comments following these guidelines:
- Use
/** */for documentation blocks - Include descriptions for all public APIs
- Use
@paramfor function parameters - Use
@returnsfor return values - Use
@examplefor code examples
Building the Extension
Production Build
- Install dependencies and build:
npm install && npm run build
- Package with source maps:
vsce package --yarn --testFlag=false
Development Build
npm run package:dev
Build Configuration
The extension uses CommonJS modules for VSCode compatibility. Key configuration details:
- Webpack configuration uses CommonJS
require()syntax - Output file is
extension.cjs - ESLint is configured to allow CommonJS syntax in
webpack.config.js package.json’smainfield points toextension.cjs
Requirements
package.jsonmust include:mainpointing to the entry fileactivationEventsdefining when the extension activatescontributesdefining commands, menus, etc.engines.vscodespecifying the compatible VSCode version
- Entry file must:
- Be a CommonJS module (
extension.cjs) - Export an
activatefunction - Export a
deactivatefunction (optional)
- Be a CommonJS module (
- Must be packaged using
vsce(Visual Studio Code Extensions) - Output files must be included in
.vscodeignore
Development Commands
| Command | Description |
|---|---|
npm run build |
Run quality checks and build production bundle |
npm run watch |
Watch and rebuild on changes |
npm run quality |
Run all quality checks (linting, formatting, docs) |
npm run lint |
Run ESLint checks |
npm run format |
Format code with Prettier |
npm run lint:markdown |
Lint markdown files |
npm run docs |
Generate API documentation |
npm run package |
Build production bundle and package extension |
npm run package:dev |
Package development version (skips dependencies) |
Module System Configuration
The extension uses CommonJS modules for VSCode compatibility. Key configuration details:
- Webpack configuration uses CommonJS
require()syntax - Output file is
extension.cjs - ESLint is configured to allow CommonJS syntax in
webpack.config.js package.json’smainfield points toextension.cjs
Optimized Build Process
The extension uses Webpack to:
- Bundle all dependencies into a single optimized file
- Tree-shake unused code
- Minify production builds
- Generate source maps for debugging
Contributing
We welcome contributions! Please see our Contributing Guidelines for details.
Note: For detailed documentation and troubleshooting, visit our documentation site
Dev Tools Supporting MCP
The following are the main code editors that support the Model Context Protocol. Click the link to visit the official website for more information.










