Transform your VS Code into an autonomous, agent-powered development environment. Tool Host acts as a universal MCP (Model Context Protocol) Host, enabling AI agents to leverage any tool, API, or data source through the Model Context Protocol ecosystem.
Features
Universal MCP Host
- Connect Multiple MCP Servers: Manage and orchestrate multiple Model Context Protocol servers simultaneously
- Tool Aggregation: Automatically aggregate tools, resources, and prompts from all connected servers
- Auto-Restart & Health Tracking: Intelligent server lifecycle management with exponential backoff
- Hot-Reload Configuration: Modify server configs without restarting VS Code
Autonomous AI Agent
- Multi-LLM Support: Works with Anthropic Claude, OpenAI GPT, and OpenAI-compatible APIs (Ollama, LM Studio)
- Reasoning Loop: Implements the REASON → ACT → OBSERVE pattern for autonomous task completion
- Context-Aware: Automatically gathers VS Code context (active files, workspace, git status)
- Human-in-the-Loop: Requires confirmation for destructive operations
Agent Modes
- Ask Mode: Get answers and explanations without code changes
- Code Mode: Generate and modify code to implement features
- Architect Mode: Plan complex system designs and refactorings
Developer Experience
- Real-Time Activity Panel: Watch your agent reason, plan, and execute tasks
- Secure Credential Storage: API keys stored safely in VS Code's SecretStorage
- Rich Tool Visualization: See tool inputs, outputs, and execution results
- VS Code Native: Fully integrated with VS Code's UI and workflows
Installation
- Install from the VS Code Marketplace (search for "Tool Host")
- Or install manually:
code --install-extension toolhost-*.vsix
Quick Start
Open the Command Palette (Cmd+Shift+P
/ Ctrl+Shift+P
) and run:
Tool Host: Configure LLM Settings
Enter your API key and select your preferred model:
- Anthropic:
claude-3-5-sonnet-20241022
(recommended)
- OpenAI:
gpt-4-turbo-preview
, gpt-4o
- Custom: Any OpenAI-compatible endpoint (Ollama, LM Studio, etc.)
2. Add MCP Servers
Run:
Tool Host: Configure MCP Servers
Or manually edit your settings.json
:
{
"toolhost.mcpServers": {
"filesystem": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-filesystem", "/path/to/workspace"]
},
"github": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-github"],
"env": {
"GITHUB_TOKEN": "your-token-here"
}
}
}
}
3. Run Your Agent
Open the Command Palette and run:
Tool Host: Run Agent
Enter your goal, and watch the agent work!
Available Commands
Command |
Description |
Tool Host: Run Agent |
Launch the autonomous agent with a goal |
Tool Host: Configure LLM Settings |
Set up your LLM provider and API key |
Tool Host: Configure MCP Servers |
Manage MCP server configurations |
Tool Host: Show Status |
Display health status of all MCP servers |
Tool Host: List Tools |
View all available tools from connected servers |
Tool Host: Show Agent Activity |
Open the agent activity panel |
Tool Host: Run MCP Diagnostics |
Validate connectivity and capabilities of each MCP server |
Tool Host: Clear Confirmation Preferences |
Reset saved confirmation preferences |
Configuration
LLM Settings
{
"toolhost.llmModel": "claude-3-5-sonnet-20241022",
"toolhost.llmBaseUrl": "", // Optional: for custom endpoints
"toolhost.llmTemperature": 0.7,
"toolhost.llmMaxTokens": 4096
}
MCP Server Configuration
Each server configuration supports:
command
: Executable command (e.g., node
, python
, npx
)
args
: Command-line arguments
env
: Environment variables for the server process
Testing
Prerequisites (Linux / WSL)
VS Code integration tests require a handful of system libraries. Install them once per environment:
sudo apt-get update
sudo apt-get install -y libnspr4 libnss3 libatk-bridge2.0-0 libxkbcommon0 libx11-xcb1 libgtk-3-0 libxshmfence1 libgbm1
Commands
npm run lint # ESLint
npm run check-types # TypeScript type checking
npm run compile # Build extension bundle
npm run test # Runs compile/lint + VS Code integration tests
Packaging & Release
- Bump the version in
package.json
and update CHANGELOG.md
.
- Rebuild the extension:
npm run compile
.
- Package for the marketplace:
npx vsce package
.
- Test the generated
.vsix
locally (code --install-extension toolhost-*.vsix
).
- Publish with
npx vsce publish
(requires a VS Marketplace token).
cwd
: Working directory
stderr
: How to handle stderr (inherit
, ignore
, or pipe
)
autoRestart
: Enable automatic restart on crash (default: true
)
maxRestarts
: Maximum restart attempts (default: 3
)
🌟 Example Use Cases
Code Generation
"Create a REST API endpoint for user authentication with JWT tokens"
Debugging
"Find and fix the bug causing the null pointer exception in UserService.ts"
Refactoring
"Refactor this component to use React hooks instead of class components"
Documentation
"Generate JSDoc comments for all public methods in this file"
🔌 Compatible MCP Servers
Tool Host works with any MCP-compliant server. Popular options:
🏗️ Architecture
Tool Host follows a three-layer architecture:
- Extension Layer (
extension.ts
): VS Code integration and command registration
- MCP Host Manager (
McpHost.ts
): Manages multiple MCP server connections
- Agent Engine (
Agent.ts
): Reasoning and execution with REASON→ACT→OBSERVE loop
See CLAUDE.md for detailed architecture documentation.
🤝 Contributing
Contributions are welcome! Please see our contributing guidelines.
- Fork the repository
- Create a feature branch
- Make your changes
- Submit a pull request
📄 License
MIT License - see LICENSE for details.
🐛 Known Issues
- Server config changes require add/remove to trigger restart (config hash comparison needed)
- No timeout wrapper for MCP operations
- Duplicate tool names from multiple servers not warned in UI
📚 Resources
🙏 Acknowledgments
Built with the Model Context Protocol SDK by Anthropic.
Made with ❤️ for the AI coding community