githubEdit

plugMCP Integration

Integrate your agent with Model Context Protocol (MCP) servers for extended capabilities.

Overview

The Model Context Protocol (MCP) is an open protocol that enables AI applications to connect with external data sources and tools. AI Dev Kit provides full MCP integration, allowing your agents to:

  • Access External Data - Connect to databases, APIs, and file systems

  • Use MCP Tools - Execute functions provided by MCP servers

  • Manage Resources - Read and manipulate external resources

  • Handle Prompts - Use pre-defined conversation starters

Key Features

Automatic Server Discovery

AI Dev Kit automatically discovers and connects to MCP servers configured in your system:

// MCP servers are automatically loaded from configuration
Agent agent = new Agent(config);
await agent.InitializeAsync();

// All MCP tools are automatically registered

OAuth Authentication

Support for OAuth 2.0 authentication with MCP servers:

  • Google Drive

  • GitHub

  • Slack

  • Custom OAuth providers

Approval System

Built-in approval mechanism for sensitive operations:

  • User confirmation for tool executions

  • Configurable approval handlers

  • Timeout management

  • Automatic approval for trusted tools

Token Management

Secure token storage and refresh:

  • Automatic token refresh

  • Encrypted token storage

  • Per-server token management

MCP Server Types

AI Dev Kit supports various MCP servers:

Standard MCP Servers

Custom Servers

Usage Example

Security Considerations

Approval Required

Sensitive operations require user approval:

Token Security

Tokens are stored securely:

  • Encrypted storage

  • Per-user isolation

  • Automatic cleanup on logout

Sandboxing

MCP servers run in isolated environments:

  • Limited file system access

  • Network isolation

  • Resource limits

Topics

Explore MCP integration in detail:

Best Practices

1. Limit Server Access

2. Implement Approval Logic

3. Handle Errors

4. Monitor Token Expiry

Configuration File

MCP servers are configured in mcp_config.json:

Common MCP Servers

File System

Access local files and directories:

GitHub

Interact with GitHub repositories:

Google Drive

Access Google Drive files:

Slack

Send and read Slack messages:

PostgreSQL

Query PostgreSQL databases:

Troubleshooting

Server Not Starting

Check server logs:

Authentication Failed

Re-authenticate with the server:

Tool Not Found

Ensure server is properly initialized:

Learn More

Next Steps

Set up your first MCP integration:

  1. Configure an MCP server in mcp_config.json

  2. Set up OAuth authentication if needed

  3. Implement approval handlers for security

  4. Use Access Token Service to manage tokens

Last updated