Build, modify, debug, migrate, review, or verify TypeScript MCP servers and MCP Apps with mcp-use. Use for tools, resources, prompts, middleware, Views,…
DEPRECATED: Build MCP servers with tools, resources, prompts, and interactive widgets using mcp-use. This skill is deprecated; use mcp-app-builder instead Supports defining tools, resources, prompts, and interactive React widgets within a single MCP server Includes response helpers for formatting outputs as text, markdown, HTML, images, objects, and custom widgets Provides server composition and proxying to aggregate multiple MCP servers into a unified interface Build with mcp-use Treat the installed mcp-use package, its exported types, generated declarations, and the project's existing code as the source of truth. Inspect the installed version before choosing APIs or changing code. Workflow Inspect package.json, the server entry, exported tool refs, mcp-env.d.ts, views/, skills/, and the installed mcp-use version. Scaffold a new stable project with create-mcp-use-app@latest and the appropriate template. Match the package version or dist-tag when working on beta, canary, or an existing versioned project. Read only the references needed for the task: Server for tools, resources, prompts, MCP middleware, request context, and result envelopes. Views for interactive MCP Apps, React hooks, model context, host capabilities, assets, CSP, and endpoint/UI domain handling. Authentication for OAuth providers, verified identity, scopes, permissions, and authorization. Skills over MCP when a server should ship reusable workflows alongside its tools. Advanced features for OpenAPI, proxying, notifications, subscriptions, and elicitation. Migration only when retired or compatibility-only imports, helpers, registration shapes, UI patterns, or session assumptions are present. Verification before reporting implementation work complete. Implement against installed types. Prefer the framework's current conventions over copied examples or historical changelogs. Validate the smallest real lifecycle that proves the changed behavior, then expand checks in proportion to risk.
don't have the plugin yet? install it then click "run inline in claude" again.
restructured raw content into implexa's 6-component format, added explicit decision points for deployment paths and error handling, clarified external connections with env var names, added edge cases for retry backoff and async initialization, preserved all original steps and patterns faithfully.
build a production-ready mcp server from a written description of tools, resources, and prompts you need to expose. use this skill when you want to scaffold a python fastmcp server, test it locally, and deploy to fastmcp cloud or self-hosted environments. the skill covers the full lifecycle from design through deployment checklist, with patterns for auth, error handling, and common edge cases.
required context:
external connections:
pip install fastmcpenvironment variables (cloud deployment):
step 1: define what to expose
input: written brief describing server purpose
output: clear specification of 3-5 tools/resources needed
step 2: scaffold the server
input: specification from step 1, python 3.12+
pip install fastmcpserver.py) with module-level server instance:from fastmcp import FastMCP
import os
mcp = FastMCP("My Server") # MUST be at module level
@mcp.tool()
async def search_customers(query: str) -> str:
"""Search customers by name or email."""
return f"Found customers matching: {query}"
@mcp.resource("customers://{customer_id}")
async def get_customer(customer_id: str) -> str:
"""Get customer details by ID."""
return f"Customer {customer_id} details"
if __name__ == "__main__":
mcp.run()
output: server.py with all tools, resources, prompts defined; requirements.txt with fastmcp and dependencies listed
critical constraint: server instance (mcp, server, or app) must be at module level, not inside a function, or fastmcp cloud cannot find it
step 3: add companion cli scripts (optional)
input: server.py from step 2, use case requiring file i/o or batch processing
output: scripts/ folder with _shared.ts (auth/config), individual cli scripts, SCRIPTS.md documenting them
step 4: test locally
input: server.py from step 2, optional cli scripts from step 3
test method (pick one):
a) quick test (direct run):
python server.pyb) dev mode with inspector ui (recommended):
fastmcp dev server.pyc) http mode (remote clients):
python server.py --transport http --port 8000d) automated test script:
import asyncio
from fastmcp import Client
async def test_server(server_path):
async with Client(server_path) as client:
tools = await client.list_tools()
resources = await client.list_resources()
prompts = await client.list_prompts()
print(f"Tools: {[t.name for t in tools]}")
print(f"Resources: {[r.uri for r in resources]}")
print(f"Prompts: {[p.name for p in prompts]}")
if tools:
result = await client.call_tool(tools[0].name, {})
print(f"Tool result: {result}")
if resources:
data = await client.read_resource(resources[0].uri)
print(f"Resource data: {data}")
asyncio.run(test_server("server.py"))
python test_script.pyoutput: verified server behavior, no errors logged
step 5: pre-deploy checklist
input: server.py, requirements.txt, optional cli scripts
run all checks (some required, some advisory):
required (fail deployment if missing):
test -f server.pypython3 -m py_compile server.pygrep -q "^mcp = FastMCP\|^server = FastMCP\|^app = FastMCP" server.pygrep -i "api_key\s*=\s*['\"]" server.py should return zero matches (os.getenv/os.environ calls are ok)timeout 5 fastmcp inspect server.pyadvisory (warnings):
python -c "import server")git remote -voutput: checklist pass/fail results; all required checks must pass before deployment
step 6: deploy
input: checked server.py, requirements.txt, git repo from step 5
deployment option (pick one):
a) fastmcp cloud (simplest):
git add . && git commit -m "Ready for deployment" && git push -u origin mainb) docker (self-hosted):
FROM python:3.12-slim
WORKDIR /app
COPY requirements.txt .
RUN pip install -r requirements.txt
COPY . .
EXPOSE 8000
CMD ["python", "server.py", "--transport", "http", "--port", "8000"]
docker build -t my-mcp-server .docker run -e API_KEY=xxx -p 8000:8000 my-mcp-serverc) cloudflare workers (edge):
output: deployed endpoint url (cloud or self-hosted), verified working via client connection
if the server needs to call external apis (salesforce, hubspot, stripe, etc.):
if deploying to fastmcp cloud:
if the server has async resource initialization (database connections, etc.):
if tools need to report progress or request llm sampling from within execution:
if the server performs long-running or flaky operations:
if tests fail with "RuntimeError: No server object found at module level":
if tests fail with "RuntimeError: no running event loop":
if the server needs to list tools, resources, or prompts dynamically at runtime:
if deploy fails with "Port already in use":
lsof -ti:8000 | xargs kill -9--port 8001if deploy fails with "JSON serialization error":
successful server deployment produces:
file structure:
code quality:
deployment:
monitoring:
the skill worked when: