算法艺术创作
algorithmic-art
通过代码和可调参数创作生成艺术与交互式视觉效果。
mcp-server-building【设计与创意】Design, implement, harden, and verify Model Context Protocol (MCP) servers with precise tool contracts, least-privilege authorization, safe transports, structured errors, and interoperability tests. Use when creating a new MCP server, exposing an API or data source through MCP, reviewing an MCP server design, adding or revising MCP tools, or preparin…
独立 GitHub 快照 · 自动分类 · 以原作者文档为准
Build the smallest server that exposes the required capability safely. Treat protocol conformance, business authorization, and model behavior as separate concerns; all three need independent controls.
Collect or infer, and label assumptions for, these inputs:
stdio or remote HTTP transport requirementsAsk only for missing facts that materially change the architecture. Consult the current MCP specification and SDK documentation before relying on version-sensitive behavior.
Deliver:
Use assets/server-design-template.md when a design artifact is useful. Use scripts/validate_tool_manifest.py to lint a JSON tool manifest before implementation or review.
Translate the user job into a narrow set of resources, prompts, and tools. Prefer one clear operation per tool. Exclude administrative or broad pass-through operations unless the use case requires them.
Identify every effect; a tool can have more than one. Record reads, creates, updates, deletes, execution, external communication, financial transactions, access changes, and network egress separately. Classify every data flow, including public, internal, confidential, restricted, personal, financial, health, and credential data. Do not compress this inventory into a single "read" or "write" label.
Draw the path from MCP host to server to downstream service. State which component authenticates the actor, which authorizes the operation, where credentials live, and which data is untrusted.
Do not rely on the model, the tool description, or a client-side confirmation as the sole authorization control. Enforce object-, tenant-, and action-level authorization at the server or downstream service.
outputSchema and return matching structuredContent; do not substitute a prose description of the result shape.Read references/server-design-checklist.md for contract, transport, and test details.
Use an official or well-maintained SDK compatible with the selected protocol revision. For new work, verify the current stable revision before coding; as of 2026-08-09 it is 2026-07-28. That revision is stateless at the protocol layer: implement server/discover, carry version/client capabilities in per-request _meta, include required routing headers for Streamable HTTP, and do not introduce initialize, notifications/initialized, or Mcp-Session-Id. Support a legacy handshake only on an explicitly tested older-revision compatibility path.
Return the required resultType on every result. Implement input_required plus retry-bound inputResponses/requestState for Multi Round-Trip Requests when mid-call input is needed. Return deterministic, cacheable listings with revision-required cache metadata.
Apply deadlines, bounded concurrency, safe retries with jitter, connection cleanup, and structured logging. Emit correlation IDs and outcome metadata without logging tokens, secrets, full prompts, or sensitive records.
Declare an authorization mode for every tool, including an explicit public mode for genuinely unauthenticated tools. For local stdio, source credentials from an approved environment or secret store; never embed them in arguments, source, or logs. For remote HTTP, follow the current MCP authorization specification, HTTPS requirements, exact redirect and issuer validation, token audience validation, short-lived credentials, and least-privilege scopes.
Never pass an MCP client token unchanged to an upstream API. Obtain a separate downstream token with the correct audience. Bind approvals to the exact action and parameters for consequential tools.
Run all of the following that apply:
validate_tool_manifest.py; treat warnings as review prompts and never present a passing lint as protocol conformance or safety certification2026-07-28: server/discover, per-request protocol/client metadata, required Streamable HTTP header/body agreement, listing, invocation, resultType, cancellation, and unsupported-version handling with a compatible clientttlMs and cacheScope on cacheable list/read results, and input_required retry behavior when MRTR is usedReport observed evidence. Do not claim compatibility with clients or protocol versions that were not exercised.
Release behind a feature flag or allowlist when possible. Define health checks, latency/error metrics, audit events, and alert thresholds. Preserve a last-known-good configuration and reversible migration path.
If unsafe behavior appears, disable the affected tool, stop the server if necessary, revoke or rotate credentials, preserve redacted evidence, restore the previous version, and retest before re-enabling access.
Expose inventory-search-items and inventory-get-stock for a support agent. Restrict store IDs to the actor's assigned region, cap search results, redact supplier costs, and verify that a wrong-region object returns a generic forbidden error. Deliver a manifest, implementation, inspector transcript, and negative authorization tests.
Expose support-draft-ticket-update separately from support-apply-ticket-update. Make the apply tool require a short-lived approval bound to ticket ID, proposed patch hash, and actor. Add idempotency handling, an audit event, a timeout test, and a rollback path for the deployment.
Finish only when names and structural schemas match implementation, all effect and data classes are explicit, every tool declares an authorization mode, every consequential effect has a deterministic authority check, current-revision and any legacy paths have been exercised separately, evidence is recorded, and unverified assumptions plus residual risks are explicit.