mcp
v0.6.0Expose AgentsKit tools as an MCP server for hosts supporting the documented 2024-11-05 tools bridge.
Expose AgentsKit tools as an MCP server — use them from Claude Desktop, Cursor, Windsurf, or another host that supports the documented 2024-11-05 tools bridge. @agentskit/mcp is the bridge from AgentsKit tools and agents into MCP-compatible coding agents. Docs: MCP package guide · agent handoff
Summary extracted from the README.
@agentskit/mcp
Profile: major-package
Tags: agentskit · typescript · ai-agents
Expose AgentsKit tools as an MCP server — use
them from Claude Desktop, Cursor, Windsurf, or another host that supports the
documented 2024-11-05 tools bridge.
Verified proof
- Package metadata and tests live under
packages/mcp/. - MCP package guide: https://www.agentskit.io/docs/agents/tools/mcp
- Stability map: docs/STABILITY.md
How this fits the ecosystem
@agentskit/mcp is the bridge from AgentsKit tools and agents into MCP-compatible coding agents.
- AgentsKit: expose tools, integrations, and registry agents through a standard MCP server.
- Registry: serve ready agents from registry.agentskit.io as callable MCP tools.
- Playbook: use playbook.agentskit.io for safe tool design, approvals, and agent handoff patterns.
Docs: MCP package guide · agent handoff
npx -y @agentskit/mcp@0.6.0 --tools fetch,search
Then point your MCP host at the command. Claude Desktop, Cursor, Codex, and OpenClaw all launch the same stdio server with host-specific configuration.
Claude Desktop or Cursor (mcpServers / .cursor/mcp.json):
{
"mcpServers": {
"agentskit": { "command": "npx", "args": ["-y", "@agentskit/mcp@0.6.0", "--tools", "fetch,search"] }
}
}
Codex (~/.codex/config.toml):
[mcp_servers.agentskit]
command = "npx"
args = ["-y", "@agentskit/mcp@0.6.0", "--tools", "fetch,search"]
OpenClaw:
openclaw mcp add agentskit \
--command npx \
--arg -y \
--arg @agentskit/mcp@0.6.0 \
--arg --tools \
--arg fetch,search
openclaw mcp doctor agentskit --probe
Verify the server in each host with its MCP tool-list command before enabling additional tools. Pi does not have a native MCP host path in this recipe; use a Pi extension or package when a dedicated integration is available.
Flags
| Flag | Effect |
|---|---|
--tools <a,b> |
which tools to expose (default fetch,search). Available: fetch, search, filesystem, shell, sqlite |
--fs-root <dir> |
enable the filesystem tool, rooted at <dir> |
--sqlite <file> |
enable the sqlite query tool against <file> |
--allow-shell |
enable the shell tool (off by default — it runs commands) |
stdout is the MCP JSON-RPC channel; human output goes to stderr.
The bridge supports MCP protocol revision 2024-11-05 and the
initialize/tools/list/tools/call lifecycle over stdio, in-memory, or an
injected transport. Hosts own resources, prompts, sampling, tasks,
HTTP/WebSocket, authentication, rate limiting, and persistence. Tool arguments are
validated against their JSON Schema before execution; tools without a schema
accept only an empty object. Invalid protocol envelopes and params are
rejected, and tool failures are sanitized by default.
Programmatic
import { createAgentsKitMcpServer } from '@agentskit/mcp'
import { fetchUrl } from '@agentskit/tools'
createAgentsKitMcpServer({ tools: [fetchUrl()] }) // stdio by default
Pass transport to use a custom MCP transport (e.g. in-memory for tests).
Pass authorizeToolCall to createAgentsKitMcpServer to obtain host approval
for tools marked requiresConfirmation. It has the same type as
McpServerOptions['authorizeToolCall']: (tool, args) => boolean | Promise<boolean>.
Arguments are validated first. Only confirmation-required tools invoke the
hook; absent hooks, denied approvals, throws, and rejected promises prevent
execution. The host must obtain the required human confirmation before
returning true; annotations do not replace that decision.
McpToolDefinition (from @agentskit/tools/mcp) extends the core tool
shape with optional title and annotations: title, readOnlyHint,
destructiveHint, idempotentHint, and openWorldHint. Server listing and
client import preserve these fields, including explicit false hints.
Imported titles use the existing maxDescriptionBytes UTF-8 limit; malformed
metadata is rejected. Hints remain untrusted advisory data and never grant
confirmation or alter execution policy.
These fields follow the MCP tool metadata specification.
They are optional descriptor extensions on the existing 2024-11-05 bridge;
older clients may ignore unknown fields. This does not add negotiation or
other features from newer protocol revisions.
Expose whole agents (agents as MCP tools)
Run a registry agent server-side and expose it as a single MCP tool — the host delegates a specialized job instead of orchestrating primitives:
npx @agentskit/mcp@0.6.0 --agents legal-contract-reviewer,fintech-kyc-screener --provider openai
--provider covers the first-class adapters (openai, anthropic, gemini, ollama)
plus the OpenAI-compatible set (deepseek, grok, groq, mistral, cohere, together,
fireworks, openrouter, cerebras, kimi, huggingface, qwen, lmstudio, vllm, llamacpp)
and any other OpenAI-compatible provider in the models.dev catalog. Key from
--api-key or <PROVIDER>_API_KEY; --model / --base-url optional.
import { createAgentTool } from '@agentskit/mcp'
createAgentsKitMcpServer({ tools: [createAgentTool({ id, description, systemPrompt, adapter })] })
Typed Registry projections use fetchAgent + createTypedAgentTool; their
input/output JSON Schemas are preserved. fetchAgentSkill intentionally
rejects typed projections so they cannot be flattened into a text tool.
fetchAgent and fetchAgentSkill try the hosted registry first and may fall
back to raw registry files when hosted data is unavailable or unreadable. Each
response is limited to 131072 bytes and each request to 10000 ms by default.
Set maxResponseBytes (1–1048576) or timeoutMs (1–120000) to adjust those
bounds, or pass an AbortSignal; aborting stops later fallback requests.
Oversized bodies are cancelled and treated as a failed source. Calls resolve to
null for invalid IDs or options, aborted operations, typed projections passed
to fetchAgentSkill, or when neither source provides a supported result.
Network error codes are not exposed by these APIs.
import { fetchAgent, fetchAgentSkill } from '@agentskit/mcp'
const agent = await fetchAgent('legal-contract-reviewer', fetch, { maxResponseBytes: 131072 })
const skill = await fetchAgentSkill('legal-contract-reviewer')
Quick start
import { createAgentsKitMcpServer } from '@agentskit/mcp'
import { createInMemoryTransportPair } from '@agentskit/tools/mcp'
const [, transport] = createInMemoryTransportPair()
const server = createAgentsKitMcpServer({ tools: [], transport })
await server.close()
Remote (Streamable HTTP) + OAuth-protected resource + MCP Apps
createStreamableHttpHandler exposes the same tools over the official MCP
Streamable HTTP transport using Web Request/Response. It is stateless, so
it runs unchanged on Node.js 20+, Cloudflare Workers, Deno, and Bun.
import { createStreamableHttpHandler } from '@agentskit/mcp'
const handler = createStreamableHttpHandler({
tools: [/* your AgentsKit tools */],
verifyBearer: async (token) =>
token === 'expected-token' ? { subject: 'user-1', scopes: ['tools:read'] } : null,
resource: 'https://agent.example.invalid/mcp',
authorizationServers: ['https://auth.example.invalid'],
scopesSupported: ['tools:read'],
})
export default {
fetch: (request: Request) => handler(request),
}
resource is required when verifyBearer is set. Requests without a valid
Authorization: Bearer token receive 401 with a WWW-Authenticate: Bearer resource_metadata="..." challenge (RFC 9728). The metadata URL is derived from
resource: https://agent.example.invalid/mcp is served at
https://agent.example.invalid/.well-known/oauth-protected-resource/mcp;
a resource without a path uses the root well-known URL. Without authentication,
metadata is served only when resource is configured. Verified identities
reach tool handlers as context.auth (McpAuthIdentity: subject, optional
scopes, claims).
Expose an MCP App by adding a ui:// resource and linking it from a tool:
const handler = createStreamableHttpHandler({
tools: [{
name: 'status',
app: { resourceUri: 'ui://status/app.html' },
execute: () => 'ok',
}],
resources: [{
uri: 'ui://status/app.html',
name: 'Status app',
mimeType: 'text/html;profile=mcp-app',
text: '<!doctype html><title>Status</title>',
}],
})
Tool descriptors keep annotations, title, and raw _meta. app is a
shorthand for _meta.ui.resourceUri; use _meta directly for other MCP Apps
metadata.
Maturity and compatibility
- Stability: beta — see docs/STABILITY.md
- Node.js 20+ and TypeScript strict mode
- Published as
@agentskit/mcp
Contributing
See CONTRIBUTING.md and the monorepo LICENSE.