Intermediate~32 minHazelJS
Skillgate and MCP Integration Styles
Compare direct @Tool, Skillgate.fromOpenApi, and MCP export/import under one ToolRegistry policy plane—with code.
- Authors
- editorial-team
- Published
- Last reviewed
Progress is stored locally in this browser.
Direct answer
| Style | Use when |
|---|---|
Direct @Tool | Few bespoke tools with custom adapters |
| Skillgate | Curated REST/module → skills + gate.report() |
| MCP | Cross-host protocol / external servers on a curated registry |
Comparison: /compare/mcp-vs-skillgate-vs-direct-api.
Worked example — Skillgate → ToolRegistry
typescript
import { Skillgate } from '@hazeljs/skillgate';
import { ToolRegistry, AgentRuntime } from '@hazeljs/agent';
const gate = Skillgate.fromOpenApi(openApiSpec, {
include: { tags: ['agent'] }, // opt-in — not every CRUD route
invoke: {
baseUrl: 'http://127.0.0.1:3000',
headers: { Authorization: 'Bearer ${API_TOKEN}' },
},
});
const registry = new ToolRegistry();
gate.register(registry, 'api-concierge');
const report = gate.report();
console.log(report.included, report.denied, report.warnings);
// Fail CI if denied contains surprises or included grows past warnAbove
const runtime = new AgentRuntime({ toolRegistry: registry /* + llmProvider */ });
await runtime.execute('api-concierge', 'List my open invoices', {
maxSteps: 6,
budget: { maxTokens: 20_000 },
});
Optional MCP export (same curated surface)
typescript
const server = gate.toMcpServer({
name: 'api-concierge-skills',
version: '1.0.0',
agentName: 'api-concierge',
});
// listen via documented MCP transport — do not maintain a second broader tool list
No MCP-native allow-list API—curation is registration + Skillgate include/deny.
Next
/guides/skillgate-from-openapi-to-tool-registry · /guides/secure-mcp-servers-and-agent-tools
Artifact: Decision note: which integration style per capability domain