Discover Awesome MCP Servers

Extend your agent with 84,516 capabilities via MCP servers.

All84,516
Maccam912_searxng Mcp Server

Maccam912_searxng Mcp Server

Mirror of

mcp-server-iris: An InterSystems IRIS MCP server

mcp-server-iris: An InterSystems IRIS MCP server

Okay, here's a breakdown of how to execute SQL queries and perform monitoring/manipulations with Interoperability in InterSystems IRIS, along with code examples and explanations: **1. Executing SQL Queries in InterSystems IRIS** InterSystems IRIS offers several ways to execute SQL queries: * **Using the Management Portal:** This is the most common and user-friendly method for ad-hoc queries and exploration. * **Using the SQL Shell:** A command-line interface for executing SQL statements. * **Embedded SQL (ObjectScript):** Integrating SQL directly within your ObjectScript code. * **JDBC/ODBC:** Connecting to IRIS from external applications using standard database connectivity protocols. **1.1. Using the Management Portal** 1. **Access the Management Portal:** Open your web browser and navigate to the IRIS Management Portal (usually `http://localhost:52772/csp/sys/UtilHome.csp` or a similar address, depending on your IRIS installation). Log in with appropriate credentials (e.g., `_SYSTEM` and the password you set during installation). 2. **Navigate to SQL Shell:** In the Management Portal, go to **System Explorer > SQL Shell**. 3. **Select Namespace:** Choose the namespace where your data resides (e.g., `USER`, `SAMPLES`). 4. **Enter and Execute SQL:** Type your SQL query in the text area and click the "Execute" button. The results will be displayed in a table below. ```sql SELECT TOP 10 Name, Age, Home_State FROM Sample.Person ORDER BY Age DESC ``` **1.2. Using the SQL Shell (Command Line)** 1. **Open a Terminal:** Open a terminal or command prompt on your system. 2. **Access the IRIS Instance:** Use the `iris` command to connect to your IRIS instance. You might need to set environment variables (like `IRISUSERNAME`, `IRISPASSWORD`, `IRISNAMESPACE`, `IRISHOST`, `IRISPORT`) or use command-line arguments. Refer to the InterSystems IRIS documentation for the correct syntax for your environment. ```bash iris session USER # Connect to the USER namespace ``` 3. **Enter SQL Statements:** Once connected, you can directly enter SQL statements. Terminate each statement with a semicolon (`;`). ```sql SELECT TOP 5 Name, Age FROM Sample.Person; ``` 4. **Exit the SQL Shell:** Type `halt` to exit the SQL shell and return to the operating system prompt. **1.3. Embedded SQL (ObjectScript)** This is the most powerful way to integrate SQL into your applications. ```objectscript ClassMethod ExecuteSQL() As %Status { Set sqlCode = "SELECT Name, Age FROM Sample.Person WHERE Age > :age" Set age = 30 Set tStatement = ##class(%SQL.Statement).%New() Set status = tStatement.%Prepare(sqlCode) If $$$ISERR(status) { Quit status } Set result = tStatement.%Execute(age) If $$$ISERR(result.%SQLCODE) { Write "SQL Error: ", result.%SQLCODE, " - ", result.%Message,! Quit $$$ERROR($$$GeneralError, "SQL Execution Failed") } While result.%Next() { Set name = result.%Get("Name") Set age = result.%Get("Age") Write "Name: ", name, ", Age: ", age,! } Quit $$$OK } ``` **Explanation:** * `##class(%SQL.Statement).%New()`: Creates a new SQL statement object. * `tStatement.%Prepare(sqlCode)`: Prepares the SQL statement for execution. This is important for performance, especially if you're executing the same query multiple times with different parameters. * `tStatement.%Execute(age)`: Executes the prepared statement, passing in the `age` variable as a parameter. The colon (`:age`) in the SQL code indicates a parameter placeholder. * `result.%Next()`: Iterates through the result set, moving to the next row. * `result.%Get("Name")` and `result.%Get("Age")`: Retrieves the values of the "Name" and "Age" columns for the current row. * Error Handling: The code includes error checking using `$$$ISERR` and `result.%SQLCODE` to handle potential SQL errors. **1.4. JDBC/ODBC** You can connect to InterSystems IRIS from Java, Python, or other languages using JDBC or ODBC drivers. The specific code will depend on the language and the JDBC/ODBC library you're using. Refer to the InterSystems documentation for JDBC and ODBC connectivity. **2. Monitoring and Manipulating Interoperability** Interoperability in InterSystems IRIS allows you to connect and exchange data with external systems. Monitoring and manipulation are crucial for ensuring smooth integration. **2.1. Monitoring Interoperability Productions** * **Production Monitor:** The primary tool for monitoring interoperability productions. You can access it from the Management Portal: **Interoperability > List Productions**. Select a production to view its status, message counts, errors, and other key metrics. * **Message Viewer:** Allows you to examine individual messages that have passed through the production. You can view the message content, headers, and processing history. Access it from the Production Monitor by clicking on a message count or error count. * **System Monitor:** Provides overall system health information, including CPU usage, memory usage, and disk space. This can help you identify resource bottlenecks that might be affecting your interoperability productions. * **Logs:** InterSystems IRIS logs detailed information about production activity, errors, and warnings. You can view the logs from the Management Portal: **System Explorer > Logs**. Configure logging levels to control the amount of information that is recorded. **2.2. Manipulating Interoperability Productions** * **Starting and Stopping Productions:** You can start and stop productions from the Production Monitor. This is useful for maintenance, upgrades, or troubleshooting. * **Enabling and Disabling Components:** You can enable or disable individual components (e.g., business processes, business operations, business services) within a production. This allows you to isolate problems or temporarily remove a component from the flow. * **Resubmitting Messages:** If a message fails to process correctly, you can resubmit it from the Message Viewer. This is useful for recovering from errors or retrying failed operations. * **Debugging:** InterSystems IRIS provides debugging tools for tracing the execution of business processes and other components. This can help you identify the root cause of errors. * **Programmatic Control:** You can use ObjectScript code to programmatically control interoperability productions. This allows you to automate tasks such as starting and stopping productions, enabling and disabling components, and resubmitting messages. **2.3. Code Examples (ObjectScript)** ```objectscript // Start a production Set status = ##class(Ens.Director).StartProduction("MyProduction") If $$$ISERR(status) { Write "Error starting production: ", $System.Status.GetErrorText(status),! } // Stop a production Set status = ##class(Ens.Director).StopProduction("MyProduction") If $$$ISERR(status) { Write "Error stopping production: ", $System.Status.GetErrorText(status),! } // Get the status of a production Set status = ##class(Ens.Director).GetProductionStatus("MyProduction", .prodStatus) If $$$ISERR(status) { Write "Error getting production status: ", $System.Status.GetErrorText(status),! } Else { Write "Production Status: ", prodStatus,! } // Resubmit a message (requires the message ID) Set status = ##class(Ens.Director).ResubmitMessage(messageId) If $$$ISERR(status) { Write "Error resubmitting message: ", $System.Status.GetErrorText(status),! } ``` **Important Considerations:** * **Security:** Always use strong passwords and appropriate security measures to protect your InterSystems IRIS instance and your data. * **Error Handling:** Implement robust error handling in your ObjectScript code to catch and handle potential errors. * **Logging:** Configure logging to capture important information about your interoperability productions. * **Performance:** Optimize your SQL queries and your interoperability configurations for performance. * **Documentation:** Refer to the InterSystems IRIS documentation for detailed information about SQL, interoperability, and other features. **Indonesian Translation:** **Melakukan Query SQL pada InterSystems IRIS** Lakukan beberapa pemantauan dan manipulasi dengan Interoperabilitas Berikut adalah uraian tentang cara menjalankan query SQL dan melakukan pemantauan/manipulasi dengan Interoperabilitas di InterSystems IRIS, beserta contoh kode dan penjelasannya: **1. Menjalankan Query SQL di InterSystems IRIS** InterSystems IRIS menawarkan beberapa cara untuk menjalankan query SQL: * **Menggunakan Management Portal:** Ini adalah metode yang paling umum dan mudah digunakan untuk query ad-hoc dan eksplorasi. * **Menggunakan SQL Shell:** Antarmuka baris perintah untuk menjalankan pernyataan SQL. * **Embedded SQL (ObjectScript):** Mengintegrasikan SQL langsung ke dalam kode ObjectScript Anda. * **JDBC/ODBC:** Menghubungkan ke IRIS dari aplikasi eksternal menggunakan protokol konektivitas database standar. **1.1. Menggunakan Management Portal** 1. **Akses Management Portal:** Buka browser web Anda dan navigasikan ke IRIS Management Portal (biasanya `http://localhost:52772/csp/sys/UtilHome.csp` atau alamat serupa, tergantung pada instalasi IRIS Anda). Masuk dengan kredensial yang sesuai (misalnya, `_SYSTEM` dan kata sandi yang Anda tetapkan selama instalasi). 2. **Navigasi ke SQL Shell:** Di Management Portal, buka **System Explorer > SQL Shell**. 3. **Pilih Namespace:** Pilih namespace tempat data Anda berada (misalnya, `USER`, `SAMPLES`). 4. **Masukkan dan Jalankan SQL:** Ketik query SQL Anda di area teks dan klik tombol "Execute". Hasilnya akan ditampilkan dalam tabel di bawah. ```sql SELECT TOP 10 Name, Age, Home_State FROM Sample.Person ORDER BY Age DESC ``` **1.2. Menggunakan SQL Shell (Baris Perintah)** 1. **Buka Terminal:** Buka terminal atau command prompt di sistem Anda. 2. **Akses Instance IRIS:** Gunakan perintah `iris` untuk terhubung ke instance IRIS Anda. Anda mungkin perlu mengatur variabel lingkungan (seperti `IRISUSERNAME`, `IRISPASSWORD`, `IRISNAMESPACE`, `IRISHOST`, `IRISPORT`) atau menggunakan argumen baris perintah. Lihat dokumentasi InterSystems IRIS untuk sintaks yang benar untuk lingkungan Anda. ```bash iris session USER # Terhubung ke namespace USER ``` 3. **Masukkan Pernyataan SQL:** Setelah terhubung, Anda dapat langsung memasukkan pernyataan SQL. Akhiri setiap pernyataan dengan titik koma (`;`). ```sql SELECT TOP 5 Name, Age FROM Sample.Person; ``` 4. **Keluar dari SQL Shell:** Ketik `halt` untuk keluar dari SQL shell dan kembali ke prompt sistem operasi. **1.3. Embedded SQL (ObjectScript)** Ini adalah cara paling ampuh untuk mengintegrasikan SQL ke dalam aplikasi Anda. ```objectscript ClassMethod ExecuteSQL() As %Status { Set sqlCode = "SELECT Name, Age FROM Sample.Person WHERE Age > :age" Set age = 30 Set tStatement = ##class(%SQL.Statement).%New() Set status = tStatement.%Prepare(sqlCode) If $$$ISERR(status) { Quit status } Set result = tStatement.%Execute(age) If $$$ISERR(result.%SQLCODE) { Write "SQL Error: ", result.%SQLCODE, " - ", result.%Message,! Quit $$$ERROR($$$GeneralError, "SQL Execution Failed") } While result.%Next() { Set name = result.%Get("Name") Set age = result.%Get("Age") Write "Name: ", name, ", Age: ", age,! } Quit $$$OK } ``` **Penjelasan:** * `##class(%SQL.Statement).%New()`: Membuat objek pernyataan SQL baru. * `tStatement.%Prepare(sqlCode)`: Menyiapkan pernyataan SQL untuk dieksekusi. Ini penting untuk kinerja, terutama jika Anda menjalankan query yang sama beberapa kali dengan parameter yang berbeda. * `tStatement.%Execute(age)`: Menjalankan pernyataan yang disiapkan, memasukkan variabel `age` sebagai parameter. Titik dua (`:age`) dalam kode SQL menunjukkan placeholder parameter. * `result.%Next()`: Mengulangi set hasil, berpindah ke baris berikutnya. * `result.%Get("Name")` dan `result.%Get("Age")`: Mengambil nilai kolom "Name" dan "Age" untuk baris saat ini. * Penanganan Kesalahan: Kode menyertakan pemeriksaan kesalahan menggunakan `$$$ISERR` dan `result.%SQLCODE` untuk menangani potensi kesalahan SQL. **1.4. JDBC/ODBC** Anda dapat terhubung ke InterSystems IRIS dari Java, Python, atau bahasa lain menggunakan driver JDBC atau ODBC. Kode spesifik akan bergantung pada bahasa dan pustaka JDBC/ODBC yang Anda gunakan. Lihat dokumentasi InterSystems untuk konektivitas JDBC dan ODBC. **2. Memantau dan Memanipulasi Interoperabilitas** Interoperabilitas di InterSystems IRIS memungkinkan Anda untuk menghubungkan dan bertukar data dengan sistem eksternal. Pemantauan dan manipulasi sangat penting untuk memastikan integrasi yang lancar. **2.1. Memantau Produksi Interoperabilitas** * **Production Monitor:** Alat utama untuk memantau produksi interoperabilitas. Anda dapat mengaksesnya dari Management Portal: **Interoperability > List Productions**. Pilih produksi untuk melihat statusnya, jumlah pesan, kesalahan, dan metrik penting lainnya. * **Message Viewer:** Memungkinkan Anda untuk memeriksa pesan individual yang telah melewati produksi. Anda dapat melihat konten pesan, header, dan riwayat pemrosesan. Akses dari Production Monitor dengan mengklik jumlah pesan atau jumlah kesalahan. * **System Monitor:** Memberikan informasi kesehatan sistem secara keseluruhan, termasuk penggunaan CPU, penggunaan memori, dan ruang disk. Ini dapat membantu Anda mengidentifikasi hambatan sumber daya yang mungkin memengaruhi produksi interoperabilitas Anda. * **Logs:** InterSystems IRIS mencatat informasi rinci tentang aktivitas produksi, kesalahan, dan peringatan. Anda dapat melihat log dari Management Portal: **System Explorer > Logs**. Konfigurasikan tingkat logging untuk mengontrol jumlah informasi yang direkam. **2.2. Memanipulasi Produksi Interoperabilitas** * **Memulai dan Menghentikan Produksi:** Anda dapat memulai dan menghentikan produksi dari Production Monitor. Ini berguna untuk pemeliharaan, peningkatan, atau pemecahan masalah. * **Mengaktifkan dan Menonaktifkan Komponen:** Anda dapat mengaktifkan atau menonaktifkan komponen individual (misalnya, proses bisnis, operasi bisnis, layanan bisnis) dalam suatu produksi. Ini memungkinkan Anda untuk mengisolasi masalah atau menghapus sementara komponen dari alur. * **Mengirim Ulang Pesan:** Jika pesan gagal diproses dengan benar, Anda dapat mengirimkannya kembali dari Message Viewer. Ini berguna untuk memulihkan dari kesalahan atau mencoba kembali operasi yang gagal. * **Debugging:** InterSystems IRIS menyediakan alat debugging untuk melacak eksekusi proses bisnis dan komponen lainnya. Ini dapat membantu Anda mengidentifikasi akar penyebab kesalahan. * **Kontrol Programatik:** Anda dapat menggunakan kode ObjectScript untuk mengontrol produksi interoperabilitas secara programatik. Ini memungkinkan Anda untuk mengotomatiskan tugas-tugas seperti memulai dan menghentikan produksi, mengaktifkan dan menonaktifkan komponen, dan mengirim ulang pesan. **2.3. Contoh Kode (ObjectScript)** ```objectscript // Memulai produksi Set status = ##class(Ens.Director).StartProduction("MyProduction") If $$$ISERR(status) { Write "Error starting production: ", $System.Status.GetErrorText(status),! } // Menghentikan produksi Set status = ##class(Ens.Director).StopProduction("MyProduction") If $$$ISERR(status) { Write "Error stopping production: ", $System.Status.GetErrorText(status),! } // Mendapatkan status produksi Set status = ##class(Ens.Director).GetProductionStatus("MyProduction", .prodStatus) If $$$ISERR(status) { Write "Error getting production status: ", $System.Status.GetErrorText(status),! } Else { Write "Production Status: ", prodStatus,! } // Mengirim ulang pesan (membutuhkan ID pesan) Set status = ##class(Ens.Director).ResubmitMessage(messageId) If $$$ISERR(status) { Write "Error resubmitting message: ", $System.Status.GetErrorText(status),! } ``` **Pertimbangan Penting:** * **Keamanan:** Selalu gunakan kata sandi yang kuat dan langkah-langkah keamanan yang sesuai untuk melindungi instance InterSystems IRIS Anda dan data Anda. * **Penanganan Kesalahan:** Terapkan penanganan kesalahan yang kuat dalam kode ObjectScript Anda untuk menangkap dan menangani potensi kesalahan. * **Logging:** Konfigurasikan logging untuk menangkap informasi penting tentang produksi interoperabilitas Anda. * **Kinerja:** Optimalkan query SQL Anda dan konfigurasi interoperabilitas Anda untuk kinerja. * **Dokumentasi:** Lihat dokumentasi InterSystems IRIS untuk informasi rinci tentang SQL, interoperabilitas, dan fitur lainnya.

Linear MCP Server

Linear MCP Server

Sebuah server Protokol Konteks Model yang memungkinkan model bahasa besar untuk berinteraksi dengan sistem pelacakan masalah Linear, memungkinkan pengelolaan masalah, proyek, tim, dan sumber daya Linear lainnya.

Gemini Context MCP Server

Gemini Context MCP Server

Implementasi server MCP yang memaksimalkan jendela konteks token 2 juta Gemini dengan alat untuk manajemen konteks yang efisien dan caching di berbagai aplikasi klien AI.

Mattermost MCP Server

Mattermost MCP Server

Sebuah server MCP yang memungkinkan Claude dan klien MCP lainnya untuk berinteraksi dengan ruang kerja Mattermost, menyediakan kemampuan manajemen kanal, pengiriman pesan, dan fungsionalitas pemantauan topik.

Edgeone Pages Mcp Server

Edgeone Pages Mcp Server

Layanan yang memungkinkan penerapan cepat konten HTML ke EdgeOne Pages dan secara otomatis menghasilkan URL yang dapat diakses publik untuk konten yang diterapkan.

MCP Server DevOps Bridge 🚀

MCP Server DevOps Bridge 🚀

Azure Log Analytics MCP Server

Azure Log Analytics MCP Server

Here are a few ways to interpret "MCP server for querying Azure Log Analytics using natural language" and their corresponding Indonesian translations: **Interpretation 1: A server that uses Microsoft Cognitive Services (MCP) to allow querying Azure Log Analytics with natural language.** * **Indonesian Translation:** Server MCP yang menggunakan Azure Cognitive Services untuk memungkinkan kueri Azure Log Analytics dengan bahasa alami. **Interpretation 2: A server that provides a natural language interface for querying Azure Log Analytics, potentially using Microsoft Cloud Platform (MCP) technologies.** * **Indonesian Translation:** Server yang menyediakan antarmuka bahasa alami untuk melakukan kueri Azure Log Analytics, kemungkinan menggunakan teknologi Microsoft Cloud Platform (MCP). **Interpretation 3: A server designed to query Azure Log Analytics using natural language, and is managed or provided by Microsoft Cloud Partner (MCP).** * **Indonesian Translation:** Server yang dirancang untuk melakukan kueri Azure Log Analytics menggunakan bahasa alami, dan dikelola atau disediakan oleh Microsoft Cloud Partner (MCP). **Explanation of Terms:** * **MCP (Microsoft Cognitive Services/Microsoft Cloud Platform/Microsoft Cloud Partner):** The abbreviation "MCP" is ambiguous. It could refer to: * **Microsoft Cognitive Services (now Azure Cognitive Services):** A suite of AI services. * **Microsoft Cloud Platform (now Azure):** The overall cloud platform. * **Microsoft Cloud Partner:** A company that partners with Microsoft to provide cloud solutions. * **Azure Log Analytics:** A service in Azure for collecting and analyzing log data. * **Natural Language:** Human-readable language, as opposed to code or query languages. * **Querying:** Asking questions of a database or system to retrieve information. **Which translation is best depends on the specific context.** If you can provide more information about what "MCP" refers to in your context, I can provide a more accurate translation.

mcp-server-zenn: Unofficial MCP server for Zenn (

mcp-server-zenn: Unofficial MCP server for Zenn (

Server Protokol Konteks Model tidak resmi untuk Zenn yang memungkinkan pengambilan artikel dan buku dari platform Zenn melalui API-nya.

Petstore3

Petstore3

Server proxy yang menjembatani agen AI dan API eksternal dengan menerjemahkan spesifikasi OpenAPI secara dinamis menjadi alat MCP (Machine Comprehension Program) yang terstandarisasi, memungkinkan interaksi yang lancar tanpa kode integrasi khusus.

MCP Tools

MCP Tools

Antarmuka baris perintah untuk berinteraksi dengan server MCP (Model Context Protocol) menggunakan transport stdio dan HTTP.

Wikipedia

Wikipedia

Agentis MCP

Agentis MCP

Python framework for creating AI agents that use MCP servers as tools. Compatible with any MCP server and model provider.

Smartsheet MCP Server

Smartsheet MCP Server

Menyediakan integrasi tanpa hambatan dengan Smartsheet, memungkinkan operasi otomatis pada dokumen Smartsheet melalui antarmuka standar yang menjembatani alat otomatisasi bertenaga AI dengan platform kolaborasi Smartsheet.

Chroma MCP Server

Chroma MCP Server

Sebuah server yang menyediakan kemampuan pengambilan data yang didukung oleh basis data embedding Chroma, memungkinkan model AI untuk membuat koleksi atas data yang dihasilkan dan input pengguna, serta mengambil data tersebut menggunakan pencarian vektor, pencarian teks lengkap, dan penyaringan metadata.

Docker image for the MCP Everything server with SSE transport

Docker image for the MCP Everything server with SSE transport

Mirror of

Offline Cline Marketplace

Offline Cline Marketplace

Sebuah proyek untuk menyinkronkan server MCP secara berkala dari Cline Marketplace resmi.

DALL-E MCP Server

DALL-E MCP Server

Sebuah server MCP yang memungkinkan pengguna untuk menghasilkan, mengedit, dan membuat variasi gambar melalui API DALL-E OpenAI, mendukung model DALL-E 2 dan DALL-E 3.

Command Execution MCP Server for Claude Desktop

Command Execution MCP Server for Claude Desktop

Command Execution MCP Server for Claude Desktop

Sensei MCP

Sensei MCP

Server Protokol Konteks Model yang menyediakan panduan ahli untuk pengembangan Dojo dan Cairo di Starknet, menawarkan pengetahuan dan bantuan khusus untuk membangun dunia onchain menggunakan kerangka kerja Sistem Komponen Entitas Dojo.

Memory MCP Server

Memory MCP Server

Server Protokol Konteks Model yang menyediakan kemampuan manajemen grafik pengetahuan.

Kaltura Model Context Protocol (MCP) Server

Kaltura Model Context Protocol (MCP) Server

Implementasi dari Protokol Konteks Model yang menyediakan model AI dengan akses standar ke kemampuan manajemen media Kaltura, termasuk mengunggah, mengambil metadata, mencari, dan mengelola kategori dan izin.

MCP Node.js Debugger

MCP Node.js Debugger

Memungkinkan Claude untuk secara langsung melakukan debug pada server NodeJS dengan mengatur breakpoint, memeriksa variabel, dan menelusuri kode.

dbx-mcp-server

dbx-mcp-server

Server Protokol Konteks Model yang memungkinkan aplikasi AI berinteraksi dengan Dropbox, menyediakan alat untuk operasi file, pengambilan metadata, pencarian, dan manajemen akun melalui API Dropbox.

MCP Compliance

MCP Compliance

Sebuah server mcp untuk mendukung operasi kepatuhan dalam agen AI

WhatsUpDoc (downmarked)

WhatsUpDoc (downmarked)

Okay, I understand. Here's a breakdown of how you could approach this task, along with considerations and potential code snippets (using Python as a common scripting language). Keep in mind that this is a complex task, and the specific implementation will depend heavily on the structure of the developer documentation you're targeting. **Overall Strategy** 1. **Identify the Target Documentation:** Determine the website or source where the developer documentation resides. This is crucial because the scraping method will vary depending on the site's structure. 2. **Web Scraping:** Use a library like `requests` and `Beautiful Soup` (or `Scrapy` for more complex sites) to fetch and parse the HTML content of the documentation pages. 3. **Content Extraction:** Identify the relevant content within the HTML (e.g., headings, paragraphs, code examples). Use CSS selectors or XPath expressions to target these elements. 4. **Markdown Conversion:** Convert the extracted content into Markdown format. You might need to handle specific HTML elements and translate them into their Markdown equivalents. 5. **Anthropic MCP Integration (Conceptual):** This is where it gets more abstract. The idea is to use Anthropic's MCP (Message Content Protocol) to define a standardized way for the CLI (command-line interface) to request documentation and for the documentation server to respond. This likely involves defining a schema for the request and response messages. 6. **Local Storage:** Save the generated Markdown files locally. **Python Code Snippets (Illustrative)** ```python import requests from bs4 import BeautifulSoup import os import re # For cleaning up text # --- Configuration --- BASE_URL = "https://example.com/docs/" # Replace with the actual base URL START_PAGE = "index.html" # Replace with the starting page OUTPUT_DIR = "local_docs" # --- Helper Functions --- def clean_text(text): """Removes extra whitespace and cleans up text.""" text = re.sub(r'\s+', ' ', text).strip() # Remove multiple spaces return text def scrape_page(url): """Scrapes a single page and returns the relevant content.""" try: response = requests.get(url) response.raise_for_status() # Raise HTTPError for bad responses (4xx or 5xx) soup = BeautifulSoup(response.content, 'html.parser') # --- Identify Content Areas (Adjust these selectors!) --- main_content = soup.find("div", class_="main-content") # Example: Find a div with class "main-content" if not main_content: print(f"Warning: No main content found on {url}") return None # Extract headings, paragraphs, code blocks, etc. # This is the most site-specific part. Inspect the HTML! headings = main_content.find_all(["h1", "h2", "h3", "h4", "h5", "h6"]) paragraphs = main_content.find_all("p") code_blocks = main_content.find_all("pre") # Often used for code return { "headings": headings, "paragraphs": paragraphs, "code_blocks": code_blocks, "url": url } except requests.exceptions.RequestException as e: print(f"Error fetching {url}: {e}") return None def convert_to_markdown(content): """Converts extracted content to Markdown.""" if not content: return "" markdown = "" markdown += f"# {content['url']}\n\n" # Add the URL as a heading for heading in content["headings"]: level = int(heading.name[1]) # h1 -> level 1, h2 -> level 2, etc. markdown += f"{'#' * level} {clean_text(heading.get_text())}\n\n" for paragraph in content["paragraphs"]: markdown += f"{clean_text(paragraph.get_text())}\n\n" for code_block in content["code_blocks"]: code = code_block.get_text() markdown += "```\n" + code + "\n```\n\n" return markdown def save_to_file(filename, content): """Saves Markdown content to a file.""" filepath = os.path.join(OUTPUT_DIR, filename + ".md") try: with open(filepath, "w", encoding="utf-8") as f: f.write(content) print(f"Saved to {filepath}") except Exception as e: print(f"Error saving to {filepath}: {e}") def crawl_and_scrape(start_url): """Crawls the documentation site and scrapes content.""" visited_urls = set() queue = [start_url] while queue: url = queue.pop(0) if url in visited_urls: continue visited_urls.add(url) print(f"Scraping: {url}") content = scrape_page(url) if content: markdown = convert_to_markdown(content) filename = url.replace(BASE_URL, "").replace("/", "_").replace(".html", "") # Create a filename save_to_file(filename, markdown) # --- Find links on the page and add them to the queue (Be careful of infinite loops!) --- try: response = requests.get(url) response.raise_for_status() soup = BeautifulSoup(response.content, 'html.parser') for link in soup.find_all('a', href=True): next_url = link['href'] if next_url.startswith("/"): next_url = BASE_URL + next_url[1:] # Handle relative links elif not next_url.startswith("http"): next_url = BASE_URL + next_url #Handle relative links without leading slash if BASE_URL in next_url: # Only crawl within the documentation site queue.append(next_url) except requests.exceptions.RequestException as e: print(f"Error finding links on {url}: {e}") # --- Main Execution --- if __name__ == "__main__": os.makedirs(OUTPUT_DIR, exist_ok=True) # Create the output directory start_url = BASE_URL + START_PAGE crawl_and_scrape(start_url) print("Scraping complete!") ``` **Explanation of the Code:** * **`requests`:** Fetches the HTML content from the web pages. * **`Beautiful Soup`:** Parses the HTML, making it easy to navigate and extract data. * **`BASE_URL` and `START_PAGE`:** You *must* replace these with the actual URL of the documentation you want to scrape. * **`scrape_page()`:** This function fetches the HTML, parses it, and then *crucially* uses CSS selectors (`soup.find()`, `soup.find_all()`) to locate the specific parts of the page you want to extract (headings, paragraphs, code blocks). **This is the part you'll need to customize heavily based on the structure of the target website.** Inspect the HTML source of the documentation pages to determine the correct CSS selectors. * **`convert_to_markdown()`:** This function takes the extracted content and converts it into Markdown format. It handles headings, paragraphs, and code blocks. You might need to add more logic to handle other HTML elements (lists, tables, images, etc.). * **`save_to_file()`:** Saves the Markdown content to a file in the `OUTPUT_DIR`. * **`crawl_and_scrape()`:** This function recursively crawls the documentation site, following links to other pages. It prevents infinite loops by keeping track of visited URLs. **Be very careful with this part. Make sure you're only crawling within the documentation site's domain.** **Important Considerations and Next Steps:** * **Website Structure:** The most important thing is to understand the structure of the website you're scraping. Use your browser's developer tools (usually by pressing F12) to inspect the HTML source code and identify the CSS selectors or XPath expressions that will allow you to extract the relevant content. * **Robots.txt:** Always check the website's `robots.txt` file (e.g., `https://example.com/robots.txt`) to see if there are any restrictions on scraping. Respect the website's rules. * **Rate Limiting:** Don't overload the website with requests. Implement a delay between requests (e.g., using `time.sleep()`) to avoid being blocked. * **Error Handling:** The code includes basic error handling, but you should add more robust error handling to catch potential issues (e.g., network errors, unexpected HTML structure). * **Dynamic Content:** If the documentation website uses JavaScript to load content dynamically, you might need to use a headless browser like Selenium or Puppeteer to render the page before scraping it. This adds significant complexity. * **Anthropic MCP Integration (Detailed):** * **Define the Schema:** You'll need to define a JSON schema (or similar) for the messages that will be exchanged between the CLI and the documentation server. For example: ```json // Request from CLI { "type": "documentation_request", "query": "how to use the API", "format": "markdown" // or "html", "text" } // Response from Documentation Server { "type": "documentation_response", "query": "how to use the API", "result": "# Using the API\n\nHere's how to use the API...", "format": "markdown" } ``` * **CLI Implementation:** The CLI would need to: * Construct a request message according to the schema. * Send the request to the documentation server (e.g., via HTTP). * Receive the response from the server. * Display the documentation to the user. * **Documentation Server Implementation:** The documentation server would need to: * Receive requests from the CLI. * Parse the request message. * Search the documentation (potentially using an index or search engine). * Format the results according to the requested format. * Send the response back to the CLI. * **MCP Benefits:** The MCP approach provides several benefits: * **Standardization:** Ensures that the CLI and the documentation server communicate in a consistent way. * **Flexibility:** Allows you to change the documentation server implementation without affecting the CLI (as long as the message schema remains the same). * **Extensibility:** Makes it easier to add new features to the documentation system. **Example of MCP usage (Conceptual):** ```python # CLI (Conceptual) import json import requests def get_documentation(query): request = { "type": "documentation_request", "query": query, "format": "markdown" } try: response = requests.post("http://your-documentation-server/api/docs", json=request) response.raise_for_status() data = response.json() if data["type"] == "documentation_response": print(data["result"]) # Display the markdown else: print("Unexpected response from server.") except requests.exceptions.RequestException as e: print(f"Error: {e}") # Documentation Server (Conceptual - Flask example) from flask import Flask, request, jsonify app = Flask(__name__) @app.route('/api/docs', methods=['POST']) def get_docs(): data = request.get_json() if data["type"] == "documentation_request": query = data["query"] # ... Search your documentation ... result = f"# Results for {query}\n\nSome documentation here." # Replace with actual search response = { "type": "documentation_response", "query": query, "result": result, "format": "markdown" } return jsonify(response) else: return jsonify({"error": "Invalid request"}), 400 if __name__ == '__main__': app.run(debug=True) ``` **In summary, this is a complex project that requires careful planning and implementation. Start by understanding the structure of the target documentation website, and then gradually build up the scraping and conversion logic. The MCP integration adds another layer of complexity, but it can provide significant benefits in terms of standardization and flexibility.** Remember to respect the website's terms of service and robots.txt file. Good luck!

Web_Search_MCP

Web_Search_MCP

Server MCP (Model Context Protocol) dengan alat pencarian web.

ISO 9001 MCP Server

ISO 9001 MCP Server

ISO 9001 Model Context Protocol Server Implementation

pyodide-mcp

pyodide-mcp

Pyodide MCP Server

Weather MCP Server

Weather MCP Server

Sebuah server MCP yang menyediakan informasi cuaca real-time termasuk suhu, kelembapan, kecepatan angin, dan waktu matahari terbit/terbenam melalui OpenWeatherMap API.