Mcp Create Declarative Agent

Mcp Create Declarative Agent automation and integration

MCP Create Declarative Agent is an AI skill for building Model Context Protocol agents through declarative configuration files rather than imperative code. It covers agent definition schemas, tool registration, prompt templates, resource binding, and deployment configuration that enable developers to create MCP-compliant agents with minimal boilerplate.

What Is This?

Overview

MCP Create Declarative Agent provides structured approaches to defining AI agents using configuration. It handles declaring agent capabilities and instructions through YAML or JSON schema files, registering tools that the agent can invoke with typed parameter definitions, defining prompt templates that structure agent interactions for specific use cases, binding external resources like files, APIs, and databases as agent context sources, configuring transport and deployment settings for local and remote execution, and composing multi-agent systems by referencing other agent definitions.

Who Should Use This

This skill serves developers building MCP-compatible AI agents without extensive framework code, platform teams creating agent templates for organization-wide adoption, engineers prototyping agent capabilities through configuration before writing custom logic, and teams standardizing agent definitions across multiple projects.

Why Use It?

Problems It Solves

Building agents from scratch requires writing boilerplate for tool registration, prompt management, and transport handling. Without standardized configuration, agent definitions are scattered across code files and difficult to review. Modifying agent behavior requires code changes and redeployment rather than configuration updates. Sharing agent definitions across teams lacks a common format.

Core Highlights

Declarative configuration defines agent behavior without writing framework boilerplate. Schema validation catches configuration errors before runtime. Tool registration uses typed definitions that generate proper MCP protocol messages. Configuration-driven deployment supports switching between local and remote transports.

How to Use It?

Basic Usage

name: code-reviewer
version: 1.0.0
description: Reviews pull requests for code quality

instructions: |
  You are a code review assistant. Analyze diffs for:
  - Security vulnerabilities
  - Performance issues
  - Code style violations
  Provide specific, actionable feedback.

model:
  provider: anthropic
  name: claude-sonnet-4-20250514
  max_tokens: 4096

tools:
  - name: read_file
    description: Read a file from the repository
    parameters:
      path:
        type: string
        description: File path relative to repo root
        required: true

  - name: search_code
    description: Search codebase for a pattern
    parameters:
      query:
        type: string
        required: true
      file_pattern:
        type: string
        default: "*"

resources:
  - type: directory
    path: ./src
    description: Source code directory

prompts:
  - name: review_pr
    template: |
      Review this pull request diff:
      {diff_content}
      Focus on: {review_focus}

Real-World Examples

import yaml
from dataclasses import dataclass, field
from pathlib import Path

@dataclass
class ToolDef:
    name: str
    description: str
    parameters: dict = field(default_factory=dict)

@dataclass
class AgentConfig:
    name: str
    version: str
    description: str
    instructions: str
    tools: list = field(default_factory=list)
    resources: list = field(default_factory=list)
    prompts: list = field(default_factory=list)

class AgentLoader:
    def load(self, config_path):
        with open(config_path) as f:
            raw = yaml.safe_load(f)
        tools = [
            ToolDef(
                name=t["name"],
                description=t["description"],
                parameters=t.get("parameters", {})
            )
            for t in raw.get("tools", [])
        ]
        return AgentConfig(
            name=raw["name"],
            version=raw["version"],
            description=raw["description"],
            instructions=raw["instructions"],
            tools=tools,
            resources=raw.get("resources", []),
            prompts=raw.get("prompts", [])
        )

    def validate(self, config):
        errors = []
        if not config.name:
            errors.append("Agent name is required")
        if not config.instructions:
            errors.append("Instructions are required")
        for tool in config.tools:
            if not tool.description:
                errors.append(
                    f"Tool {tool.name} missing description"
                )
        return errors

loader = AgentLoader()
config = loader.load("agent.yaml")
errors = loader.validate(config)
if errors:
    print(f"Validation errors: {errors}")
else:
    print(f"Agent {config.name} v{config.version} loaded")
    print(f"Tools: {[t.name for t in config.tools]}")

Advanced Tips

Use YAML anchors and aliases to share common tool definitions across multiple agent configurations. Validate agent configs in CI to catch schema errors before deployment. Parameterize model settings so the same agent definition works with different providers by changing one field.

When to Use It?

Use Cases

Use MCP Create Declarative Agent when building MCP agents that can be defined through configuration rather than code, when creating reusable agent templates for team adoption, when prototyping agent capabilities before implementing custom tool handlers, or when standardizing agent definitions across an organization.

Related Topics

Model Context Protocol specification, MCP tool schemas, agent orchestration patterns, YAML configuration management, and declarative infrastructure patterns complement MCP agent creation.

Important Notes

Requirements

MCP-compatible runtime for executing the declared agent. YAML or JSON schema validator for configuration checking. Tool handler implementations for declared tool definitions.

Usage Recommendations

Do: write detailed tool descriptions that help the model understand when to invoke each tool. Include parameter types and constraints in tool definitions for proper validation. Version agent configurations alongside application code for change tracking.

Don't: declare tools without implementing their handlers, which causes runtime failures. Put sensitive credentials in agent config files committed to version control. Create overly complex agent definitions that would be clearer as imperative code.

Limitations

Declarative configuration cannot express complex conditional tool selection logic. Agent behavior depends on the model interpreting instructions correctly from the configuration. Custom transport or authentication requirements may need imperative code beyond the schema.