Workflows agênticos — Maestria3 / 8
Build Your First Custom MCP Server
Off-the-shelf servers cover GitHub and Postgres. The high-leverage one is the server only you can write — the bridge to your own system.

The public MCP servers cover the obvious systems. The one that changes your day is the server only you can write: the bridge to your internal API, your deploy tooling, your data warehouse.
The smallest useful server
An MCP server is a process that speaks the protocol over a transport and exposes tools. The minimum: declare a tool, describe its inputs, return a result.
// server.ts — exposes one tool over stdio
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js'
const server = new McpServer({ name: 'ops-tools', version: '1.0.0' })
server.tool('deploy_status', { service: 'string' }, async ({ service }) => {
const res = await fetch(`https://internal.api/status/${service}`)
return { content: [{ type: 'text', text: await res.text() }] }
})
server.connect() // stdio
Connect it:
claude mcp add ops-tools -- node ./server.ts
Design rules that keep it safe
- One tool, one job. A
deploy_statustool beats a vagueopstool. Clear names help the agent pick correctly. - Describe inputs precisely. The schema is the agent's instruction manual — vague schemas cause wrong calls.
- Read before write. Ship read-only tools first; add mutating tools only once you trust the loop, and keep them obviously named.
Returning good output
Tools return text the agent reads. Return structured, concise output (JSON or a tight summary), not a wall of logs. The agent reasons over what you return; noise in means noise out.
With a server of your own, the agent reaches your world. Next we make sure it always behaves in that world — with hooks.
Série — Workflows agênticos — Maestria
- Parte 01A Mentalidade do Fluxo de Trabalho AgenticA maioria dos desenvolvedores trata IA como um autocomplete mais inteligente. Os que saem na frente a tratam como um colega de trabalho que age. Aqui está o modelo mental.
- Parte 02MCP Servers 101 — Dê Ferramentas Reais ao Seu AgentO Model Context Protocol é como seu agent para de adivinhar e começa a consultar seu banco de dados, seus issues, seu navegador. Aqui está o modelo mental e a primeira conexão.
- Parte 03Build Your First Custom MCP Server — você está aquiOff-the-shelf servers cover GitHub and Postgres. The high-leverage one is the server only you can write — the bridge to your own system.
- Parte 04Hooks — Make the Agent Obey Your RulesA prompt asks the model to remember. A hook makes it happen — deterministically, every time, outside the model's control.
- Parte 05Custom Slash Commands as Team WorkflowsA custom slash command is a reusable prompt you commit to the repo — so the whole team runs the same high-quality instruction instead of re-typing it.
- Parte 06Subagentes — Delegando Trabalho que EscalaUm contexto gigante fica lento e vago. Subagentes deixam o agente principal delegar trabalho focado para especialistas com seu próprio contexto e ferramentas — e executá-los em paralelo.
- Parte 07The Daily-Driver Setup — Settings, Permissions, Status LineA diferença entre lutar contra o agent e fluir com ele é vinte minutos de configuração que você faz uma vez. Aqui está o setup.
- Parte 08Multi-Tool Pipelines — Ticket to Reviewed BranchThe payoff: chain MCP, hooks, commands and subagents into one flow that takes a ticket to a reviewed branch — with you in the loop only where it counts.