# Plan and build an MCP server that connects AI to my service

A tool design and starter code for a Model Context Protocol server that lets AI assistants use your API well.

- Topic: Working with AI
- Framework: Few-Shot
- Level: Advanced
- Tags: Coding, Write, Plan, Fill-in Template, Step-by-step
- Source: https://www.thinkwithprompt.com/prompts/plan-and-build-an-mcp-server-that-connects-ai-to-my-service

## Prompt

```text
Help me design and build an MCP (Model Context Protocol) server so AI assistants can use my service.

**Service or API:** [NAME and what it does]
**API documentation:** [paste endpoints, auth method, rate limits, pagination]
**What users will ask the AI to do:** [3-5 real tasks, e.g. "find overdue invoices for a customer and draft a reminder"]
**Language/SDK:** [Python (FastMCP) / TypeScript (official MCP SDK)]
**Transport:** [local stdio / remote HTTP]
**Read-only or write actions?** [which actions change data]

Step 1: Tool design (before code)
- Design tools around the user tasks, not one tool per endpoint. Combine calls where a task needs several.
- For each tool: name, one-line purpose, input schema with clear parameter descriptions, and what it returns.
- Keep responses concise: return the fields the AI needs, support a short vs. detailed format, and paginate or truncate large results with a clear note.
- Write error messages that tell the AI what to do next (e.g. "No customer found; try search_customers first").
- Mark destructive or write tools clearly and require explicit parameters for them.

Step 2: Code
- A working server skeleton with the tools, input validation, auth read from environment variables (never hard-coded), and rate-limit handling.

Step 3: Test plan
- How to run it with the MCP Inspector, plus 5-10 realistic test questions that require multiple tool calls, with expected results.

Return the tool table first, then the code, then the test plan. Flag any SDK detail you are unsure about as [VERIFY IN SDK DOCS], since the protocol and SDKs change.
```

## What to fill in

- NAME and what it does
- paste endpoints, auth method, rate limits, pagination
- Python (FastMCP) / TypeScript (official MCP SDK)
- local stdio / remote HTTP
- which actions change data
- VERIFY IN SDK DOCS

Free to copy and use. From ThinkWithPrompt (https://www.thinkwithprompt.com/), a library of 2,663 curated AI prompts.
