my-mcp-server
My MCP Server (für Anfänger)
Eigener MCP (Model Context Protocol) Server mit:
Eigenes API-Key- und URL-Modul über die Datei
.envBeispiel-Tools:
echoundcall_my_apiBereit zum Testen mit MCP Inspector
Bereit zur direkten Verwendung in VS Code (GitHub Copilot Chat)
1. Abhängigkeiten installieren
npm installRelated MCP server: mcp-server-demo
2. Datei .env erstellen
Kopiere .env.example zu .env und fülle sie mit deinem API-Key und deiner URL:
Copy-Item .env.example .envInhalt der .env:
MY_API_KEY=api-key-asli-kamu
MY_API_BASE_URL=https://api.contohkamu.com
MCP_SERVER_NAME=my-mcp-server⚠️ Committe die Datei
.envniemals in git. Diese Datei wird automatisch über.gitignoreignoriert.
3. Projekt bauen
npm run buildDieser Befehl kompiliert TypeScript in src/ zu JavaScript in build/.
4. Mit MCP Inspector testen
MCP Inspector ist ein visuelles Tool (Browser), um deine MCP-Tools ohne weiteren Client auszuprobieren.
npm run inspectorDies führt npx @modelcontextprotocol/inspector node build/index.js aus und öffnet den Inspector im Browser. Von dort kannst du:
Klicke auf den Tab Tools
Wähle das Tool
echoodercall_my_apiFülle die Parameter aus, klicke auf Run Tool und sieh dir das Ergebnis an
5. Direkt in VS Code verwenden
Die Datei .vscode/mcp.json ist bereits vorbereitet. Öffne die Command Palette → MCP: List Servers → wähle my-mcp-server → Start Server. Dieser Server liest .env automatisch über envFile.
Projektstruktur
├── .env # rahasia kamu (tidak di-commit)
├── .env.example # contoh isi .env
├── .vscode/mcp.json # konfigurasi MCP untuk VS Code
├── src/
│ ├── config.ts # loader environment variable
│ ├── apiClient.ts # modul pemanggilan API eksternal (pakai API key & URL)
│ └── index.ts # server MCP utama + daftar tool
├── package.json
└── tsconfig.jsonNeues Tool hinzufügen
Füge einen neuen Block server.registerTool("nama_tool", { ... }, async (input) => { ... }) in src/index.ts hinzu und führe dann npm run build erneut aus.
Fehlerbehebung
Fehler „Umgebungsvariable ... nicht ausgefüllt" → stelle sicher, dass
.envvorhanden und ausgefüllt ist.Tool
call_my_apischlägt fehl → prüfe, obMY_API_BASE_URLundMY_API_KEYkorrekt sind und ob der API-Endpunkt den HeaderAuthorization: Bearer <key>unterstützt.Inspector öffnet nicht → stelle sicher, dass zuerst
npm run buildausgeführt wurde.
This server cannot be deployed
Maintenance
Related MCP Connectors
Remote MCP for 1,500+ APIs. Vault-managed credentials; OAuth or API key. Search, load, and execute.
Give any MCP-compatible AI assistant a builder for live, hosted web tools and workflows.
MCP server for secureFlows: token-free URL builders and integration-linting tools for AI agents.
Related MCP Servers
- FlicenseNot gradedqualityDmaintenanceEnables users to expose arbitrary HTTP APIs as configurable MCP tools by defining tool specifications in a JSON configuration file.2,323 npm3-
- FlicenseNot gradedqualityDmaintenanceEnables AI clients to connect to example tools, resources, and prompts over MCP, demonstrating integration with IDEs, chatbots, and agent frameworks.-
- FlicenseNot gradedqualityCmaintenanceEnables MCP clients to search GitHub repositories and users, retrieve weather data and forecasts, and access NASA astronomy and image data through modular MCP tools.-
- AlicenseNot gradedqualityCmaintenanceEnables interaction with Infor systems by exposing verified HTTP/SOAP requests as MCP tools, supporting multiple services, configurable authentication, and extensible request definitions.Apache 2.0