
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
How MCP Works in HAI Build
When you connect an MCP server to HAI Build:Server Discovery
- Available tools and their parameters
- Resource endpoints and templates
- Prompt definitions
System Prompt Injection
Tool Execution
- AI calls
use_mcp_toolwith 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
User Approval
src/shared/mcp.ts:1
MCP Server Types
MCP servers come in various forms:- API Integrations
- Data Sources
- Development Tools
- Custom Servers
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:Open MCP Settings
Browse Marketplace
- Web Services
- Databases
- Development Tools
- AI/ML Services
Install Server
- Downloads the server
- Installs dependencies
- Configures default settings
Configure Credentials
Enable Server
Manual Installation
Install from GitHub or npm:- NPM Package
- GitHub Clone
- Python Server
MCP Server Configuration
Server Definition
Each MCP server is defined by:Configuration Examples
GitHub Server
GitHub Server
PostgreSQL Server
PostgreSQL Server
Custom API Server
Custom API Server
Timeout Configuration
Control how long HAI Build waits for MCP responses: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 theuse_mcp_tool function:
Example: GitHub issue creation
Auto-Approval for MCP Tools
Configure which MCP tools can execute without approval:Navigate to MCP Settings
Configure Tool Auto-Approval
- Read-only tools (safe): Auto-approve
- Write operations: Require approval
- Destructive operations: Always require approval
Save Configuration
MCP Resources
Resources provide read-only data to the AI:Resource Types
- Direct Resources
- Resource Templates
Accessing Resources
AI usesaccess_mcp_resource tool:
MCP Prompts
Prompts are reusable templates provided by MCP servers:/mcp-prompt code_review language=typescript focus_areas=security
Building Custom MCP Servers
Create MCP servers for internal tools and APIs:Initialize Server
Define Tools
Implement Tool Logic
Start Server
Security and Permissions
Credential Isolation
MCP servers isolate credentials from the AI:- Environment Variables: Credentials in
envblock - 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
OAuth Support
Some MCP servers support OAuth authentication:Server Requests OAuth
User Initiates Flow
OAuth Browser Flow
Token Storage
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
Server not connecting
Server not connecting
- 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
Tool calls failing
Tool calls failing
- Verify tool name spelling
- Check required parameters provided
- Review input schema requirements
- Increase timeout if operations are slow
- Check server logs for errors
OAuth authentication issues
OAuth authentication issues
- Clear OAuth tokens and re-authenticate
- Check redirect URLs in OAuth app settings
- Verify scopes match server requirements
- Review browser console for OAuth errors
Timeout errors
Timeout errors
- Increase server timeout in settings
- Optimize slow operations in custom servers
- Use pagination for large data requests
- Check network connectivity
Best Practices
Start with Read-Only Servers
Use Descriptive Tool Names
create_github_issue not create_issueProvide Detailed Schemas
Set Appropriate Timeouts
Version Control Configs
.vscode/settings.json and commit to git.Document Custom Servers