Create a2a mcp
Skill OpenSIN-AI/OpenSIN-Skills/operations/agent-creation/create-a2a-mcp
> **Trigger phrases**: "create MCP", "scaffold MCP server", "add MCP to agent",From its SKILL.md
npx -y skills add OpenSIN-AI/OpenSIN-Skills --skill create-a2a-mcpAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
2 things to look at
- no licenseNo license file was found in the repository. Code published without one is not open source by default, so using it at work is a question for whoever answers licensing questions where you are.
- 2 stars2 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
SKILL.md
8.1 KB, ~2.1k tokens by cl100k_base, as published. Nobody here has run it
/create-a2a-mcp — Scaffold MCP Servers for A2A Agents
Trigger phrases: "create MCP", "scaffold MCP server", "add MCP to agent", "create-a2a-mcp", "/create-a2a-mcp" Works standalone AND as an integration hook from
/create-a2a.
Purpose
Scaffold a complete, production-ready MCP (Model Context Protocol) server surface for any A2A agent or standalone project. Generates all required files, registers in opencode.json, and validates the result.
When to Use
| Scenario | How |
|---|---|
| Building a new A2A agent | /create-a2a calls this skill automatically after base scaffold |
| Adding MCP to an existing agent | Call this skill directly on the agent root |
| Creating a standalone MCP server | Call this skill with a target directory |
What Gets Scaffolded
<agent-root>/
├── src/mcp-server.ts # MCP server with registerTool() pattern
├── mcp-config.json # MCP config for local consumers
├── clients/opencode-mcp.json # OpenCode client config
└── (cli.ts patched) # serve-mcp command added if missing
Plus optionally:
- Global registration in
~/.config/opencode/opencode.json - Bin wrapper at
/Users/jeremy/dev/SIN-Solver/bin/sin-<slug>
SSOT Paths
| Asset | Path |
|---|---|
| Template MCP server | /Users/jeremy/dev/SIN-Solver/a2a/template-repo/A2A-SIN-Agent-Template/src/mcp-server.ts |
| Template mcp-config | /Users/jeremy/dev/SIN-Solver/a2a/template-repo/A2A-SIN-Agent-Template/mcp-config.json |
| Template client config | /Users/jeremy/dev/SIN-Solver/a2a/template-repo/A2A-SIN-Agent-Template/clients/opencode-mcp.json |
| Template CLI | /Users/jeremy/dev/SIN-Solver/a2a/template-repo/A2A-SIN-Agent-Template/src/cli.ts |
| Global opencode config | /Users/jeremy/.config/opencode/opencode.json |
| SIN-Solver bin dir | /Users/jeremy/dev/SIN-Solver/bin/ |
| Shared lib | scripts/_mcp-lib.mjs (this skill) |
Built-in Scripts
| Script | Purpose | Usage |
|---|---|---|
scripts/_mcp-lib.mjs | Shared helpers (arg parsing, slug normalization, file I/O) | Imported by other scripts |
scripts/mcp-scaffold.mjs | Generate all MCP files from tool definitions | node mcp-scaffold.mjs --agent-root <path> --slug <name> --tools '<json>' |
scripts/mcp-register-global.mjs | Register MCP in global opencode.json | node mcp-register-global.mjs --slug <name> --agent-root <path> [--bin-wrapper] |
scripts/mcp-verify.mjs | Validate MCP setup completeness | node mcp-verify.mjs --agent-root <path> --slug <name> |
Workflow
Step 0 — Gather Input
Collect from user or from /create-a2a handoff:
| Parameter | Required | Description |
|---|---|---|
agent-root | ✅ | Absolute path to agent/project root |
slug | ✅ | MCP slug (e.g. sin-research, sin-server) |
namespace | ❌ | Tool namespace prefix (defaults to slug with - → _) |
tools | ❌ | JSON array of tool definitions (see format below) |
register-global | ❌ | Register in opencode.json (default: true) |
bin-wrapper | ❌ | Create bin wrapper in SIN-Solver/bin/ (default: false) |
env-vars | ❌ | JSON object of environment variables for MCP config |
Step 1 — Run Scaffold
SCRIPTS=~/.config/opencode/skills/create-a2a-mcp/scripts
node $SCRIPTS/mcp-scaffold.mjs \
--agent-root /path/to/agent \
--slug sin-myagent \
--tools '[{"name":"do_thing","description":"Does a thing","params":{"input":"string"},"action":"myagent.do_thing"}]'
This generates:
src/mcp-server.ts— Full MCP server with all tools registered viaMcpServer.registerTool()mcp-config.json— Local MCP configclients/opencode-mcp.json— OpenCode client config- Patches
src/cli.tsto includeserve-mcpcommand if missing
Step 2 — Register Globally (Optional)
node $SCRIPTS/mcp-register-global.mjs \
--slug sin-myagent \
--agent-root /path/to/agent \
--bin-wrapper
Step 3 — Verify
node $SCRIPTS/mcp-verify.mjs \
--agent-root /path/to/agent \
--slug sin-myagent
Expected output: all checks green.
Step 4 — Build & Smoke Test
npm --prefix <agent-root> run build
echo '{}' | node <agent-root>/dist/src/cli.js serve-mcp
# Should start without errors and respond to MCP protocol
Tool Definition Format
Each tool in the --tools JSON array:
{
"name": "do_thing",
"description": "Does a specific thing",
"params": {
"input": "string",
"count": "number?",
"confirm": "boolean?"
},
"action": "myagent.do_thing"
}
Type mapping:
string→z.string()(required)string?→z.string().optional()(optional)number→z.number()(required)number?→z.number().optional()(optional)boolean→z.boolean()(required)boolean?→z.boolean().optional()(optional)array→z.array(z.string())(required)array?→z.array(z.string()).optional()(optional)
Default Tools (Always Generated)
Every MCP server gets these baseline tools automatically:
<namespace>_help— Describe available agent actions<namespace>_health— Check base agent readiness<namespace>_onboarding_status— Read onboarding state<namespace>_onboarding_save— Persist onboarding state (requiresconfirm=true)
Integration with /create-a2a
When called from /create-a2a, the handoff contract is:
{
"agent-root": "/absolute/path/to/agent",
"slug": "sin-agentname",
"namespace": "sin_agentname",
"tools": [...],
"register-global": true,
"bin-wrapper": true,
"env-vars": { "KEY": "value" }
}
The /create-a2a SKILL.md should include this step after base scaffold:
### MCP Surface Generation
After scaffolding the base agent, invoke skill `create-a2a-mcp` to generate the MCP server surface.
Pass the agent-root, slug, and domain-specific tool definitions.
MCP Server Pattern Reference
Production Pattern (McpServer.registerTool — PREFERRED)
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
import { z } from 'zod';
const server = new McpServer({ name: 'sin-myagent', version: '0.1.0' });
server.registerTool('sin_myagent_help',
{ description: 'Describe available actions.' },
async () => ({
content: [{ type: 'text', text: JSON.stringify(result, null, 2) }],
})
);
const transport = new StdioServerTransport();
await server.connect(transport);
Transport Modes
| Mode | When | Config |
|---|---|---|
| stdio | Local agents, opencode CLI | Default. Always use for A2A agents. |
| streamable-http | Remote/cloud agents | Only if agent runs on remote VM |
| SSE | Legacy | DEPRECATED. Never use for new agents. |
Anti-Patterns
❌ Template name drift — always replace template-a2a-sin-agent with actual slug
❌ Missing serve-mcp in CLI — breaks opencode integration
❌ Business logic in mcp-server.ts — keep it thin, delegate to runtime.ts
❌ Hardcoded paths in mcp-config.json — use relative paths for portability
❌ SSE transport for new projects — use stdio or streamable-http
❌ Shared mutable server state across clients — fresh handler per call
Checklist
-
src/mcp-server.tsexists with all tools registered -
mcp-config.jsonexists with correct slug -
clients/opencode-mcp.jsonexists with correct slug -
src/cli.tshasserve-mcpcommand - No template name drift (no
template-a2a-sin-agentreferences) - Global opencode.json registration (if requested)
- Bin wrapper created (if requested)
-
npm run buildsucceeds -
serve-mcpstarts without errors - All default tools respond (help, health, onboarding)
Related Skills
- See Skill Catalog for related skills
What ships with it
Read from the repository
Just SKILL.md. No reference files, no scripts.
Gives 0 of the 12 instructions most mcp tooling skills give in ~2.1k tokens
Counted across 638 of the 750 authors here whose files we hold, read 2026-08-07
- Create ten complex or independent read-only evaluation questionsin 69 of 638, across 15 files
- Test servers using MCP Inspectorin 61 of 638, across 19 files
- Provide actionable error messages with specific next stepsin 54 of 638, across 12 files
- Prioritize comprehensive API coverage over specific workflows or workflow toolsin 54 of 638, across 12 files
- Use TypeScript and Streamable HTTP for remote servers or clientsin 54 of 638, across 8 files
- Define structured output schemas where possiblein 50 of 638, across 8 files
- Use Zod or Pydantic for input schemasin 47 of 638, across 5 files
- Fetch MCP specification pages with markdown suffixin 46 of 638, across 4 files
- Load framework documentation using WebFetchin 45 of 638, across 3 files
- Verify each evaluation answer independentlyin 45 of 638, across 3 files
- Implement API client with authentication and paginationin 45 of 638, across 3 files
- Define input schemas with validationin 27 of 638, across 9 files
Said here and by no other author read
- gather required parameters before scaffolding
- run the mcp scaffold script
- register the server globally if requested
- execute a build and smoke test
- keep business logic out of mcp-server
- use relative paths in mcp-config
Grouped from the skills themselves: near-identical wordings counted once, and counted by distinct author, so one author publishing three of these counts once. Length counted with cl100k_base; the agent that loads this file may tokenize it differently.