Skills DirectorySkills Directory
SkillsLearnSecurityCategoriesDocsBlogPro
Sign InSubmit Skill
Skills Directory

Security-tested agent skills for Claude, coding agents, and AI workflows.

Directory

  • Browse Skills
  • All Skills A–Z
  • Claude Skills
  • Claude Code Skills
  • Agent Skills
  • Categories
  • Authors
  • Submit a Skill

Learn

  • Learn Hub
  • Install Claude Skills
  • Write SKILL.md
  • Skills vs MCP
  • Directories Compared

Security

  • Security
  • Methodology
  • Secure Claude Skills
  • Security Badges
  • Chrome Extension
  • Skill Manager

Company

  • About
  • Community
  • Blog
  • API Docs
  • Advertise

2026 Skills Directory. All rights reserved.

ProTermsPrivacyRefunds
Back to skills

Apx Mcp Builder

ASecurity

Author a new MCP (Model Context Protocol) server and register it in APX. Covers JSON-RPC stdio protocol, FastMCP (Python) / TypeScript SDK shapes, tool design, secrets, debugging. Load when building a new MCP / exposing a new tool surface. To add an existing MCP, load `apx-mcp` instead.

12 stars
0 votes
0 copies
0 views
Added 9/27/2026
ai-agentstypescriptpythonbashnodedebugginggit

Works with

mcp

Security Analysis

A96/100
mediumInstalls packages at runtime which could introduce malicious dependencies

Pro shows the line behind each finding and how to fix it

Scanned 10/7/2026

$npx -y skills add agentprojectcontext/apx --skill apx-mcp-builder --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Apx Mcp Builder?

Add the live security badge to your README — it updates automatically with every re-scan.

Security grade badge for Apx Mcp Builder
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/agentprojectcontext-apx-mcp-builder/badge)](https://www.skillsdirectory.com/skills/agentprojectcontext-apx-mcp-builder)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
Files
SKILL.md
---
name: apx-mcp-builder
scope: internal
description: Author a new MCP (Model Context Protocol) server and register it in APX. Covers JSON-RPC stdio protocol, FastMCP (Python) / TypeScript SDK shapes, tool design, secrets, debugging. Load when building a new MCP / exposing a new tool surface. To add an existing MCP, load `apx-mcp` instead.
---

# apx-mcp-builder

An MCP server is a tiny stdio JSON-RPC process. APX spawns it (via `apx mcp add`), discovers tools (`tools/list`), and lets the super-agent call them by name.

## Minimum surface

| Method | Purpose | Returns |
|---|---|---|
| `initialize` | Handshake (protocol version + capabilities). | Server capabilities. |
| `tools/list` | Enumerate tools. | `{ tools: [{name, description, inputSchema}] }` |
| `tools/call` | Run one tool with `{ name, arguments }`. | `{ content: [...], isError? }` |
| `notifications/initialized` | One-way init-done from APX. | — |

JSON-RPC 2.0 over stdio, framed `Content-Length: N\r\n\r\n<JSON>`. The `@modelcontextprotocol/sdk` (TS) and `fastmcp` / `mcp` (Python) packages handle framing.

## Pick a stack

| Stack | When |
|---|---|
| **Python + FastMCP** | Fastest path; decorator-based; ideal for pip-wrapping tools. |
| **Node + @modelcontextprotocol/sdk** | Node-only libs, or zero install (`npx -y`). |
| Raw JSON-RPC | Only when exposing an existing daemon. Otherwise use the SDK. |

## Python (FastMCP) — minimum viable server

```python
# my_server.py
from mcp.server.fastmcp import FastMCP

mcp = FastMCP("my-server")

@mcp.tool()
def search_inventory(query: str, limit: int = 10) -> list[dict]:
    """Search the inventory by free-text query. Returns matching SKUs."""
    return [{"sku": "abc", "title": "..."}]

@mcp.tool()
def get_stock(sku: str) -> dict:
    """Return the current stock count for a SKU."""
    return {"sku": sku, "stock": 42}

if __name__ == "__main__":
    mcp.run()  # stdio transport
```

```bash
pip install fastmcp
# or: uv tool install fastmcp

apx mcp add my-server \
  --command uv --project acme \
  -- run python /abs/path/my_server.py
```

## Node (TypeScript SDK) — minimum viable server

```typescript
// my-server.ts
import { Server } from "@modelcontextprotocol/sdk/server/index.js";
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
import {
  ListToolsRequestSchema,
  CallToolRequestSchema,
} from "@modelcontextprotocol/sdk/types.js";

const server = new Server(
  { name: "my-server", version: "0.1.0" },
  { capabilities: { tools: {} } }
);

server.setRequestHandler(ListToolsRequestSchema, async () => ({
  tools: [
    {
      name: "search_inventory",
      description: "Search the inventory by free-text query.",
      inputSchema: {
        type: "object",
        properties: {
          query: { type: "string" },
          limit: { type: "number", default: 10 },
        },
        required: ["query"],
      },
    },
  ],
}));

server.setRequestHandler(CallToolRequestSchema, async (req) => {
  if (req.params.name === "search_inventory") {
    const { query, limit = 10 } = req.params.arguments as any;
    return {
      content: [{ type: "text", text: JSON.stringify([{ sku: "abc" }]) }],
    };
  }
  throw new Error(`unknown tool: ${req.params.name}`);
});

await server.connect(new StdioServerTransport());
```

```bash
apx mcp add my-server \
  --command npx --project acme \
  -- -y my-server-package
```

## Tool design rules

1. **Names are snake_case verbs**: `search_inventory`, not `inventorySearch`.
2. **inputSchema is JSON Schema draft-07**. `required` matters — vague schemas → bad calls.
3. **Descriptions read like a man-page**. Tool + param descriptions are surfaced to the model.
4. **Return structured data**, not prose. Convention: JSON inside a text content block. Images use the `image` type.
5. **Errors are errors**: `throw new Error(...)` propagates as `isError: true`. Empty result = "found nothing" — different signal.

## Env vars and secrets

```bash
apx mcp add github \
  --scope runtime --project acme \
  --command npx \
  --env GITHUB_TOKEN=ghp_xxx \
  --env GITHUB_OWNER=acme \
  -- -y @modelcontextprotocol/server-github
```

`--scope runtime` writes to `~/.apx/projects/<id>/mcps.json` (chmod 0600, never committed). NEVER `--scope shared` for tokens — that file lives in `.apc/` and gets committed.

## Anti-examples

```python
# DON'T expose every internal function. A server with 40 tools eats context.
# Pick 5-10 high-value tools per server; split into multiple servers if more.

# DON'T return giant blobs in `content`. The agent re-reads every turn.
# Paginate (`offset`, `limit`) and let the agent ask for more.

# DON'T mix stdio + HTTP transports in one process. APX spawns stdio;
# for HTTP use `url:` in mcps.json instead of `command:`.

# DON'T print to stdout outside JSON-RPC frames. Stray print() corrupts
# the protocol — use stderr for logs. (SDKs handle this; bare `print("debug")`
# in a tool body breaks everything.)
```

## Debugging

```bash
# Smoke test — spawn the server and list its tool catalog
apx mcp tools my-server

# Inspect one tool's schema + copy-paste run example
apx mcp tools my-server search_inventory

# Call it for real
apx mcp run my-server search_inventory '{"query":"shoes"}'

# Spawn errors / stderr tail
apx mcp logs my-server
apx log -f

# Scopes / files / env APX sees
apx mcp check --project acme
```

## Don't

- Don't reinvent SDK framing — bypass only with reason.
- Don't make interactive tools. MCP is one-shot per call; split flows into multiple tools.
- Don't ship without a README — future-you forgets which env vars matter.
- Don't expect APX to retry MCP errors. The agent sees the error and decides.

Attribution

agentprojectcontextagentprojectcontext
View sourceSee grades on GitHubMore from agentprojectcontext →
SSkills DirectorySkills Directory

Ship a skill? Prove it's safe.

Free 120-pattern security scan, letter grade, and an embeddable README badge.

Submit a skill

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments (0)

No comments yet. Be the first to comment!

SSkills DirectorySkills Directory

Ship a skill? Prove it's safe.

Free 120-pattern security scan, letter grade, and an embeddable README badge.

Submit a skill

Related Skills

Caveman

Terse caveman voice: answer first, fluff gone, every technical fact kept. Use for /caveman, "caveman mode", "talk like caveman", "be brief", "less tokens". Stays on until "stop caveman" or "normal mode".

1100021 votes

Hyperplan

Adversarial multi-agent planning skill. Self-orchestrates 5 hostile category members (unspecified-low, unspecified-high, deep, ultrabrain, artistry) via team-mode for ruthless cross-critique debate, distills only the defensible insights, then MANDATORILY hands the distilled insight bundle to the `plan` agent for executable plan formalization. Use when planning needs maximum rigor and surfacing of weak assumptions, blind spots, and over-engineering. Triggers: 'hyperplan', 'hpp', '/hyperplan', ...

698461 votes

Writing Skills

Create and manage Claude Code skills in HASH repository following Anthropic best practices. Use when creating new skills, modifying skill-rules.json, understanding trigger patterns, working with hooks, debugging skill activation, or implementing progressive disclosure. Covers skill structure, YAML frontmatter, trigger types (keywords, intent patterns), UserPromptSubmit hook, and the 500-line rule. Includes validation and debugging with SKILL_DEBUG. Examples include rust-error-stack, cargo-dep...

3931 votes

Mcp Code Execution

Routes multi-tool workflows through MCP servers for large datasets and pipelines. Use when Bash tool overhead is limiting throughput on data-heavy tasks.

3421 votes

catchup

Recovers the conversation and failed tool calls of a previous Codex, Amp, Claude Code, Antigravity, Cline, Copilot CLI, Cursor, DeepSeek Harness, Grok Build, Kimi, OpenCode, Pi Agent, or ZCode session. Use when the user says "catch up", "what did the last session do", "get me up to speed", "I switched agents", asks to recover/summarize a previous session before continuing, or asks to diagnose or report a catchup failure. Do NOT use for the current conversation, git history, or any non-agent log.

741 votes
View all in ai-agents →