MCP Example
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@MCP Examplefetch the content from example.com"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
MCP-Example
A demonstration project implementing the Model Context Protocol (MCP), showcasing client-server communication with various functionalities including web content fetching and system monitoring.
Features
Web content fetching and parsing
System information monitoring
Real-time server-sent events (SSE) communication
MCP protocol implementation
Resource management and tool execution
Related MCP server: Hello World MCP Server
Requirements
Python 3.10+
Dependencies (install via pip):
httpx
beautifulsoup4
uvicorn
psutil
mcp-sdk
Installation
Clone the repository:
git clone https://github.com/stevensu1977/mcp-example.git
cd mcp-example.gitCreate and activate a virtual environment:
python -m venv .venv
source .venv/bin/activate # On Windows, use: .venv\Scripts\activateInstall dependencies:
pip install -r requirements.txtUsage
Start the SSE server:
#There have two types server , sse and stdio
python sse/exampe_server.pyThe server will start on http://localhost:8000
In a separate terminal, run the SSE client:
python sse/exampe_client.py(.venv) ➜ mcp-example git:(main) ✗ python sse/example_client.py
Connecting to http://0.0.0.0:8000/sse
nextCursor=None tools=[Tool(name='fetch', description='Fetches a website and returns its content', inputSchema={'type': 'object', 'required': ['url'], 'properties': {'url': {'type': 'string', 'description': 'URL to fetch'}}})]
content=[TextContent(type='text', text='<!doctype html>\n<html>\n<head>\n <title>Example Domain</title>\n\n <meta charset="utf-8" />\n <meta http-equiv="Content-type" content="text/html; charset=utf-8" />\n <meta name="viewport" content="width=device-width, initial-scale=1" />\n <style type="text/css">\n body {\n background-color: #f0f0f2;\n margin: 0;\n padding: 0;\n font-family: -apple-system, system-ui, BlinkMacSystemFont, "Segoe UI", "Open Sans", "Helvetica Neue", Helvetica, Arial, sans-serif;\n \n }\n div {\n width: 600px;\n margin: 5em auto;\n padding: 2em;\n background-color: #fdfdff;\n border-radius: 0.5em;\n box-shadow: 2px 3px 7px 2px rgba(0,0,0,0.02);\n }\n a:link, a:visited {\n color: #38488f;\n text-decoration: none;\n }\n @media (max-width: 700px) {\n div {\n margin: 0 auto;\n width: auto;\n }\n }\n </style> \n</head>\n\n<body>\n<div>\n <h1>Example Domain</h1>\n <p>This domain is for use in illustrative examples in documents. You may use this\n domain in literature without prior coordination or asking for permission.</p>\n <p><a href="https://www.iana.org/domains/example">More information...</a></p>\n</div>\n</body>\n</html>\n')] isError=FalseThe client will connect to the server and demonstrate various functionalities including:
Fetching external web content
Protocol Implementation
This project implements the Model Context Protocol (MCP), providing a framework for:
Server-Sent Events (SSE) based communication
Resource management
Tool execution
Client-server interaction
License
See the LICENSE file for details.
This server cannot be deployed
Maintenance
Related MCP Connectors
MCP server to assist with JxBrowser development.
Experimental MCP server for current empirical verification of explicit public HTTPS endpoint claims.
Related MCP Servers
- AlicenseCqualityBmaintenanceA simple MCP server that facilitates website fetching through a configurable server platform using stdio or SSE transport, allowing integration with tools like Cursor for streamlined access.238MIT
- AlicenseNot gradedqualityDmaintenanceA demonstration server that implements the Model Context Protocol (MCP) SDK, providing tools and endpoints for server-sent events and message handling.169 npm14MIT
- AlicenseNot gradedqualityDmaintenanceA demonstration MCP server supporting both Stdio and SSE transports, providing example tools (echo, add, time, UUID generation) and resources for learning and testing MCP implementations.8 npmMIT
- AlicenseNot gradedqualityDmaintenanceA simple Model Context Protocol server demonstration that provides SSE streaming communication and basic message handling with a Hello World example.Apache 2.0