Skip to main content

What is MCP?

Model Context Protocol (MCP) is like “USB-C for AI applications” - a universal standard that lets your agents connect to external data sources and tools. Instead of building custom integrations for every service, you can use the growing ecosystem of MCP servers!

File Systems

Read, write, search files and directories with full filesystem access

GitHub Integration

Create issues, manage repos, read code, and automate workflows

Databases

Query PostgreSQL, MySQL, and other databases directly from agents

Web Search

Search the web with Brave Search for real-time information

Team Tools

Integrate with Slack, Discord, and other communication platforms

Custom Servers

Build your own MCP servers in any language for specialized needs

Quick Start - Add MCP in 60 Seconds

Getting MCP working with your agents is incredibly simple. Here’s how:

1. Install MCP Server

Terminal

2. Configure in Vizra

config/vizra-adk.php

3. Create MCP-Enabled Agent

app/Agents/FileManagerAgent.php

4. Test It Out!

Terminal
That’s It! Your agent now has access to all filesystem tools! It can read files, write content, search directories, and more. The MCP tools are automatically discovered and added to your agent.

Available MCP Servers

Here are some popular MCP servers you can use right away:

Filesystem Server

Access local files and directories with comprehensive file operations.

Installation

Configuration

Available Tools:
  • read_file - Read file contents
  • write_file - Write to files
  • list_directory - List directory contents
  • search_files - Search for files and content

GitHub Server

Comprehensive GitHub integration for repository management and automation.

Installation

Configuration

Available Tools:
  • create_issue - Create GitHub issues
  • search_repositories - Search repos
  • get_file_contents - Read files from repos
  • list_issues - List repository issues

PostgreSQL Server

Direct database access for queries and data manipulation.

Installation

Configuration

Available Tools:
  • query - Execute SQL queries
  • describe_table - Get table schema
  • list_tables - List all tables
  • get_schema - Get database schema

Advanced Configuration

Transport Types

Vizra ADK supports two transport types for MCP servers:

STDIO Transport (Default)

Local MCP servers running as subprocesses. Best for filesystem, local databases, and npm packages.

HTTP Transport

Remote MCP servers via HTTP/SSE. Perfect for cloud services, microservices, and shared resources.

Environment-Based Setup

Use environment variables to control MCP servers across different environments:
.env
config/vizra-adk.php

Multiple Servers per Agent

Agents can use multiple MCP servers simultaneously:
Multi-Server Agent

Management Commands

Vizra ADK provides helpful commands to manage your MCP integration:
Terminal

Real-World Examples

Code Review Assistant

Code Review Agent
Example Conversation:
  • User: “Review the authentication code in src/Auth/”
  • Agent: “I’ll examine the authentication code for you…”
    • Uses filesystem tools to read auth files
    • Analyzes code for security issues
    • Creates GitHub issue for potential vulnerability
  • Agent: “Found 3 areas for improvement. Created issue #42 for the critical security concern.”

Data Analysis Assistant

Data Analysis Agent

Security Best Practices

Filesystem Security
  • Limit directory access - Only allow access to safe directories
  • Use storage paths - Prefer storage_path() over system directories
  • Validate file operations - MCP servers should validate all file paths
  • Monitor file access - Log all file operations for audit trails
API Token Security
  • Use environment variables - Never hardcode tokens in config
  • Minimal permissions - Grant only necessary API permissions
  • Rotate tokens regularly - Set up token rotation schedules
  • Monitor usage - Track API calls and unusual activity
Environment Isolation
  • Separate configs - Different MCP servers for dev/staging/prod
  • Sandbox testing - Test MCP integrations in isolated environments
  • Resource limits - Set appropriate timeouts and resource constraints
  • Error handling - Graceful degradation when MCP servers are unavailable

Troubleshooting

Server Connection Failed

Error: “Failed to start MCP server”
  • Check that the MCP server package is installed globally
  • Verify the command path and arguments in config
  • Run php artisan vizra:mcp:servers --test for details

Tools Not Available

Error: “Tool not found” or tools not appearing
  • Ensure the server is enabled in configuration
  • Check that the mcpServers property includes the server
  • Clear cache and restart the application

Permission Denied

Error: “Access denied” or “Insufficient permissions”
  • Check filesystem permissions for directory access
  • Verify API tokens have necessary permissions
  • Ensure environment variables are set correctly

Best Practices

Agent Design

  • Single responsibility - Each agent should have a clear, focused purpose
  • Appropriate tools - Only include MCP servers the agent actually needs
  • Clear instructions - Explain what MCP capabilities the agent has
  • Error handling - Handle MCP failures gracefully in agent instructions

Performance

  • Cache wisely - MCP tool discovery is cached for 5 minutes
  • Connection pooling - MCP clients are reused across requests
  • Timeout settings - Set appropriate timeouts for different server types
  • Monitor usage - Track MCP server performance and availability

Development Workflow

  • Test locally first - Use --test flag to verify servers
  • Gradual rollout - Enable MCP servers incrementally
  • Monitor logs - Watch for MCP-related errors and performance issues
  • Documentation - Document which agents use which MCP servers

MCP Opens Infinite Possibilities

Your agents can now connect to any data source or service in the MCP ecosystem.

Learn About Tools

Understand how tools work and combine with MCP

Build Better Agents

Create more powerful agents with MCP integration