polyagent
Allows integration with Google Gemini models as external AI agents for executing specialized tasks such as security scanning, code review, and more.
Allows integration with Ollama (including Ollama Cloud) models as external AI agents for executing specialized tasks such as security scanning, code review, and more.
Allows integration with OpenAI models as external AI agents for executing specialized tasks such as security scanning, code review, and more.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@polyagent Scan this code for security vulnerabilities and suggest fixes"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Polyagent
Multi-provider AI agent bridge for Claude Desktop. Connect Claude to external AI agents (GLM, OpenAI, Anthropic, Bedrock, Gemini) for specialized tasks like security scanning, code review, and more.
Features
Multi-Provider Support: Google Gemini and Ollama Cloud through an OpenAI-compatible endpoint
Dynamic Agent Registration: Register agents at runtime via MCP tools
Flexible Pipeline Modes: Sequential, Iterative, and Parallel execution
Loop Prevention: Max iterations, confidence thresholds, human approval
Streaming Support: Stream responses in real-time
Production Ready: Comprehensive error handling, logging, and metrics
Related MCP server: Claude Swarm MCP Server
Architecture
[Claude Desktop] ←→ [AI Agent MCP Server] ←→ [External AI Agents]
│
┌──────────────────┼──────────────────┐
│ │ │
Agent Registry Pipeline Engine Loop Prevention
(dynamic reg) (seq/iter/parallel) (max iter/confidence/approval)Installation
Prerequisites
Python 3.10 or higher
uvpackage manager (recommended)
Setup
# Clone or navigate to the project
cd ai-agent-mcp-server
# Install dependencies
uv sync
# Set up environment variables. The server also loads a local .env file.
export GOOGLE_API_KEY="your-key" # For Gemini
export OLLAMA_API_KEY="your-key" # For Ollama Cloud
export OLLAMA_BASE_URL="https://ollama.com/v1"Usage
1. Configure Claude Desktop
Add to your claude_desktop_config.json:
{
"mcpServers": {
"ai-agent-bridge": {
"command": "uv",
"args": [
"--directory",
"/path/to/ai-agent-mcp-server",
"run",
"main.py"
],
"env": {
"GOOGLE_API_KEY": "your-key",
"OLLAMA_API_KEY": "your-key",
"OLLAMA_BASE_URL": "https://ollama.com/v1"
}
}
}
}Config file locations:
macOS:
~/Library/Application Support/Claude/claude_desktop_config.jsonLinux:
~/.config/Claude/claude_desktop_config.jsonWindows:
%APPDATA%\Claude\claude_desktop_config.json
2. Restart Claude Desktop
Fully quit Claude Desktop (Cmd+Q on macOS) and restart.
3. Register an Agent
In Claude Desktop, use the register_agent tool:
Register a security scanner agent using GLM-4Claude will call:
{
"name": "register_agent",
"arguments": {
"name": "security-scanner",
"provider": "openai_compat",
"model": "glm-4",
"system_prompt": "You are an expert security auditor...",
"description": "Scans code for security vulnerabilities",
"api_key_env": "GLM_API_KEY",
"base_url": "https://open.bigmodel.cn/api/paas/v4",
"capabilities": ["security", "vulnerability-detection"]
}
}4. Execute an Agent
Scan this code for vulnerabilities: [paste code]Claude will call:
{
"name": "execute_agent",
"arguments": {
"agent_name": "security-scanner",
"input_content": "[your code]"
}
}Available Tools
Agent Management
register_agent: Register a new AI agentlist_agents: List all registered agentsupdate_agent: Update agent configurationremove_agent: Remove an agent
Pipeline Execution
execute_agent: Execute a single agentexecute_pipeline: Execute multi-agent pipeline
Configuration
set_safety_config: Configure loop preventionget_safety_config: Get current safety settings
Example: Security Scanner Pipeline
Step 1: Register Security Agent
# In Claude Desktop
register_agent(
name="security-scanner",
provider="openai_compat",
model="glm-4",
system_prompt="You are an expert security auditor. Find vulnerabilities in the following code.",
description="Scans code for security vulnerabilities using GLM-4",
api_key_env="GLM_API_KEY",
base_url="https://open.bigmodel.cn/api/paas/v4",
capabilities=["security", "vulnerability-detection"],
temperature=0.3
)Step 2: Execute Security Scan
# In Claude Desktop
execute_agent(
agent_name="security-scanner",
input_content="def process_user_input(user_input):\n eval(user_input)"
)Step 3: Claude Processes Results
Claude receives the security findings and can:
Explain vulnerabilities to the user
Suggest fixes
Re-run scans on fixed code
Pipeline Modes
Sequential (Default)
Single pass: Claude → Agent → Claude
execute_pipeline(
agents=["security-scanner"],
input_content="[code]",
mode="sequential"
)Iterative
Multiple rounds: Claude ↔ Agent (with loop prevention)
execute_pipeline(
agents=["security-scanner"],
input_content="[code]",
mode="iterative",
max_iterations=3,
confidence_threshold=0.9
)Parallel
Multiple agents analyze simultaneously:
execute_pipeline(
agents=["security-scanner", "code-reviewer", "performance-analyzer"],
input_content="[code]",
mode="parallel"
)Supported Providers
OpenAI-Compatible (GLM, DeepSeek, etc.)
register_agent(
name="glm-agent",
provider="openai_compat",
model="glm-4",
base_url="https://open.bigmodel.cn/api/paas/v4",
api_key_env="GLM_API_KEY"
)Anthropic Claude
register_agent(
name="claude-agent",
provider="anthropic",
model="claude-3-5-sonnet-20241022",
api_key_env="ANTHROPIC_API_KEY"
)Google Gemini
register_agent(
name="gemini-agent",
provider="gemini",
model="gemini-1.5-pro",
api_key_env="GOOGLE_API_KEY"
)AWS Bedrock
register_agent(
name="bedrock-agent",
provider="bedrock",
model="anthropic.claude-3-5-sonnet-20241022-v2:0",
api_key_env="AWS_BEDROCK_API_KEY",
region="us-east-1"
)Loop Prevention
Configure safety settings:
set_safety_config(
max_iterations=3, # Stop after 3 iterations
confidence_threshold=0.9, # Stop when confidence > 90%
require_approval_after=2, # Ask for approval after 2 iterations
timeout_seconds=300 # Global timeout
)Development
Run in Development Mode
# Test with MCP Inspector
uv run mcp dev main.pyRun Tests
uv run pytest tests/Project Structure
ai-agent-mcp-server/
├── src/
│ ├── server.py # MCP server entry point
│ ├── providers/ # AI provider adapters
│ │ ├── base.py # Abstract base provider
│ │ ├── openai_compat.py # OpenAI-compatible (GLM, DeepSeek)
│ │ ├── anthropic.py # Anthropic Claude
│ │ ├── bedrock.py # AWS Bedrock
│ │ └── gemini.py # Google Gemini
│ ├── agents/ # Agent management
│ │ ├── profiles.py # Agent profile definitions
│ │ └── registry.py # Dynamic agent registry
│ ├── pipeline/ # Communication pipeline
│ │ └── engine.py # Pipeline execution engine
│ ├── safety/ # Loop prevention
│ │ └── limits.py # Safety mechanisms
│ └── config.py # Configuration management
├── tests/
├── main.py # Entry point
├── pyproject.toml
└── README.mdTroubleshooting
Server not showing up in Claude
Check
claude_desktop_config.jsonsyntaxUse absolute paths
Fully quit and restart Claude Desktop
Tool calls failing
Check Claude's logs:
~/Library/Logs/Claude/mcp*.logVerify API keys are set
Test with MCP Inspector:
uv run mcp dev main.py
API errors
Verify API keys are correct
Check rate limits
Ensure model names are valid
License
MIT
Contributing
Contributions welcome! Please read CONTRIBUTING.md for guidelines.
Support
GitHub Issues: [Report bugs or request features]
Documentation: [Full API documentation]
MCP Discord: #python-sdk-dev
Available Tools
9 toolsexecute_agentC
Execute a single agent.
Args: agent_name: Name of the agent to execute input_content: Input content to process context: Optional context from Claude
Returns: Execution result
Inputs: agent_name (required), input_content (required), context.
execute_pipelineB
Execute a pipeline with multiple agents.
Args:
agents: List of agent names
input_content: Input content to process
mode: Pipeline mode (sequential, iterative, parallel)
context: Optional context from Claude
max_iterations: Maximum iterations for iterative mode
confidence_threshold: Confidence threshold for stopping
require_approval_after: Pause iterative mode for human approval after N
iterations. Defaults to None (disabled) so max_iterations is the
real bound; pass an int to opt into an approval checkpoint.
Returns: Pipeline execution results
Inputs: agents (required), input_content (required), mode, context, +3 more.
get_available_modelsA
Get list of all available models and their capabilities.
This tool should be called by Claude to discover which models are available and what tasks they're best suited for.
Returns: Dictionary with model registry including capabilities
Inputs: no named parameters.
get_safety_configA
Get current safety configuration.
Returns: Current safety configuration
Inputs: no named parameters.
list_agentsB
List all registered agents.
Args: capability: Optional capability filter
Returns: List of agent profiles
Inputs: capability.
register_agentA
Register a new AI agent.
Args: name: Unique name for the agent provider: Provider type (openai_compat, anthropic, bedrock, gemini) model: Model identifier (e.g., 'glm-4', 'claude-3-5-sonnet') system_prompt: System prompt for the agent description: Human-readable description api_key_env: Environment variable name for API key temperature: Sampling temperature (0.0-2.0) max_tokens: Maximum tokens to generate capabilities: List of agent capabilities base_url: Base URL for OpenAI-compatible providers region: AWS region for Bedrock
Returns: Registered agent profile
Inputs: name (required), model (required), provider (required), api_key_env (required), +7 more.
remove_agentC
Remove an agent.
Args: name: Agent name
Returns: Removed agent profile
Inputs: name (required).
set_safety_configA
Configure loop prevention and safety settings.
Args: max_iterations: Maximum iterations before stopping confidence_threshold: Stop when confidence exceeds threshold require_approval_after: Require approval after N iterations timeout_seconds: Global timeout in seconds
Returns: Updated safety configuration
Inputs: max_iterations, timeout_seconds, confidence_threshold, require_approval_after.
update_agentC
Update an existing agent.
Args: name: Agent name **kwargs: Fields to update
Returns: Updated agent profile
Inputs: name (required), kwargs (required).
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 9 tools
Every tool targets a distinct concern: agent lifecycle, agent execution, pipeline execution, safety configuration, and model discovery. The only potentially similar pair (execute_agent vs execute_pipeline) is clearly differentiated by scope: single agent vs multi-agent pipeline.
Tool names follow a consistent verb_noun pattern: list_, register_, update_, remove_, execute_, get_, set_. Naming clearly indicates both the action and the resource, with no mixed conventions or vague verbs.
Nine tools is well-scoped for an agent management and orchestration server. Each tool covers a necessary aspect of the domain without redundancy or bloat.
The tool surface provides complete agent lifecycle coverage (list, register, update, remove), execution paths for both individual and multi-agent workflows, safety controls, and model discovery. There are no obvious dead ends or missing operations for the stated purpose.
Maintenance
Related MCP Connectors
Let your AI agents hand work to each other, share files, and use apps you approve.
Connect AI assistants to your approved computer for files, commands, browser and desktop tasks.
Hand off work between AI agents in any tool. Start Devin or Cursor cloud and share memory.
One MCP endpoint for Claude, GPT & Gemini: 100+ tools + no-code connectors + agent workers.
Related MCP Servers
AlicenseNot gradedqualityDmaintenanceIntegrates 100+ specialized AI agents with Claude Desktop, providing automated agent discovery, multi-agent coordination, and ready-to-use task templates for complex development and business workflows. Enables users to leverage enterprise-level AI capabilities through actionable resources and intelligent agent matching.35 npmMIT- AlicenseNot gradedqualityDmaintenanceEnables multi-agent orchestration and coordination using specialized, persistent Claude agents for complex workflows like financial analysis and research. It supports intelligent agent handoffs, local storage, and pre-built team templates through Claude Desktop.MIT
- AlicenseNot gradedqualityCmaintenanceEnables Claude Code and Claude Desktop to delegate coding tasks to any model available in OpenCode while Claude remains the orchestrator, planning work, reviewing diffs, and running tests. Supports synchronous and async delegation, model selection, session continuation, and permission-aware execution.6MIT
- AlicenseBqualityBmaintenanceEnables Claude Code and Claude Desktop to delegate bounded, disposable tasks to local or cheap cloud models, with model scoring, guardrails, and cost-saved tracking.53MIT