mcp-server-base
MCP Server Base v2.0 — Skalierung & Betriebsfähigkeit (2026)
Moderner Model Context Protocol-Server auf der Grundlage des neuesten Stacks:
MCP SDK
1.12+—McpServer-High-Level-API +StreamableHTTPServerTransport(neu) &StdioServerTransportTypeScript 5.7 ESM +
NodeNext-ModulZod-Validierung → automatisch JSON-Schema + Env-Validierung (
src/config.ts:1)Express 4 + helmet + CORS-Zulassungsliste + Ratenbegrenzung + Health/Ready + Admin-Oberfläche
Doppelter Transport: STDIO (Claude Desktop) und Streamable HTTP (remote, Spezifikation 2025‑03, zustandslos + zustandsbehaftete Fortsetzbarkeit über RedisEventStore)
Strukturierte Tool-/Ressourcen-/Prompt-Module + RAG (lokal, vektorbasiert), Web (gecacht), GitHub-Integrationen
OTEL-Tracing/Metriken (
src/utils/otel.ts:1), Tasks (experimentell +create_task), k6-LastteststsxWatch,vitest(130 Tests, 91% Abdeckung), Graceful Shutdown,docker-compose(redis, postgres, qdrant)
🚀 Schnellstart
npm install
npm run build
# STDIO (for Claude Desktop, Cursor, opencode, etc.)
npm start
# HTTP (Streamable HTTP - latest)
npm run start:http
# → http://localhost:3000/mcp
# → health http://localhost:3000/healthEntwicklung
npm run dev # stdio watch
npm run dev:http # http watch (Streamable HTTP at http://localhost:3000/mcp)
npm test # unit + e2e (InMemory + HTTP)
npm run test:coverage # coverage 80% thresholds
npm run lint # eslint 9 flat config
npm run format:check # prettier
npm run typecheck # tsc --noEmit
npm run buildCI
.github/workflows/ci.yml läuft bei push/PR auf main mit einer Node‑20+22-Matrix: lint, format:check, typecheck, test:coverage, build, docker build.
Related MCP server: MCP Server
🔌 Transporte
Transport | Verwendung | Befehl |
STDIO | Lokale Clients (Claude Desktop) |
|
Streamable HTTP | Remote / Docker / Cloud |
|
Streamable HTTP ist der neue Standard und ersetzt SSE (seit März 2025 veraltet).
🧰 Werkzeuge (31)
Werkzeug | Beschreibung | Eingabe |
| Echo-Nachricht |
|
| add/sub/mul/div |
|
| Aktuelle Uhrzeit |
|
| URL abrufen |
|
| Dateien unter ALLOWED_ROOT auflisten |
|
| Datei lesen (1-MB-Limit) |
|
| Datei schreiben + Ressourcenänderung auslösen |
|
| Text in Dateien durchsuchen |
|
| KV im Speicher setzen |
|
| KV abrufen |
|
| KV löschen |
|
| Alle KVs auflisten | — |
| Alles löschen | — |
| SQL über alasql (users, notes) |
|
| Tabellen mit Zeilenanzahl auflisten | — |
| Shell (Zulassungsliste, standardmäßig deaktiviert) |
|
| Elicitation-Demo (Kontakt/Präferenzen) |
|
| Sampling-Demo (LLM) |
|
| Text erfassen (in Blöcken, eingebettet) |
|
| Vektorsuche (Kosinus) |
|
| Dokumente auflisten | — |
| Vektorspeicher leeren | — |
| Brave-API (Mock, wenn kein Schlüssel) |
|
| Tavily-API (Mock, wenn kein Schlüssel) |
|
| Web-Abruf mit Zwischenspeicher |
|
| GitHub-Repositories durchsuchen |
|
| GitHub-Repository abrufen |
|
| GitHub-Issue abrufen |
|
| Hintergrund-Task erstellen |
|
| Task-Status abrufen |
|
| Task-Ergebnis abrufen |
|
📦 Ressourcen (6)
config://server-info— Server-Metadaten (JSON, jetzt mitfeatures)greeting://{name}— dynamische Begrüßungsvorlagefile:///{+path}— Datei in der Sandbox (ALLOWED\_ROOT), Liste + Vervollständigen,file:///tmp/debug.txtmemory://{key}— KV im Speicher, Liste + Vervollständigen,memory://notesdb://{table}/{id}— Zeile der Beispiel-DB (users/notes), Liste + Vervollständigendocs://{id}— RAG-Chunk (überrag_ingesterfasst), Liste + Vervollständigen
💬 Prompts (4)
code-review— Argumente:language,codeexplain-concept— Argumente:concept,levelsummle— Argumente:text,length(kurz/mittel/lang),style(Stichpunkte/Absatz/tldr)research— Argumente:topic,depth(Überblick/tief),audience(Anfänger/Fortgeschrittene/Entscheider)
⚙️ Client-Konfiguration
Claude Desktop (claude_desktop_config.json)
{
"mcpServers": {
"mcp-server-base": {
"command": "node",
"args": ["/absolute/path/to/mcp-server/dist/index.js"]
}
}
}HTTP-Client
import { StreamableHTTPClientTransport } from '@modelcontextprotocol/sdk/client/streamableHttp.js';
import { Client } from '@modelcontextprotocol/sdk/client/index.js';
const client = new Client({ name: 'my-client', version: '1.0.0' });
await client.connect(new StreamableHTTPClientTransport(new URL('http://localhost:3000/mcp')));
const tools = await client.listTools();Inspector
npm run inspect
# or
npx @modelcontextprotocol/inspector node dist/index.js
npx @modelcontextprotocol/inspector http://localhost:3000/mcp🐳 Docker
# Single container
docker build -t mcp-server-base .
docker run -p 3000:3000 --env TRANSPORT=http mcp-server-base
# Full stack (app + redis + postgres + qdrant) — see docker-compose.yml
docker compose up -d
docker compose logs -f app
# → http://localhost:3000/health, http://localhost:3000/mcp
# → redis :6379, postgres :5432, qdrant :6333RAG-Demo (Erfassung → Suche → docs://)
# via MCP tools (Inspector or Client)
# 1. ingest
rag_ingest { "text": "MCP is Model Context Protocol...", "id": "mcp-intro" }
# 2. search
rag_search { "query": "what is MCP?", "topK": 3 }
# 3. read resource
# docs://mcp-intro → returns ingested text📁 Projektstruktur
src/
├── index.ts # entry: stdio + http (helmet/cors/rateLimit/auth/resumability)
├── server.ts # createMcpServer() factory
├── config.ts # zod env (AUTH, CORS, rateLimit, RAG, cache, integrations)
├── types.ts # Zod schemas
├── middleware/auth.ts # AUTH_MODE none|apiKey|bearer
├── middleware/rateLimit.ts
├── middleware/requestId.ts
├── utils/logger.ts # stderr, JSON/text, redaction, child(requestId)
├── utils/eventStore.ts # InMemoryEventStore for Last-Event-ID
├── utils/cache.ts # MemoryCache (TTL) + defaultCache
├── utils/queue.ts # SimpleQueue
├── tools/ # 31 tools: echo, fs, memory, db, shell, rag, web, github, elicitation, sampling, tasks
│ ├── filesystem.tool.ts, memory.tool.ts, database.tool.ts, shell.tool.ts
│ ├── rag.tool.ts, web.tool.ts, github.tool.ts, elicitation.tool.ts, sampling.tool.ts, tasks.tool.ts
├── resources/ # 6 resources: config, greeting, file, memory, db, docs
├── routes/admin.ts # Admin UI + metrics + spans
└── prompts/ # 4 prompts: code-review, explain-concept, summarize, researchNeues Werkzeug hinzufügen: src/tools/my.tool.ts erstellen → registerMyTool(server) exportieren → in src/tools/index.ts aufnehmen.
🔐 Sicherheit (Phase 2)
Helmet Header (
x-dns-prefetch-control,x-frame-options,x-content-type-optionsusw.) überhelmet@7(src/index.ts:1)CORS-Zulassungsliste (
CORS_ORIGIN=*oder Komma-Liste) mitcors-Credentials-Handling (src/config.ts:60)Auth
AUTH_MODE=none|apiKey|bearerinsrc/middleware/auth.ts:1—401ohne gültigeX-API-Key-Angabe oderAuthorization: Bearer(health/ready und OPTIONS ausgenommen)Ratenbegrenzung
express-rate-limit(Standard 100/15min) auf/mcp—420 Zu viele Anfragen(src/middleware/rateLimit.ts:1)RequestId (
X-Request-IdrandomUUID, Echo-Header, Korrelation über untergeordneten Logger) (src/middleware/requestId.ts:1)Zod-Env-Validierung (
src/config.ts:1) —parseEnv()validiertPORT,AUTH_MODE,API_KEYfeldübergreifend, mit sofortigem Scheitern bei ungültiger UmgebungStrukturierter Logger JSON/Text,
[REDACTED]fürauthorization,apiKey,token(src/utils/logger.ts:24)Resumability
InMemoryEventStore(src/utils/eventStore.ts:1) + zustandsbehaftete Session-Map, wennRESUMABILITY_ENABLED=true(Replay überID, Zeitvermerk...)Docker-Härtung nicht-Root
appuser+HEALTHCHECK(Dockerfile:1)Tests:
tests/unit/auth.test.ts,tests/unit/logger.test.ts,tests/unit/eventStore.test.ts,tests/e2e/security.test.ts(helmet/auth, Ratenbegrenzung/RateLimit, Fortsetzbarkeit) —67 Tests → 130 gesamt mit Phase 5, 90.89% Abdeckung
🔗 Integrationen (Phase 4)
Cache
MemoryCacheTTL (src/utils/cache.ts:1) —defaultCachefür Web/GitHub,SimpleQueue(src/utils/queue.ts:1)RAG lokale Vektorsuche (Hash-Embedding 128-dim, Kosinus, Chance=500/50) in
src/tools/rag.tool.ts:1—rag_ingest(Chunking +sendResourceListChanged),rag_search(topK, Grenzwert),rag_list,rag_clear+ Ressourcen-docs://{id}Web
src/tools/web.tool.ts:1—brave_search(Mock ohneBRAVE_API_KEY),tavily_search(ohne Key),web_fetch(Cache überdefaultCacheundCACHE_TTL_MS)GitHub
src/tools/github.tool.ts:1—github_search_repos,github_get_repo,github_get_issue(gecacht,GITHUB_TOKENfür Rate-Limits)Stack
docker-compose.yml:1(App + redis:7 + postgresql:16 + qdrant:v1.12.4) inkl. HealthchecksDemo
rag_ingest → rag_search → docs://E2E-verifiziert intests/integrations.test.ts:1(21 Tests)
📈 Skalierung & Betriebsfähigkeit (Phase 5 — v2.0)
Versioniertes MCP
v2.0.0(package.json:1,config.MCP_SERVER_VERSION) mit Handlungsanleitungen je Minor (src/server.ts:1)OTEL Tracing/Metriken (
src/utils/otel.ts:1) —createSpan/withSpan,incrementCounter/recordHistogram,getMetriken/getSpans, JSON-Export-Stub fürOTEL_EXPORTER_OTLP_ENDPOINT,OTEL_ENABLED-FlagRedisEventStore (
src/utils/redisEventStore.ts:1) —EventStore-Implementierung mitstoreEvent/replayEventsAfter, In-Memory-Fallback,eventStoreFactory.create()für horizontale Skalierung (EVENT_STORE_TYPE=memory|redis,REDIS_URL)Admin-UI (
src/routes/admin.ts:1) —GET /admin(HTML-Dashboard),/admin/tools|resources|prompts|metrics|spans|stores|health(JSON), durchADMIN_TOKENgeschützt (X-AdminToken),ADMIN_ENABLED-FlagTasks (
src/tools/tasks.tool.ts:1) — experimentellesdelay_task(falls SDK-Tasks verfügbar) + Fallbackcreate_task/get_task/get_task_result(In-Memory, Polling), InfrastrukturSimpleQueue/MemoryCacheBenchmark
k6/load.js:1—http_req_duration p95<100,stages10→50 VUs,checks >99%,npm run bench/bench:localCompose
docker-compose.yml:1enthält bereits redis/postgres/qdrant für den schnellen SkalenTests:
tests/scale.test.ts:1(OTEL-Spans/Metriken, RedisEventStore-Replay, Cache-TTL, Warteschlange, Admin HTML/metriken/token/ready, Task-Erstellung/Abfrage, Version, k6-Skript) — 130 gesamtDeployment bereit für Fly.io/Cloud Run (zustandslos + RedisEventStore), GHCR per
release.yml, npm2.0.0Logger ist stderr-sicher, protokolliert niemals Secrets (Redaction)
Zod → JSON-Schema über SDK (
src/types.ts)Timeout bei fetch (10s) + strukturierte Fehler
Graceful shutdown auf Räumen (
SIGINT/SIGTERM)Getrennte Gesundheit (
GET /health) und Bereitschaft (GET /ready) außerhalb MCPStandard ist zustandsarm (
sessionIdGenerator: undefined), zustandsbehaftet nur wennRESUMABILITY_ENABLED=true(src/index.ts:22)Typsicher, striktes TS + ESLint flat + Prettier + husky + lint-staged
Abdeckung: 85% Linien / 70% SSH erzwingen (
vitest.config.ts:1), 130 Tests: Unit- und E2E-Systemtest, Sicherheit, Features, Interops, Skalierung
🤝 Mitwirken
Siehe CONTRIBUTING.md — nvm use, npm test, Werkzeug/Ressource/Prompt hinzufügen, lint/typecheck/test erfolgreich. Siehe CODE_OF_CONDUCT.md.
📚 MCP-Dokumentation
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceA Model Context Protocol (MCP) server that supports STDIO, SSE and Streamable HTTP protocols for AI model interactions.131MIT
- AlicenseNot gradedqualityFmaintenanceA robust server implementing the Model Context Protocol with SSE and STDIO transport, enabling real-time communication and extensible tooling for AI models.3813MIT
- AlicenseBqualityCmaintenanceA production-packaged Model Context Protocol server for coding agents that routes large file, git, web, database, and other tasks through token-budgeted tools and workflows.6111MIT
- AlicenseNot gradedqualityCmaintenanceA production-ready Model Context Protocol suite over Streamable HTTP providing a sandboxed file server with tools, resources, prompts, and both manual and AI-driven clients.MIT
Related MCP Connectors
A comprehensive Model Context Protocol (MCP) server that enables AI assistants to interact with yo…
A Model Context Protocol server for Wix AI tools
Personal assistant MCP server with search, execute, packages, jobs, secrets, and integrations.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
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/ahmedalbanna/mcp-server-base'
If you have feedback or need assistance with the MCP directory API, please join our Discord server