what is MCP Server Practice?
MCP Server Practice is a repository that implements Model Context Protocol (MCP) servers for scraping LinkedIn profiles and retrieving weather data. It facilitates integration and communication between AI services.
how to use MCP Server Practice?
To use MCP Server Practice, clone the repository, install the required dependencies, set up environment variables, and run the server to access the LinkedIn Profile Scraper and Weather Data Service tools.
key features of MCP Server Practice?
- LinkedIn Profile Scraper for fetching profile data using the Fresh LinkedIn Profile Data API.
- Weather Data Service for retrieving alerts and forecasts using the National Weather Service (NWS) API.
- Asynchronous HTTP requests for efficient data retrieval.
use cases of MCP Server Practice?
- Scraping LinkedIn profiles for data analysis or recruitment purposes.
- Retrieving real-time weather alerts and forecasts for applications.
- Integrating AI services for enhanced data processing and communication.
FAQ from MCP Server Practice?
- What programming language is used?
Python is used for implementing the MCP servers.
- Do I need an API key to use the LinkedIn Profile Scraper?
Yes, you need to set up a RapidAPI key in the environment variables.
- Is this project suitable for production use?
This project is primarily for practice and may require further development for production use.
MCP Server Practice
This repository contains implementations of Model Context Protocol (MCP) servers for LinkedIn profile scraping and weather data retrieval. The MCP framework facilitates seamless integration and communication between AI services.
Overview
- LinkedIn Profile Scraper: Fetches LinkedIn profile data using the Fresh LinkedIn Profile Data API.
- Weather Data Service: Retrieves weather alerts and forecasts using the National Weather Service (NWS) API.
Prerequisites
- Python 3.7+
httpx
for asynchronous HTTP requestspython-dotenv
for environment variable managementmcp
for MCP server implementation
Installation
-
Clone the repository:
git clone https://github.com/mybarefootstory/MCP-Server-Practice-2.git cd MCP-Server-Practice-2
-
Install dependencies:
pip install httpx python-dotenv mcp
-
Set up environment variables:
- Create a
.env
file in the root directory. - Add your RapidAPI key:
RAPIDAPI_KEY=your_rapidapi_key_here
- Create a
LinkedIn Profile Scraper
Description
Fetches LinkedIn profile data using the Fresh LinkedIn Profile Data API. The server is initialized with FastMCP
and listens for requests to retrieve profile information.
Code Snippet
from mcp.server.fastmcp import FastMCP
import httpx
import os
from dotenv import load_dotenv
load_dotenv()
RAPIDAPI_KEY = os.getenv("RAPIDAPI_KEY")
mcp = FastMCP("linkedin_profile_scraper")
async def get_linkedin_data(linkedin_url: str) -> dict:
# Fetch LinkedIn profile data
...
@mcp.tool()
async def get_profile(linkedin_url: str) -> str:
# Get LinkedIn profile data
...
if __name__ == "__main__":
mcp.run(transport="stdio")
Weather Data Service
Description
Retrieves weather alerts and forecasts using the NWS API. The server is initialized with FastMCP
and provides tools for fetching alerts and forecasts.
Code Snippet
from mcp.server.fastmcp import FastMCP
import httpx
mcp = FastMCP("weather")
async def make_nws_request(url: str) -> dict:
# Make a request to the NWS API
...
@mcp.tool()
async def get_alerts(state: str) -> str:
# Get weather alerts for a US state
...
@mcp.tool()
async def get_forecast(latitude: float, longitude: float) -> str:
# Get weather forecast for a location
...
if __name__ == "__main__":
mcp.run(transport='stdio')
Usage
- LinkedIn Profile Scraper: Run the server and use the
get_profile
tool to fetch LinkedIn data. - Weather Data Service: Run the server and use the
get_alerts
andget_forecast
tools to retrieve weather information.
