OppaAI commited on
Commit
30df9f2
·
verified ·
1 Parent(s): f1362d2

Upload 4 files

Browse files

Submit my MCP server for MCP Server Hackathon

.gitattributes CHANGED
@@ -33,3 +33,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
 
 
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
36
+ Remote[[:space:]]Job[[:space:]]Search[[:space:]]MCP[[:space:]]Client[[:space:]]&[[:space:]]Server.mp4 filter=lfs diff=lfs merge=lfs -text
README.md CHANGED
@@ -1,14 +1,23 @@
1
  ---
2
- title: Remote Jobs Search MCP Server
3
- emoji: 🦀
4
- colorFrom: pink
5
- colorTo: pink
6
  sdk: gradio
7
  sdk_version: 5.33.0
8
  app_file: app.py
9
  pinned: false
10
  license: gpl-3.0
11
- short_description: ' A Gradio MCP Server for searching remotes jobs in Jobicy'
 
 
 
 
 
 
 
 
 
12
  ---
13
-
14
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
1
  ---
2
+ title: Jobicy Remote Job Search MCP Server
3
+ emoji: 📉
4
+ colorFrom: indigo
5
+ colorTo: yellow
6
  sdk: gradio
7
  sdk_version: 5.33.0
8
  app_file: app.py
9
  pinned: false
10
  license: gpl-3.0
11
+ short_description: A Gradio MCP Server for searching remotes jobs in Jobicy
12
+ language:
13
+ - en
14
+ tags:
15
+ - mcp-server-track
16
+ - jobs
17
+ - job_search
18
+ - mcp_server
19
+ thumbnail: >-
20
+ https://cdn-uploads.huggingface.co/production/uploads/681c02a257cfafb5eafbfffe/Gv2PetCPcmOo6eJcBqTtx.png
21
  ---
22
+ # Demo Video
23
+ [Watch the demo video here](https://www.youtube.com/watch?v=VixgW64DfVA)
Remote Job Search MCP Client & Server.mp4 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:8b95a4282c783d108ee0574ea8a56ece1a2c326e133370a2bedfaae032212d9f
3
+ size 28696066
app.py ADDED
@@ -0,0 +1,172 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from fastmcp import FastMCP
3
+ import logging
4
+ import requests
5
+ from datetime import datetime
6
+
7
+ logging.basicConfig(level=logging.INFO, format="%(asctime)s - %(levelname)s - %(message)s")
8
+ logger = logging.getLogger(__name__)
9
+ mcp = FastMCP("Jobicy Remote Jobs Agent")
10
+
11
+ COMPANY_INDUSTRIES = [
12
+ ("", ""),
13
+ ("Business Development", "business"),
14
+ ("Content & Editorial", "copywriting"),
15
+ ("Creative & Design", "design-multimedia"),
16
+ ("Customer Success", "supporting"),
17
+ ("Data Science & Analytics", "data-science"),
18
+ ("DevOps & Infrastructure", "admin"),
19
+ ("Finance & Accounting", "accounting-finance"),
20
+ ("HR & Recruiting", "hr"),
21
+ ("Legal & Compliance", "legal"),
22
+ ("Marketing & Sales", "marketing"),
23
+ ("Product & Operations", "management"),
24
+ ("Programming", "dev"),
25
+ ("Sales", "seller"),
26
+ ("SEO", "seo"),
27
+ ("Social Media Marketing", "smm"),
28
+ ("Software Engineering", "engineering"),
29
+ ("Technical Support", "technical-support"),
30
+ ("Web & App Design", "web-app-design"),
31
+ ]
32
+ COUNTRY_CHOICES = [
33
+ "", "USA", "Canada", "UK", "China", "APAC", "EMEA", "LATAM", "Argentina", "Australia", "Austria", "Belgium", "Brazil", "Bulgaria",
34
+ "Costa Rica", "Croatia", "Cyprus", "Czechia", "Denmark", "Estonia", "Europe",
35
+ "Finland", "France", "Germany", "Greece", "Hungary", "Ireland", "Israel", "Italy", "Japan",
36
+ "Latvia", "Lithuania", "Mexico", "Netherlands", "New Zealand", "Norway", "Philippines", "Poland",
37
+ "Portugal", "Romania", "Singapore", "Slovakia", "Slovenia", "South Korea", "Spain", "Sweden",
38
+ "Switzerland", "Thailand", "Türkiye", "UAE", "Vietnam"
39
+ ]
40
+
41
+ @mcp.tool(name="search_jobs")
42
+ def search_jobs_tool(industry: str = "", country: str = "", keyword: str = "", limit: int = 20) -> dict:
43
+ """
44
+ Search remote jobs from the Jobicy API with optional filters.
45
+ Parameters:
46
+ industry (str): Company industry to filter jobs by (e.g., 'business', 'design-multimedia').
47
+ Leave empty to include all industries.
48
+ country (str): Region or country to filter jobs by (e.g., 'usa', 'canada').
49
+ Leave empty or 'anywhere' to include all locations.
50
+ keyword (str): Keyword or tag to search for in job listings (e.g., 'python', 'data').
51
+ Leave empty for no keyword filtering.
52
+ limit (int): Number of job results to return, between 1 and 50. Defaults to 20.
53
+ Returns:
54
+ dict: A dictionary with a "jobs" key containing a list of job dictionaries with:
55
+ - title: Job title
56
+ - company: Company name
57
+ - location: Job location
58
+ - url: Application or job posting URL
59
+ - pubDate: Date posted (YYYY-MM-DD)
60
+ - salary: Salary range or 'Not specified'
61
+
62
+ Or an "error" key with an error message if the fetch fails.
63
+ """
64
+ base = "https://jobicy.com/api/v2/remote-jobs"
65
+ params = {"count": max(1, min(limit, 50))}
66
+ if industry:
67
+ params["industry"] = industry.lower().replace(" & ", "-").replace(" ", "-")
68
+ if country and country.lower() != "anywhere":
69
+ params["geo"] = country.lower()
70
+ if keyword:
71
+ params["tag"] = keyword.strip()
72
+
73
+ logger.info(f"Requesting Jobicy API with params: {params}")
74
+
75
+ session = requests.Session()
76
+ session.headers.update({
77
+ "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0 Safari/537.36",
78
+ "Accept": "application/json, text/javascript, */*; q=0.01",
79
+ "Referer": "https://jobicy.com/remote-jobs",
80
+ "Origin": "https://jobicy.com",
81
+ })
82
+
83
+ try:
84
+ resp = session.get(base, params=params, timeout=10)
85
+ resp.raise_for_status()
86
+ jobs_raw = resp.json().get("jobs", [])
87
+ except Exception as e:
88
+ return {"error": f"Fetch error: {e}"}
89
+
90
+ def fmt(j):
91
+ posted = j.get("pubDate", "")[:10]
92
+ sal_min = j.get("annualSalaryMin")
93
+ sal_max = j.get("annualSalaryMax")
94
+ cur = j.get("salaryCurrency", "")
95
+ salary = f"{sal_min}–{sal_max} {cur}".strip() if sal_min or sal_max else "Not specified"
96
+ return {
97
+ "title": j.get("jobTitle", "No Title"),
98
+ "company": j.get("companyName", ""),
99
+ "location": j.get("jobGeo", ""),
100
+ "url": j.get("url", "#"),
101
+ "pubDate": posted,
102
+ "salary": salary
103
+ }
104
+
105
+ sorted_jobs = sorted(jobs_raw, key=lambda x: x.get("pubDate", ""), reverse=True)[:params["count"]]
106
+ return {"jobs": [fmt(j) for j in sorted_jobs]}
107
+
108
+ def search_jobs_ui(industry, country, keyword, limit):
109
+ """
110
+ Search remote jobs from the Jobicy API with optional filters.
111
+
112
+ Parameters:
113
+ industry (str): Company industry to filter jobs by (e.g., 'business', 'design-multimedia').
114
+ Leave empty to include all industries.
115
+ country (str): Region or country to filter jobs by (e.g., 'usa', 'canada').
116
+ Leave empty or 'anywhere' to include all locations.
117
+ keyword (str): Keyword or tag to search for in job listings (e.g., 'python', 'data').
118
+ Leave empty for no keyword filtering.
119
+ limit (int): Number of job results to return, between 1 and 50. Defaults to 20.
120
+
121
+ Returns:
122
+ dict: A dictionary with a "jobs" key containing a list of job dictionaries with:
123
+ - title: Job title
124
+ - company: Company name
125
+ - location: Job location
126
+ - url: Application or job posting URL
127
+ - pubDate: Date posted (YYYY-MM-DD)
128
+ - salary: Salary range or 'Not specified'
129
+
130
+ Or an "error" key with an error message if the fetch fails.
131
+ """
132
+ res = search_jobs_tool(industry=industry, country=country, keyword=keyword, limit=limit)
133
+ if "error" in res:
134
+ return f"❌ {res['error']}"
135
+ if not res["jobs"]:
136
+ return "No jobs found with these filters."
137
+
138
+ md = "# Remote Jobs Results\n\n"
139
+ for i, j in enumerate(res["jobs"], 1):
140
+ search_query = f"{j['title']} {j['company']}"
141
+ search_url = f"https://www.google.com/search?q={requests.utils.quote(search_query)}"
142
+
143
+ md += (
144
+ f"### {i}. {j['title']}\n\n"
145
+ f"**Company:** {j['company']}\n\n"
146
+ f"**Location:** {j['location']}\n\n"
147
+ f"**Salary:** {j['salary']}\n\n"
148
+ f"**Posted On:** {j['pubDate']}\n\n"
149
+ f"🔗 [Apply / More Info]({j['url']}) \n"
150
+ f"🔍 [Google Search]({search_url})\n\n"
151
+ "---\n\n"
152
+ )
153
+ return md
154
+
155
+ app = gr.Interface(
156
+ fn=search_jobs_ui,
157
+ inputs=[
158
+ gr.Dropdown(label="Company Industry (optional) (Empty = All)", choices=COMPANY_INDUSTRIES, value=""),
159
+ gr.Dropdown(label="Country / Region (optional) (Empty = Anywhere)", choices=COUNTRY_CHOICES, value=""),
160
+ gr.Textbox(label="Keyword / Tag (optional)", placeholder="e.g., python, data, web"),
161
+ gr.Slider(minimum=1, maximum=50, value=20, step=1, label="Number of Results"),
162
+ ],
163
+ outputs=gr.Markdown(),
164
+ title="Jobicy Remote Job Search",
165
+ description="""""Search remote jobs by industry, region, and keyword. Results sorted by most recent.
166
+ The Apply Now in the Jobicy is only for Paid accounts.
167
+ If you don't have one, just click the Google Search to search the job link in Google and apply there.""",
168
+ theme="huggingface"
169
+ )
170
+
171
+ if __name__ == "__main__":
172
+ app.launch(mcp_server=True)
requirements.txt ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ gradio[mcp]
2
+ fastmcp
3
+ beautifulsoup4
4
+ requests
5
+ cloudscraper