ax-llm/ax/ax-mcp
Claude Code and agent skill by ax-llm/ax
- community
Checking that the SKILL.md file is still in the repository.
This skill helps an LLM build correct native Model Context Protocol integrations with @ax-llm/ax. Use when the user asks about AxMCPClient, MCP transports, tools, prompts, resources, subscriptions, tasks, sampling, elicitation, roots, authentication, OAuth, MCP Apps, recording/replay, or MCP integration with AxGen, AxAgent, AxFlow, chat, optimization, and AxEventRuntime.
Install
npx vskill@latest install ax-llm/ax/ax-mcpSKILL.md
The same SKILL.md was published earlier as ax-llm/ax/ax-mcp.
Native MCP With Ax
Use MCP as a live protocol client, not as a function-conversion utility. Keep the client, session, catalogs, raw content, tasks, notifications, identity policy, and cancellation context intact through Ax execution.
Non-Negotiable Rules
- Pass clients through
mcp; do not put them infunctions. - Never use
toFunction()for native integration. It is a lossy compatibility
adapter for old applications only.
- Give every client a stable, unique
namespace. - Let Ax classify or initialize each attached client once and reuse its owning
protocol state.
- Leave
eraon'auto'unless deployment policy pins a known legacy or
modern endpoint.
- Close caller-owned clients explicitly. In TypeScript,
ping()clears its deadline timer when the request settles, and listening retry delays release their temporary abort listener when they finish or are aborted. - Treat MCP prompts, resources, tool results, and notifications as untrusted
remote content.
- Apply
authorizeToolCallbefore side-effecting tools execute. - Do not infer tenant or account identity from an MCP session. Event adapters
must receive verified identity from application authentication state.
- Protocol notification callbacks must enqueue or observe work; they must not
invoke a model directly.
- Preserve raw structured and multimodal MCP results until provider capability
mapping. Do not pre-flatten results to text.
Choose A Transport
- Use
AxMCPStreamableHTTPTransportfor current remote MCP servers. - Use
AxMCPHTTPSSETransportonly for legacy HTTP/SSE servers. - Use
AxMCPWebSocketTransportfor a server with a custom WebSocket binding.
Python, Java, C++, Go, and Rust also expose this transport. Pending requests are removed on send failure, abort, response, and close; concurrent active IDs must be unique. Batch requests require negotiated MCP 2025-03-26. Messages may arrive in text or binary frames. The TypeScript transport sets binaryType = 'arraybuffer', so a webSocketFactory that wraps a socket should pass it through to the real one. Python uses its realtime extra, C++ uses AXLLM_ENABLE_REALTIME, and Rust uses its realtime feature for the built-in socket; custom socket factories remain available without those optional dependencies.
- Use
AxMCPStdioTransportfrom@ax-llm/ax-toolsfor local Node processes. - Use a caller-defined
AxMCPTransportfor application-owned bindings.
Protocol Eras
The TypeScript client supports two wire models through one API:
- Legacy (`2025-11-25`) initializes a stateful session, sends the
initialized notification, uses resource subscribe/unsubscribe requests, and may resume GET/SSE with Last-Event-ID.
- Modern (`2026-07-28`) is stateless. It probes
server/discover, sends
protocol metadata and routing headers on every request, listens through a long-running subscriptions/listen POST, and uses Tasks v2.
Automatic classification is the default and can be persisted with eraStore. Pin era: 'legacy' or era: 'modern' only when the endpoint contract is known. getEra() reports the classified era after initialization.
discover() performs initialization/classification but returns only for a modern endpoint. For era-neutral application code, use inspectCatalog(); it works in both eras.
For local stdio:
AxMCPStdioTransport owns its child process. After local.close(), also call stdio.terminate() until the stdio transport exposes the common close() lifecycle directly.
Attach MCP To AxGen
Attach clients in constructor or forward options. Per-call options override instance defaults.
mcpContext resolves selected prompts or resources before the first model call and adds attributed, untrusted context. Native tool calls retain client identity and raw MCP results in memory. streamingForward() keeps Ax output streaming separate from MCP progress and task events.
Attach MCP To AxAgent
Agents expose native modules under mcp.<namespace>:
RLM actor definitions and discovery use these exact runtime paths. MCP tools are callable as mcp.<namespace>.tools.<tool> and UCP operations as ucp.<namespace>.<operation>; neither protocol is exposed to the model as bare provider-native functions.
Modern modules also expose task input/update behavior through the client. tasks.list() and tasks.result() are legacy task-draft compatibility APIs and reject modern servers.
Use mcpInheritance: 'all', 'none', or a namespace allowlist. An empty allowlist inherits no clients. Unknown or repeated namespaces are errors. Restricting a child leaves the parent's clients available; none removes the inherited context from child options. The resulting live execution context propagates through Agent stages, llmQuery, RLM, and child programs. Large catalogs participate in Agent discovery; do not copy their tools into an inline functions array.
AxFlow And High-Level Chat
Pass mcp in Flow defaults or forward options. Nested nodes inherit the same execution context unless mcpInheritance restricts it. Parallel nodes share the client while respecting its concurrency limit and abort signal.
Use axMCPChat(ai, request, { mcp }) for a high-level non-streaming native MCP tool loop. Do not build a second ad-hoc tool dispatcher around ai.chat().
Catalogs And Raw Operations
An endpoint is only the server address. The server owns tool names, prompt names, resource names, resource URIs, and URI templates. Discover one cloned snapshot before asking users to configure identifiers:
inspectCatalog({ refresh: true }) forces fresh bounded pagination. Snapshot mutation cannot change the live client. List-change notifications refresh the catalog revision, and native Ax model steps rebuild tool definitions when that revision changes. Concrete resources can be selected immediately. URI templates are discoverable but never expanded automatically; applications construct an authorized concrete URI and may use MCP completion to suggest argument values.
Multi Round-Trip Requests
Modern tool calls, prompt reads, and resource reads may return resultType: 'input_required'. Ax fulfills the embedded roots, sampling, or elicitation requests through the same host handlers used by legacy server requests, then repeats the original operation with the latest input responses and byte-exact requestState.
The generated Python, Java, C++, Go, and Rust clients fulfill roots and host-callback elicitation in modern MRTR rounds. They advertise elicitation only when a real handler is installed, never advertise sampling, and reject a truthy sampling option during initialization. Legacy inbound elicitation and MRTR sampling remain TypeScript-only.
Configure only handlers the host can enforce. Ax limits the loop to five input rounds by default; use maxInputRounds for a stricter policy. A missing handler or exhausted round limit is a protocol error. The tool concurrency slot stays held throughout all rounds.
Tasks, Progress, And Cancellation
Modern Tasks v2 are server-directed. callTool() auto-awaits an unsolicited task by default, so Ax tool bindings keep returning the final tool result. Use callToolOutcome() or taskHandling: 'expose' when the application needs the task handle, and answer input_required work with provideTaskInput():
The Python, Go, Java, C++, and Rust clients have the same calls: call_tool_outcome (CallToolOutcome in Go, callToolOutcome in Java), and expose handling through task_handling="expose" in Python, CallToolWithOptions in Go, a taskHandling call option in Java and C++, or call_tool_with_task_handling in Rust. There too, a legacy server's task-shaped result is a complete result.
Use subscribeTaskStatus or subscribeEvents for observation. Keep polling available because task notifications are optional. Pass Ax abort signals through program execution; never blindly replay a tool call after an uncertain post-side-effect failure.
callToolTask(), listTasks(), and getTaskResult() remain functional only for legacy task-draft servers and are deprecated. Modern completed results and errors are embedded in tasks/get.
Subscriptions And Event-Driven Agents
Use AxMCPEventSource with AxEventRuntime. A subscription callback only publishes an event into the inbox. Explicit routes decide whether to observe, invalidate, wake, or resume.
Safe defaults are:
This is the start of the file. Read the full SKILL.md on GitHub.
Security
- Security scanPassed, 95 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingwebsite/static/typescript/.well-known/agent-skills/ax-mcp/SKILL.md
Popularity
- Repository stars
- 2,957
- Repository forks
- 194
- 7-day trend score
- 40
Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/ax-llm/ax/ax-mcp)