Skip to content
Back to skills

Mcp Server Development

ASecurity

Build and ship an MCP server: tool design, schemas, transports, auth, errors and testing with real clients

  • 7 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added November 30, 2026
ai-agentsrusttestingapisecurity

Works with

  • cli
  • api
  • mcp

Security analysis

A100/100

Scanned November 30, 2026

npx -y skills add ansh44233/forge --skill mcp-server-development --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Mcp Server Development?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Mcp Server Development
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/ansh44233-mcp-server-development/badge)](https://www.skillsdirectory.com/skills/ansh44233-mcp-server-development)

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

Download with Pro
SKILL.md
---
description: Build and ship an MCP server: tool design, schemas, transports, auth, errors and testing with real clients
profile: standard
tags: mcp, agents, api, ai
---

# MCP server development

Use when building a Model Context Protocol server that agents will call.

## Design the tools
1. Start from the agent's job, not your API surface: a few task-shaped tools (`search_issues`, `create_draft_reply`) beat one tool per endpoint.
2. Name tools as verbs, describe when to use them in one sentence, and document every parameter. The description is the agent's only manual.
3. Keep inputs strict: JSON Schema with enums, formats and bounds. Reject unknown fields.
4. Return compact, structured results with stable ids and the next useful action. Paginate instead of dumping thousands of rows into context.
5. Separate read tools from write tools, and mark destructive ones clearly so clients can ask for approval.

## Transport and auth
- stdio for local tools launched by the client. Never print logs to stdout, since stdout carries the protocol. Log to stderr.
- Streamable HTTP for remote servers. Use OAuth where the client supports it, otherwise a bearer token read from an environment variable. Never take a token in a tool argument.
- Validate the `Origin` header and bind local HTTP servers to 127.0.0.1.

## Errors
Return tool errors as results the agent can act on ("No issue 123 in repo x; did you mean 132?"), not stack traces. Time out slow upstream calls.

## Security
- Treat all upstream content as untrusted: it can contain prompt injection. Do not echo hidden instructions as if they were system text.
- Least privilege: scope tokens to what the tools need, and keep secrets out of results and logs.
- Pin dependencies and publish with a version so clients can pin you (`npx -y your-server@1.2.3`).

## Verify
- Unit-test each tool handler with valid, invalid and boundary inputs.
- Run it with the MCP Inspector and at least one real client (`forge mcp add` or `.mcp.json`) and do the task end to end.
- Run `forge shield` on the client configs you document.

Attribution

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

View all in ai-agents →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.