Skip to main content
Glama
projectsofadi

mcp-server-template

mcp-server-template

CI

Opinionated template for building read-only MCP servers that coding agents can actually use well: I/O seams with timeouts, offline tests, compact text outputs, least-privilege docs.

Start here → BUILDING.md — the full workflow from idea to published server (~half a day).

What's inside: a working example server (pypi_project fixed-origin HTTP tool behind a stubbed seam + word_stats pure tool), offline test suite, CI workflow, CLAUDE.md conventions, and a README skeleton below.

The network example deliberately does not accept arbitrary URLs. "Read-only" does not make a URL fetcher safe: unrestricted destinations and followed redirects can expose loopback, private-network, or cloud-metadata services. pypi_project constructs only https://pypi.org/... requests, rejects URL/path-shaped input, never follows redirects, caps the decoded response at 2 MiB, and applies a 15-second whole-operation deadline.

README skeleton for your server (replace this whole file)

  1. # mcp-<name> + one-line value prop in bold

  2. 4-line usage transcript (You: … / Agent: → tool calls / Agent: answer)

  3. Tools table (tool → what it returns)

  4. Install: claude mcp add <name> -- python -m mcp_<name> with any token preloaded into the launching environment from your shell or OS secret manager — never a -e TOKEN=... literal (command arguments can enter shell history and process listings) — plus a .mcp.json block using an env reference ("env": { "TOKEN": "${TOKEN}" })

  5. Token scope / security (least privilege, read-only statement)

  6. Design notes (why read-only, why compact text, why timeouts)

  7. License + contact line

Use the structure above directly; replace every template name and example before publishing a derived server.

Related MCP server: MCP Server Template

Security and privacy

  • The example sends only the supplied package name to PyPI. Do not put secrets or private identifiers in tool arguments.

  • PyPI project summaries are uploader-controlled prose, so the example deliberately omits them from agent-visible output. Treat all external text as untrusted data.

  • Never log credentials, authorization headers, raw private responses, or user prompts.

  • Document which external service receives each argument. Private CI logs and internal URLs are sensitive even when a tool only reads them.

  • Keep arbitrary URL fetching out of derived servers unless you implement a destination allowlist and a transport that cannot be bypassed by redirects or DNS rebinding.

Development

python -m pip install -e ".[dev]"
ruff check . && ruff format --check .
pytest
python -m build

MIT — see LICENSE.

Available Tools

2 tools
pypi_projectA

Look up one PyPI project: returns its current version, Python requirement, and request latency. Use before checking a Python dependency's compatibility. Only the fixed https://pypi.org API is contacted; URLs are rejected. Uploader prose such as the project summary is deliberately omitted.

NameRequiredDescriptionDefault
projectYes

Output Schema

NameRequiredDescription
resultYes

TDQS

A4.1/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description carries the full burden and does disclose non-obvious behavior: only the fixed https://pypi.org API is contacted, arbitrary URLs are rejected, and uploader prose is omitted (so the agent should not expect a summary field). It stops short of stating rate limits or auth requirements, but the security/scope posture is well covered.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Four short sentences, front-loaded with the operation and its outputs before the usage hint and constraints. Nothing is redundant, though the 'request latency' return detail is slightly peripheral to the tool's purpose.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

An output schema exists, so return values need not be spelled out, yet the description still names the key fields. Combined with the security constraints and usage framing, an agent has enough to call this correctly; only parameter format guidance is missing.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 0% and the single 'project' string parameter has no description, so the description must compensate. It partially does by implying a PyPI project identifier and explicitly stating that URLs are rejected, which steers the agent away from passing a URL, but it never states the expected name format or normalization.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

States a specific verb and resource ('Look up one PyPI project') and immediately enumerates the core return fields (current version, Python requirement, request latency). The scope word 'one' distinguishes it from any bulk lookup, and the sibling word_stats is clearly unrelated.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Gives a concrete usage context: 'Use before checking a Python dependency's compatibility.' There are no real alternatives to weigh (the only sibling is word_stats), so the absence of explicit exclusions costs little, but there is no guidance on failure/no-match handling.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

word_statsB

Word count plus the most frequent words of a text. Example of a pure, no-I/O tool: instant, deterministic, safe.

NameRequiredDescriptionDefault
topNo
textYes

Output Schema

NameRequiredDescription
resultYes

TDQS

B3/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden. It does disclose real behavioral traits - pure, no I/O, instant, deterministic, safe - which is useful. However, it omits edge-case behavior (empty input, tokenization/case rules) and any note on how results are ordered or bounded.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Two short sentences, front-loaded with the core capability. The second sentence earns partial credit by conveying the no-I/O/deterministic profile, though it reads as documentation boilerplate rather than agent-facing guidance.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

An output schema exists, so return formatting need not be described. But with 0% parameter coverage and no annotations, the description leaves the 'top' parameter and input expectations entirely undocumented - the agent must guess from the schema defaults alone.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters2/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0% and neither parameter is named in the description. 'Most frequent words' implicitly suggests a top-N limit but never states that the 'top' parameter controls it, its default of 5, or what 'text' must look like.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description names a specific verb+resource: word count plus most-frequent-word extraction from a text. It is unambiguous what the tool computes. It does not differentiate from siblings, but the only sibling (pypi_project) is unrelated, so no meaningful confusion exists.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description offers no when-to-use guidance, no alternatives, and no conditions or exclusions. 'Example of a pure, no-I/O tool' is meta-commentary about the tool's character, not routing guidance for an agent choosing between tools.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

  1. 2 tool updatesv0.1.0
    • First observedpypi_project
    • First observedword_stats

TDQS

A3.5/5.0

Scored across 2 tools

Disambiguation5/5

The two tools target completely different domains (PyPI project lookup vs. text word statistics) with no overlap in function or purpose. An agent can easily select the correct tool without confusion.

Naming Consistency5/5

Both tool names use consistent snake_case noun phrases (pypi_project, word_stats), adhering to a predictable naming pattern. Although not verb_noun, the convention is applied uniformly across the set.

Tool Count3/5

Two tools is very thin for a functional MCP server and falls into the borderline '1-2 tools feels thin' category. However, as a template server, the small count may be intentional to demonstrate different tool types.

Completeness2/5

There is no coherent domain or lifecycle; the tools are isolated utilities with no way to list, search, update, or otherwise extend the surface. This leaves significant gaps for any real workflow an agent might attempt.

Maintenance

ActivityStale
ResponsivenessNo issues

Related MCP Connectors

Related MCP Servers

  • A
    license
    Not graded
    quality
    D
    maintenance
    A production-ready Python template for building MCP servers with enterprise features including registry integration, configuration management, structured logging, and extensible patterns for tools, resources, and prompts.
    MIT
  • A
    license
    A
    quality
    Not graded
    maintenance
    A production-ready TypeScript template for building MCP servers with dual transport support (stdio/HTTP), OAuth 2.1 foundations, SQLite caching, observability, and security features including PII sanitization and rate limiting.
    4
    13 npm
    -
  • A
    license
    Not graded
    quality
    D
    maintenance
    A production-ready MCP server scaffold that features built-in authentication, Docker support, and a comprehensive CI/CD release pipeline. It provides a standardized template for deploying servers with multi-transport support and configurable read-only modes.
    MIT