Skip to main content
Glama
Ricoledan

mcp-onprem-starter

by Ricoledan

mcp-onprem-starter

A starter template for building single-client MCP servers that expose an existing REST API through MCP. The primary deployment profile runs as a stdio subprocess in a customer-controlled environment, including private cloud, data-center, and air-gapped infrastructure.

Architecture

MCP client / agent
        │
        │ stdio
        ▼
MCP server
  ├── tool handlers
  ├── write authorization
  ├── typed errors
  └── HTTP client
        │
        ▼
Configured upstream API

Development note: When UPSTREAM_BASE_URL is unset, the server uses the bundled mock upstream so the request path can run locally without an external API.

Related MCP server: mcp-server-template

Quick start

npm install
npm run dev

For a reproducible development environment, use the optional Nix flake:

nix develop
npm ci
just verify

The development shell provides Node.js, just, and the Docker CLI. Nix is a developer-environment option; the server's runtime and package installation remain based on Node.js and npm.

This starts the server over stdio with a bundled mock upstream and the development defaults. Point an MCP client (Claude Code, an agent runtime, or the SDK's own test client) at it and call list_records or create_record.

Template note: list_records, create_record, and the bundled mock are illustrative examples. Replace them with tools and upstream mappings derived from the operator's business request.

To verify the whole deployable chain — build, container boot, a real protocol round trip, and a rollback drill — run:

just verify

Docker is the default container runtime. Podman is also supported:

CONTAINER=podman just verify

What's included

Path

What

src/index.ts

Entry point. buildServer(deps) is exported separately from main() so tests can construct a server independently of stdio and environment loading.

src/config.ts

Zod-validated config. Structural settings are validated at startup with the variable named; capability settings (secrets) isolate the tool that requires them.

src/errors.ts

A closed error-code taxonomy, one error class, and the four rules that keep it from drifting (see the file's header comment).

src/logger.ts

stderr-only structured logging with automatic secret redaction and a separate audit stream for writes.

src/http/client.ts

REST client with host-named timeout errors, a single guarded re-auth retry, normalized failure surfaces, retryable reads, and explicit write-outcome handling.

src/tools/

The tool-module shape (name, title, description, annotations, inputSchema, handler), plus one read and one write example.

src/mock/server.ts

A tiny in-memory upstream so the template runs with zero configuration.

DEPLOYMENT.md

The three current distribution paths, configuration reference, operational notes, and coverage roadmap.

docs/scaling.md

The separate shared HTTP deployment profile and its requirements.

docs/roadmap.md

Everything else considered and deferred, with the trigger for building each.

Implementing an operator request

Agents implementing a business request should first identify the required workflows, upstream API contract, tool behavior, security requirements, and acceptance criteria. See AGENTS.md for the complete implementation workflow and repository rules.

Adapting this template

Use this sequence to build the business-specific server:

  1. Understand the structure. Read src/index.ts, src/config.ts, src/http/client.ts, src/tools/shared.ts, and src/errors.ts.

  2. Define the upstream contract. Identify the API base URL, authentication method, endpoints, request and response schemas, and error behavior.

  3. Design the MCP tools. Map business operations to tools with clear names, descriptions, input schemas, annotations, and result shapes.

  4. Implement the tool handlers. Add one module per tool under src/tools/, use the shared HTTP client, apply checkWriteGate() to writes, and register each tool in src/tools/index.ts.

  5. Add configuration. Extend ConfigSchema for required URLs, credentials, timeouts, or capability settings. Keep environment access inside src/config.ts.

  6. Add tests. Cover tool inputs, upstream responses, error mapping, write authorization, and the MCP initialize/tool-listing round trip.

  7. Verify the deployment. Run npm run ci, then just verify for the container, non-root boot, stdio, and rollback checks.

Template cleanup

After the business tools are implemented:

  • Replace src/tools/_example-read.ts and src/tools/_example-write.ts.

  • Update the bundled mock and its tests to represent the business domain, or retain them as a local contract-test harness.

  • Remove placeholder endpoint definitions and example terminology.

  • Update .env.example, README.md, and DEPLOYMENT.md.

  • Keep the shared configuration, HTTP client, error taxonomy, write gate, logging, and verification structure when they still match the deployment.

Design principles

  • stdio by default. The server exposes the MCP connection through stdio. The agent runtime spawns this as a child process inside its own trust boundary.

  • Validate at startup, isolate optional capabilities. A malformed required setting stops startup with the variable name in the message. A missing optional credential disables just the tool that needs it — the server still starts, and the disabled tool stays listed rather than silently vanishing.

  • Writes require deliberate authorization. A write tool needs both an environment- level flag and a per-call confirmation, and the underlying HTTP client surfaces an ambiguous write outcome for operator review rather than retrying automatically.

  • Every error is actionable. Error details are sanitized before they reach the caller, and every error names what to do next.

  • Patterns have production provenance. Every pattern in this template is ported from a pattern already shipped in a working server — see the doc comments for provenance.

License

MIT.

Available Tools

2 tools
create_recordCreate a recordA
Destructive

Create a new record in the upstream system. Defaults to a dry run: confirm=true is required to execute, while the default returns a preview of the exact payload that would be sent. Set confirm=true to execute — this also requires the deployment to have ALLOW_WRITES enabled, independent of this flag.

ParametersJSON Schema
NameRequiredDescriptionDefault
nameYesName for the new record.
reasonYesWhy this record is being created — required so the audit log carries intent, not just the payload.
confirmNoSet true to execute. Default false returns a dry-run preview only.

TDQS

A4.6/5.0
Behavior5/5

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

Discloses critical behaviors beyond annotations: dry-run default, the need for confirm=true, and the ALLOW_WRITES deployment flag. This adds substantial context that annotations (readOnlyHint false, destructiveHint true) do not fully cover.

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

Conciseness5/5

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

Two sentences, no fluff, front-loaded with purpose then key behavioral caveats. Every sentence earns its place.

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?

Covers the essential invocation behavior (dry-run, confirm, ALLOW_WRITES) and gives a hint about return ('preview of exact payload'). It lacks details on error responses or execute-mode return, but is sufficient for a simple create tool with no output schema.

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

Parameters4/5

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

Schema covers 100% of parameters with descriptions, but the description adds the crucial ALLOW_WRITES dependency and reinforces confirm flag semantics, going slightly beyond the schema.

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?

The description clearly states 'Create a new record in the upstream system', using a specific verb and resource. It distinguishes from the sibling 'list_records' by its create action and mentions the upstream system.

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?

Provides clear usage context: creation requires confirm=true to execute, defaults to dry-run, and requires ALLOW_WRITES enabled. However, it does not explicitly mention using the sibling tool for reading, so it's not a full 5.

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

list_recordsList recordsA
Read-onlyIdempotent

List records from the upstream system, optionally filtered by a search query. Returns a bounded page of results with a total-matched count and a truncated flag — call again with a narrower query if truncated is true rather than assuming this is the full set. Use get_record to fetch one record in full.

ParametersJSON Schema
NameRequiredDescriptionDefault
limitNoMax records to return. Hard cap 100.
queryNoFree-text filter. Omit to list all records (subject to the limit).

TDQS

A4.7/5.0
Behavior5/5

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

Annotations already declare readOnlyHint, openWorldHint, idempotentHint, and destructiveHint=false, so the safety profile is clear. The description adds significant behavioral context beyond annotations: the result is a 'bounded page' with a total-matched count and a truncated flag, explaining how to interpret and act on truncation, which is valuable for using the tool correctly.

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

Conciseness5/5

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

The description is concise and well-structured: a single sentence stating purpose, followed by a sentence covering paging behavior and an alternative tool. Every word earns its place, with no redundant or filler content.

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

Completeness5/5

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

Given the tool's complexity (pagination, filtering, total count, truncation) and the lack of an output schema, the description explains the return shape and expected behavior thoroughly. It also provides a pointer to get_record for full details, making the description functionally complete for an agent.

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 100% with descriptions for both limit and query, so the schema carries the parameter semantics. The description adds minimal extra parameter meaning—it mentions 'optionally filtered by a search query' and 'bounded page' which aligns with existing schema fields but doesn't provide new details beyond what's already documented.

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?

The description clearly states the tool's function: 'List records from the upstream system, optionally filtered by a search query.' It distinguishes from the sibling tool create_record by focusing on read-only listing, and also contrasts with get_record for fetching a single record.

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

Usage Guidelines5/5

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

Provides explicit guidance on when to use this tool vs. alternatives: 'Use get_record to fetch one record in full.' Also gives actionable advice on handling truncation ('call again with a narrower query if truncated is true') and clarifies the meaning of the truncated flag.

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. Dates show when Glama detected each change.

  1. 2 tool updatesv0.1.0
    • First observedcreate_record
    • First observedlist_records

TDQS

A4.4/5.0
Disambiguation5/5

The two tools have clearly distinct purposes: list_records for querying/searching with pagination, and create_record for inserting new records. No overlap or ambiguity exists.

Naming Consistency5/5

Both tools follow a consistent verb_noun pattern (list_records, create_record), making the API predictable and easy to navigate.

Tool Count3/5

At 2 tools, the set is on the thin side, but for a 'starter' server it could be intentionally minimal. However, the reference to get_record suggests at least one more expected tool.

Completeness2/5

The set is missing get_record, update_record, and delete_record. list_records explicitly instructs agents to use get_record, but that tool does not exist, creating a clear dead end and significant coverage gap.

Maintenance

ActivityMaintained
ResponsivenessNo issues

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Connectors

Related MCP Servers

  • F
    license
    Not graded
    quality
    D
    maintenance
    A starter template for building MCP servers in Python using the streamable HTTP transport protocol. Provides a foundation with the MCP Python SDK and example configuration to quickly develop custom MCP servers.
    2
    -
  • A
    license
    Not graded
    quality
    D
    maintenance
    A production-ready FastMCP server template supporting local development with stdio and secure web deployment with HTTPS and OAuth.
    4
    MIT
  • F
    license
    B
    quality
    B
    maintenance
    A starter template for building an MCP server with Vault-based secret management and Postgres-backed configuration, featuring tool-level authorization and redacted output.
    11
    -
  • -
    license
    Not graded
    quality
    Not graded
    maintenance
    A corporate MCP server template in Python, built with FastMCP for stateless, scalable deployment behind a load balancer with health/readiness endpoints and JSON structured logging.
    -

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/Ricoledan/mcp-onprem-starter'

If you have feedback or need assistance with the MCP directory API, please join our Discord server