Skip to main content
Model Context Protocol (MCP) integration allows HAI Build to connect with external tools, databases, APIs, and services through standardized MCP servers. Think of MCP as a USB-C port for AI—a universal interface for extending capabilities.
MCP architecture diagram

What is MCP?

MCP is an open protocol that standardizes how AI applications interact with external systems:
  • Tools: Functions the AI can execute (e.g., query database, send email)
  • Resources: Read-only data sources (e.g., file contents, API responses)
  • Prompts: Predefined templates for specific tasks
  • Security: Isolated credentials with user approval required
MCP is developed by Anthropic and maintained as an open standard. Learn more at the MCP SDK.

How MCP Works in HAI Build

When you connect an MCP server to HAI Build:
1

Server Discovery

HAI Build loads the MCP server and discovers its capabilities:
  • Available tools and their parameters
  • Resource endpoints and templates
  • Prompt definitions
2

System Prompt Injection

MCP server capabilities are added to the AI’s system prompt:
3

Tool Execution

When the AI needs to use an MCP tool:
  • AI calls use_mcp_tool with server name and tool name
  • HAI Build forwards the request to the MCP server
  • Server executes the tool and returns results
  • Results are added to conversation context
4

User Approval

Potentially dangerous operations require explicit user approval before execution.
See: src/shared/mcp.ts:1

MCP Server Types

MCP servers come in various forms:
Connect to external services:

GitHub

  • Create issues and PRs
  • Search repositories
  • Manage branches
  • Read file contents

Slack

  • Send messages
  • Create channels
  • Upload files
  • Search conversations

Jira

  • Create/update tickets
  • Query issues
  • Manage sprints
  • Track progress

Google Drive

  • Upload/download files
  • Search documents
  • Share links
  • Manage permissions

Installing MCP Servers

From MCP Marketplace

HAI Build includes a built-in MCP marketplace:
1

Open MCP Settings

Navigate to Settings → MCP Integration
2

Browse Marketplace

Explore available MCP servers by category:
  • Web Services
  • Databases
  • Development Tools
  • AI/ML Services
3

Install Server

Click “Install” on the desired server. HAI Build automatically:
  • Downloads the server
  • Installs dependencies
  • Configures default settings
4

Configure Credentials

Add required API keys or credentials in the server settings.
5

Enable Server

Toggle the server on to make it available to the AI.

Manual Installation

Install from GitHub or npm:
Then add to HAI Build MCP settings:
MCP servers are configured in your VS Code settings under mcp.servers. You can add servers from the marketplace or configure them manually.

MCP Server Configuration

Server Definition

Each MCP server is defined by:

Configuration Examples

Timeout Configuration

Control how long HAI Build waits for MCP responses:
Set appropriate timeouts for your servers. Database queries might need 30s, while API calls might need 120s.

Using MCP Tools

Tool Discovery

When an MCP server connects, its tools are listed in the system prompt:

Tool Execution

The AI uses tools through the use_mcp_tool function: Example: GitHub issue creation
Tool Response:

Auto-Approval for MCP Tools

Configure which MCP tools can execute without approval:
1

Navigate to MCP Settings

Settings → MCP Integration → [Server Name]
2

Configure Tool Auto-Approval

Toggle auto-approval for specific tools:
  • Read-only tools (safe): Auto-approve
  • Write operations: Require approval
  • Destructive operations: Always require approval
3

Save Configuration

Changes apply immediately to active tasks.
Be cautious with auto-approving tools that modify data, send messages, or incur costs.

MCP Resources

Resources provide read-only data to the AI:

Resource Types

Fixed URI resources:
Example: Database schema

Accessing Resources

AI uses access_mcp_resource tool:

MCP Prompts

Prompts are reusable templates provided by MCP servers:
Example: Code review prompt
Invoke with: /mcp-prompt code_review language=typescript focus_areas=security

Building Custom MCP Servers

Create MCP servers for internal tools and APIs:
1

Initialize Server

Use the MCP SDK:
2

Define Tools

3

Implement Tool Logic

4

Start Server

For more details on the MCP protocol specification, visit the MCP documentation.

Security and Permissions

Credential Isolation

MCP servers isolate credentials from the AI:
  • Environment Variables: Credentials in env block
  • No AI Access: AI never sees API keys or passwords
  • Server-Side Storage: Tokens stored in server process

User Approval

Critical operations require explicit approval:

Always Require Approval

  • Data deletion
  • Financial transactions
  • External communications
  • System modifications

Can Auto-Approve

  • Read operations
  • Search queries
  • Data fetching
  • Report generation
Configure per-tool approval in MCP settings.

OAuth Support

Some MCP servers support OAuth authentication:
1

Server Requests OAuth

MCP server marks itself as requiring OAuth.
2

User Initiates Flow

Click “Authenticate” in MCP settings.
3

OAuth Browser Flow

Complete authentication in browser.
4

Token Storage

HAI Build stores OAuth token securely.

MCP Marketplace

HAI Build’s MCP Marketplace provides curated servers:

Marketplace Features

  • Search: Find servers by name, tag, or category
  • Recommendations: Popular and trusted servers highlighted
  • Documentation: README and installation guides included
  • Ratings: GitHub stars and download counts
  • Updates: Automatic sync with GitHub repositories

Troubleshooting

  • Check command and args in configuration
  • Verify server executable exists
  • Review HAI Build logs for errors
  • Test server standalone: node server.js
  • Check environment variables are set
  • Verify tool name spelling
  • Check required parameters provided
  • Review input schema requirements
  • Increase timeout if operations are slow
  • Check server logs for errors
  • Clear OAuth tokens and re-authenticate
  • Check redirect URLs in OAuth app settings
  • Verify scopes match server requirements
  • Review browser console for OAuth errors
  • Increase server timeout in settings
  • Optimize slow operations in custom servers
  • Use pagination for large data requests
  • Check network connectivity

Best Practices

1

Start with Read-Only Servers

Test with safe, read-only operations before enabling write access.
2

Use Descriptive Tool Names

Name tools clearly: create_github_issue not create_issue
3

Provide Detailed Schemas

Include descriptions and examples in input schemas for better AI understanding.
4

Set Appropriate Timeouts

Match timeouts to operation complexity: quick APIs 30s, complex queries 120s.
5

Version Control Configs

Store MCP configurations in .vscode/settings.json and commit to git.
6

Document Custom Servers

Maintain README files for team-built MCP servers.

Next Steps

Adding MCP Servers

Detailed guide on installing and configuring MCP servers

Building Custom Servers

Create your own MCP servers from scratch

Auto Approve

Configure auto-approval for MCP tools

AI-Powered Coding

See how MCP integrates with AI workflows