Discover Awesome MCP Servers

Extend your agent with 16,885 capabilities via MCP servers.

All16,885
SQLite Database Demo

SQLite Database Demo

Tentu, berikut beberapa contoh untuk membangun server, klien, dan pengujian dalam konteks protokol model. Saya akan memberikan contoh-contoh ini dalam bahasa Inggris, lalu menerjemahkannya ke dalam bahasa Indonesia. **English Examples (with explanations):** Let's assume we have a simple model context protocol (MCP) for a calculator service. This MCP defines how a client requests calculations and how the server responds. **1. Defining the MCP (Conceptual):** * **Request:** * `operation`: String (e.g., "add", "subtract", "multiply", "divide") * `operand1`: Number * `operand2`: Number * **Response:** * `result`: Number * `status`: String (e.g., "success", "error") * `error_message`: String (optional, only present if `status` is "error") **2. Server Implementation (Conceptual - using Python as an example):** ```python import json def handle_request(request_data): try: request = json.loads(request_data) operation = request['operation'] operand1 = request['operand1'] operand2 = request['operand2'] if operation == 'add': result = operand1 + operand2 elif operation == 'subtract': result = operand1 - operand2 elif operation == 'multiply': result = operand1 * operand2 elif operation == 'divide': if operand2 == 0: return json.dumps({'status': 'error', 'error_message': 'Division by zero'}) result = operand1 / operand2 else: return json.dumps({'status': 'error', 'error_message': 'Invalid operation'}) return json.dumps({'status': 'success', 'result': result}) except (KeyError, TypeError) as e: return json.dumps({'status': 'error', 'error_message': str(e)}) # Example usage (simulating receiving a request): request_data = '{"operation": "add", "operand1": 5, "operand2": 3}' response = handle_request(request_data) print(response) # Output: {"status": "success", "result": 8} request_data = '{"operation": "divide", "operand1": 10, "operand2": 0}' response = handle_request(request_data) print(response) # Output: {"status": "error", "error_message": "Division by zero"} ``` **3. Client Implementation (Conceptual - using Python as an example):** ```python import socket import json def send_request(operation, operand1, operand2, server_address=('localhost', 12345)): # Replace with your server address try: sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) sock.connect(server_address) request = json.dumps({'operation': operation, 'operand1': operand1, 'operand2': operand2}) sock.sendall(request.encode('utf-8')) response_data = sock.recv(1024).decode('utf-8') response = json.loads(response_data) return response except Exception as e: return {'status': 'error', 'error_message': str(e)} finally: sock.close() # Example usage: result = send_request('multiply', 4, 6) print(result) result = send_request('divide', 10, 2) print(result) result = send_request('divide', 10, 0) print(result) ``` **4. Testing (Conceptual - using Python's `unittest`):** ```python import unittest import json from your_server_module import handle_request # Replace with your actual server module class TestCalculatorService(unittest.TestCase): def test_addition(self): request_data = '{"operation": "add", "operand1": 5, "operand2": 3}' response = json.loads(handle_request(request_data)) self.assertEqual(response['status'], 'success') self.assertEqual(response['result'], 8) def test_division_by_zero(self): request_data = '{"operation": "divide", "operand1": 10, "operand2": 0}' response = json.loads(handle_request(request_data)) self.assertEqual(response['status'], 'error') self.assertEqual(response['error_message'], 'Division by zero') def test_invalid_operation(self): request_data = '{"operation": "power", "operand1": 2, "operand2": 3}' response = json.loads(handle_request(request_data)) self.assertEqual(response['status'], 'error') self.assertEqual(response['error_message'], 'Invalid operation') if __name__ == '__main__': unittest.main() ``` **Explanation of the Concepts:** * **Model Context Protocol (MCP):** This defines the structure of the messages exchanged between the client and the server. It specifies the fields, data types, and meaning of each part of the message. In our example, we're using JSON to represent the MCP. * **Server:** The server listens for requests from clients, processes them according to the MCP, and sends back a response. * **Client:** The client sends requests to the server according to the MCP and receives responses. * **Testing:** Testing ensures that the server and client correctly implement the MCP and handle different scenarios, including errors. Unit tests are used to test individual components (like the `handle_request` function). **Indonesian Translation:** Mari kita asumsikan kita memiliki protokol konteks model (MCP) sederhana untuk layanan kalkulator. MCP ini mendefinisikan bagaimana klien meminta perhitungan dan bagaimana server merespons. **1. Mendefinisikan MCP (Konseptual):** * **Permintaan:** * `operation`: String (misalnya, "add", "subtract", "multiply", "divide") * `operand1`: Angka * `operand2`: Angka * **Respons:** * `result`: Angka * `status`: String (misalnya, "success", "error") * `error_message`: String (opsional, hanya ada jika `status` adalah "error") **2. Implementasi Server (Konseptual - menggunakan Python sebagai contoh):** ```python import json def handle_request(request_data): try: request = json.loads(request_data) operation = request['operation'] operand1 = request['operand1'] operand2 = request['operand2'] if operation == 'add': result = operand1 + operand2 elif operation == 'subtract': result = operand1 - operand2 elif operation == 'multiply': result = operand1 * operand2 elif operation == 'divide': if operand2 == 0: return json.dumps({'status': 'error', 'error_message': 'Pembagian dengan nol'}) result = operand1 / operand2 else: return json.dumps({'status': 'error', 'error_message': 'Operasi tidak valid'}) return json.dumps({'status': 'success', 'result': result}) except (KeyError, TypeError) as e: return json.dumps({'status': 'error', 'error_message': str(e)}) # Contoh penggunaan (mensimulasikan menerima permintaan): request_data = '{"operation": "add", "operand1": 5, "operand2": 3}' response = handle_request(request_data) print(response) # Output: {"status": "success", "result": 8} request_data = '{"operation": "divide", "operand1": 10, "operand2": 0}' response = handle_request(request_data) print(response) # Output: {"status": "error", "error_message": "Pembagian dengan nol"} ``` **3. Implementasi Klien (Konseptual - menggunakan Python sebagai contoh):** ```python import socket import json def send_request(operation, operand1, operand2, server_address=('localhost', 12345)): # Ganti dengan alamat server Anda try: sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) sock.connect(server_address) request = json.dumps({'operation': operation, 'operand1': operand1, 'operand2': operand2}) sock.sendall(request.encode('utf-8')) response_data = sock.recv(1024).decode('utf-8') response = json.loads(response_data) return response except Exception as e: return {'status': 'error', 'error_message': str(e)} finally: sock.close() # Contoh penggunaan: result = send_request('multiply', 4, 6) print(result) result = send_request('divide', 10, 2) print(result) result = send_request('divide', 10, 0) print(result) ``` **4. Pengujian (Konseptual - menggunakan `unittest` Python):** ```python import unittest import json from your_server_module import handle_request # Ganti dengan modul server Anda yang sebenarnya class TestCalculatorService(unittest.TestCase): def test_addition(self): request_data = '{"operation": "add", "operand1": 5, "operand2": 3}' response = json.loads(handle_request(request_data)) self.assertEqual(response['status'], 'success') self.assertEqual(response['result'], 8) def test_division_by_zero(self): request_data = '{"operation": "divide", "operand1": 10, "operand2": 0}' response = json.loads(handle_request(request_data)) self.assertEqual(response['status'], 'error') self.assertEqual(response['error_message'], 'Pembagian dengan nol') def test_invalid_operation(self): request_data = '{"operation": "power", "operand1": 2, "operand2": 3}' response = json.loads(handle_request(request_data)) self.assertEqual(response['status'], 'error') self.assertEqual(response['error_message'], 'Operasi tidak valid') if __name__ == '__main__': unittest.main() ``` **Penjelasan Konsep:** * **Protokol Konteks Model (MCP):** Ini mendefinisikan struktur pesan yang dipertukarkan antara klien dan server. Ini menentukan bidang, tipe data, dan arti dari setiap bagian pesan. Dalam contoh kita, kita menggunakan JSON untuk merepresentasikan MCP. * **Server:** Server mendengarkan permintaan dari klien, memprosesnya sesuai dengan MCP, dan mengirimkan respons kembali. * **Klien:** Klien mengirimkan permintaan ke server sesuai dengan MCP dan menerima respons. * **Pengujian:** Pengujian memastikan bahwa server dan klien mengimplementasikan MCP dengan benar dan menangani berbagai skenario, termasuk kesalahan. Unit test digunakan untuk menguji komponen individual (seperti fungsi `handle_request`). **Important Notes:** * **Error Handling:** Robust error handling is crucial in real-world applications. The examples above provide basic error handling, but you should add more comprehensive checks and logging. * **Serialization:** JSON is used here for simplicity. Other serialization formats like Protocol Buffers or Apache Thrift can be more efficient for complex data structures. * **Networking:** The client example uses basic sockets. For more complex applications, consider using a framework like Flask (for the server) or a library like `requests` (for the client) to handle networking details. * **Security:** These examples do not include any security measures. In a production environment, you'll need to implement authentication, authorization, and encryption. * **Concurrency:** The server example is single-threaded. For handling multiple clients concurrently, you'll need to use threading, asynchronous programming, or a process-based approach. These examples provide a starting point. You'll need to adapt them to your specific model context and requirements. Let me know if you have any more questions.

Nostr MCP Server

Nostr MCP Server

Cermin dari

MCP Multi-Context Hook Generator

MCP Multi-Context Hook Generator

Automatically generates typed React hooks for Next.js projects by crawling API routes, GraphQL queries, and components. Analyzes pages to suggest optimal render modes (SSR/CSR/ISR) and produces comprehensive documentation with AI-powered guidance.

CoolPC MCP Server

CoolPC MCP Server

A Model Context Protocol server that enables Claude Desktop to query and analyze Taiwan CoolPC computer component prices, helping users generate custom PC quotes through AI assistance.

Web Research Assistant

Web Research Assistant

Comprehensive web research toolkit with 13 tools for searching (via SearXNG), crawling, package discovery, GitHub metrics, error translation, API documentation lookup, data extraction, technology comparison, and service status checking.

Insights Knowledge Base MCP Server

Insights Knowledge Base MCP Server

A free, plug-and-play knowledge base server that provides access to 10,000+ insight reports with secure local data storage.

MCP Docs RAG Server

MCP Docs RAG Server

Sebuah server MCP TypeScript yang memungkinkan kueri dokumen menggunakan LLM dengan konteks dari repositori dan berkas teks yang disimpan secara lokal melalui sistem RAG (Retrieval-Augmented Generation).

espresso-mcp

espresso-mcp

espresso-mcp

🎓 Canvas LMS MCP Server 🎓

🎓 Canvas LMS MCP Server 🎓

Server MCP untuk mengakses Canvas LMS bagi siswa.

FullScope-MCP

FullScope-MCP

A comprehensive Model Context Protocol server for content summarization that supports web scraping, file reading, content summarization, and topic-based summarization features.

Text Editor MCP Server

Text Editor MCP Server

Implementasi sumber terbuka dari alat editor teks bawaan Claude versi: text\_editor\_20241022 (Claude 3.5 Sonnet) text\_editor\_20250124 (Claude 3.7 Sonnet)

MCP Memory

MCP Memory

An MCP server implementing memory solutions for data-rich applications using HippoRAG for efficient knowledge graph capabilities, enabling search across multiple sources including uploaded files.

Serper Google Search Server

Serper Google Search Server

Mengaktifkan integrasi fungsionalitas pencarian Google ke dalam aplikasi yang mendukung MCP (MCP-enabled) menggunakan Serper API, menyediakan hasil pencarian yang kaya, parameter yang dapat dikonfigurasi, dan penanganan respons yang efisien.

Remote MCP Server Authless

Remote MCP Server Authless

A serverless MCP implementation on Cloudflare Workers that doesn't require authentication, allowing you to deploy custom AI tools that can be accessed from Cloudflare AI Playground or Claude Desktop.

mcp-server

mcp-server

MCP-ShellJS

MCP-ShellJS

Server MCP yang aman yang menyediakan akses ShellJS terkontrol untuk LLM, memungkinkan sistem AI untuk mengeksekusi perintah shell dan berinteraksi dengan sistem file secara aman di dalam sandbox keamanan yang dapat dikonfigurasi.

RAG Documentation

RAG Documentation

Implementasi server MCP yang menyediakan alat untuk mengambil dan memproses dokumentasi melalui pencarian vektor, memungkinkan asisten AI untuk memperkaya respons mereka dengan konteks dokumentasi yang relevan.

OCI MCP Server

OCI MCP Server

Enables LLMs like Claude to interact directly with Oracle Cloud Infrastructure resources, supporting dynamic profile switching between tenancies and comprehensive management of compute instances, database systems, and OCI resources through natural language.

MCP Visual Language

MCP Visual Language

Enables intelligent image analysis using GLM-4.5V model, specializing in extracting and analyzing code from screenshots with support for file paths and clipboard input.

Vulpes Spotify MCP Server

Vulpes Spotify MCP Server

Server Protokol Konteks Model yang memungkinkan asisten AI seperti Claude untuk berinteraksi dengan Spotify, memungkinkan mereka untuk mencari lagu, mengontrol pemutaran, dan mengelola daftar putar.

MCPPentestBOT

MCPPentestBOT

Enables AI assistants to perform authorized security testing and penetration testing operations including SSL/TLS analysis, port scanning, vulnerability scanning, and HTTP security header audits through natural language interactions.

Math Calculator MCP Server

Math Calculator MCP Server

Provides basic mathematical operations (addition, subtraction, multiplication, division) through a calculate tool. Supports both stdio and HTTP/SSE transport modes.

Playwright MCP

Playwright MCP

A Model Context Protocol server that provides browser automation capabilities using Playwright, enabling LLMs to interact with web pages through structured accessibility snapshots without requiring screenshots or vision models.

Piwik PRO MCP Server

Piwik PRO MCP Server

Enables AI assistants to manage Piwik PRO Analytics resources including apps, tags, triggers, variables, audiences, and tracker settings through natural language commands. Supports comprehensive analytics configuration and tag management operations.

Tinyman MCP

Tinyman MCP

Enables interaction with Tinyman AMM protocol on Algorand blockchain, supporting pool management, token swaps, liquidity operations, and analytics for both v1.1 and v2 protocols.

MCP Server TypeScript Template

MCP Server TypeScript Template

A demonstration MCP server built in TypeScript that shows how to implement stdio-based communication for integration with MCP clients. Serves as a template for building custom MCP servers with strong typing and maintainability.

MCP: Model Context Protocol

MCP: Model Context Protocol

A system that manages context for language model interactions, allowing the model to remember previous interactions across multiple independent sessions using Gemini API.

MCP Example Express

MCP Example Express

A basic example of developing and running serverless Model Context Protocol (MCP) using Netlify Functions, demonstrating how to deploy and access MCP functionality through customized URLs.

TaskFlow MCP

TaskFlow MCP

A task management Model Context Protocol server that helps break down user requests into manageable tasks with subtasks, dependencies, and notes, while enforcing a structured workflow with user approval steps.

Cortellis MCP Server

Cortellis MCP Server

Memungkinkan pencarian obat dan penjelajahan istilah ontologi dalam database Cortellis, menyediakan akses ke informasi status pengembangan obat yang komprehensif dengan respons JSON terstruktur.