MCP & A2A Protocols

Advertise your agent's tools and skills using Model Context Protocol (MCP) and Agent-to-Agent (A2A) communication.

Model Context Protocol (MCP)

MCP allows agents to expose tools, prompts, and resources that can be called by other agents or AI systems. When you set an MCP endpoint, the SDK automatically extracts the available capabilities.

// Set MCP endpoint (auto-extracts tools, prompts, resources)
await agent.setMCP('https://api.example.com/mcp', '2025-06-18');

// The SDK automatically populates:
console.log(agent.mcpTools);     // ['code_generation', 'data_analysis']
console.log(agent.mcpPrompts);   // ['summarize', 'translate']
console.log(agent.mcpResources); // ['documents', 'images']

// Set MCP without auto-fetch
await agent.setMCP('https://api.example.com/mcp', '2025-06-18', false);

Agent-to-Agent (A2A)

A2A enables direct communication between agents. Set an A2A endpoint pointing to your agent card, and the SDK extracts your agent's skills.

// Set A2A endpoint (auto-extracts skills)
await agent.setA2A(
  'https://api.example.com/agent-card.json', 
  '0.30'
);

// The SDK automatically populates:
console.log(agent.a2aSkills); // ['python', 'data_analysis', 'nlp']

// Set A2A without auto-fetch
await agent.setA2A('https://api.example.com/agent-card.json', '0.30', false);

OASF Skills & Domains

Use standardized OASF (Open Agent Skills Format) taxonomies to describe your agent's capabilities. This enables better discovery and matching.

// Add OASF skills (validated against taxonomy)
agent.addSkill('data_engineering/data_transformation_pipeline', true);
agent.addSkill('natural_language_processing/summarization', true);
agent.addSkill('advanced_reasoning_planning/strategic_planning', true);

// Add OASF domains
agent.addDomain('finance_and_business/investment_services', true);
agent.addDomain('technology/data_science/data_visualization', true);

// Remove skills/domains
agent.removeSkill('data_engineering/data_transformation_pipeline');
agent.removeDomain('technology/data_science/data_visualization');

Common OASF Skills

  • data_engineering/data_transformation_pipeline
  • natural_language_processing/summarization
  • natural_language_processing/natural_language_generation
  • advanced_reasoning_planning/strategic_planning
  • code_intelligence/code_generation

Managing Endpoints

You can add, update, and remove endpoints as needed.

// Remove specific endpoint by type
agent.removeEndpoint({ type: 'A2A' });
agent.removeEndpoint({ type: 'MCP' });

// Remove endpoint by value
agent.removeEndpoint({ value: 'https://old-endpoint.com' });

// Remove all endpoints
agent.removeEndpoints();

// Set ENS name endpoint
agent.setENS('myagent.eth');

// Re-register to persist changes
await agent.registerIPFS();

Endpoints in Registration File

Here's how MCP, A2A, and OASF endpoints appear in the registration file:

{
  "endpoints": [
    {
      "name": "MCP",
      "endpoint": "https://mcp.myagent.com/",
      "version": "2025-06-18"
    },
    {
      "name": "A2A",
      "endpoint": "https://myagent.com/.well-known/agent-card.json",
      "version": "0.3.0"
    },
    {
      "name": "OASF",
      "endpoint": "https://github.com/agntcy/oasf/",
      "version": "v0.8.0",
      "skills": [
        "data_engineering/data_transformation_pipeline",
        "natural_language_processing/summarization"
      ],
      "domains": [
        "finance_and_business/investment_services",
        "technology/data_science/data_visualization"
      ]
    },
    {
      "name": "ENS",
      "endpoint": "myagent.eth"
    }
  ]
}

Search Agents by Protocols

Find agents with specific protocol support or capabilities.

// Find agents with MCP support
const mcpAgents = await sdk.searchAgents({ hasMCP: true });

// Find agents with specific MCP tools
const toolAgents = await sdk.searchAgents({
  mcpTools: ['code_generation', 'data_analysis'],
});

// Find agents with A2A and specific skills
const skillAgents = await sdk.searchAgents({
  hasA2A: true,
  a2aSkills: ['python', 'nlp'],
});

// Find agents by OASF taxonomies
const oasfAgents = await sdk.searchAgents({
  oasfSkills: ['data_engineering/data_transformation_pipeline'],
  oasfDomains: ['finance_and_business/investment_services'],
});