ErgoHub MCP
# ErgoHub MCP
**Part of the [ErgoHub](https://github.com/KonstantinosPapadogiannis/cloud-native-freelance-platform) ecosystem.**
The web platform lives in its own repository; this server is the layer through which
AI assistants, including the one built into ErgoHub, work with it.
An [MCP](https://modelcontextprotocol.io) server for **ErgoHub**, a freelance
marketplace (Spring Boot + React). It lets Claude, ChatGPT or Cursor work on the
platform in plain language: an admin reviews pending projects, a client compares
applicants, a freelancer finds work and applies, all through the real ErgoHub REST API
and with the caller's own permissions.
```
Claude / ChatGPT / Cursor ──MCP──▶ ergohub-mcp ──REST + JWT──▶ ErgoHub backend
(the model decides) (28 tools, 2 prompts) (enforces roles)
```

*The assistant inside ErgoHub uses these tools. Changes are shown as a card that the user must confirm.*

*An answer built from live platform data.*
## Design choices
- **The backend stays the authority.** The server never checks roles itself; it forwards
the user's JWT and turns 401/403/404 into short messages the model can act on.
- **Whitelisted output.** Some ErgoHub endpoints return full JPA entities that are
recursive and include the bcrypt `password` hash. Those bodies are never parsed;
every response goes through `views.py`, which keeps only named fields.
- **Write tools are marked.** Tool annotations (`readOnlyHint`, `destructiveHint`) let
clients ask for confirmation, and the server instructions require it.
- **User content is data.** Project descriptions, cover letters and chat messages are
written by other users; the instructions tell the model never to follow them.
- **Two transports, one codebase.** stdio for local clients, Streamable HTTP (stateless)
for ChatGPT and claude.ai.
## Tools
| Role | Tools |
|---|---|
| Everyone | `whoami`, `list_notifications`, `mark_all_notifications_read`, `get_project`, `search_freelancers`, `my_assistant_actions` |
| Admin | `admin_overview`, `list_users`, `set_user_approval`, `list_all_projects`, `review_project`, `list_reports`, `update_report` |
| Client | `my_projects`, `post_project`, `applications_to_my_projects`, `decide_application`, `complete_project` |
| Freelancer | `find_open_projects`, `apply_to_project`, `my_applications`, `my_assigned_projects`, `complete_project` |
| Project chat | `read_project_chat`, `send_project_message`, `list_conversations` |
| Reviews | `review_counterpart`, `project_reviews`, `my_reviews` |
Prompts: `admin_daily_review`, `compare_applicants(project_id)`.

## Install
```bash
python3.11 -m venv .venv && . .venv/bin/activate
pip install -e ".[dev]"
cp .env.example .env # set ERGOHUB_API_URL and an account
```
## Connect a client
### Claude Code
```bash
claude mcp add ergohub \
-e ERGOHUB_API_URL=http://localhost:3010 \
-e ERGOHUB_USERNAME=admin1 -e ERGOHUB_PASSWORD=... \
-- /absolute/path/ergohub-mcp/.venv/bin/ergohub-mcp
```
### Claude Desktop (`claude_desktop_config.json`) and Cursor (`.cursor/mcp.json`)
Both use the same shape:
```json
{
"mcpServers": {
"ergohub": {
"command": "/absolute/path/ergohub-mcp/.venv/bin/ergohub-mcp",
"env": {
"ERGOHUB_API_URL": "http://localhost:3010",
"ERGOHUB_USERNAME": "admin1",
"ERGOHUB_PASSWORD": "..."
}
}
}
}
```
### ChatGPT and claude.ai (remote, HTTP)
Browser clients cannot start a local process; they need a public HTTPS URL.
```bash
MCP_PATH=/mcp-$(openssl rand -hex 16) MCP_ALLOWED_HOSTS=<tunnel-host> ergohub-mcp --http --allow-shared-account
# or: docker build -t ergohub-mcp . && docker run -p 8765:8765 --env-file .env ergohub-mcp
cloudflared tunnel --url http://localhost:8765 # demo only
```
`MCP_ALLOWED_HOSTS` is required behind a tunnel or proxy: the SDK's DNS-rebinding
protection otherwise answers `421 Misdirected Request`. The random `MCP_PATH` keeps a
demo URL from being guessed, but it is not authentication: an exposed server with env
credentials refuses to start unless `--allow-shared-account` is given. Add `https://<tunnel><MCP_PATH>` as a custom connector (claude.ai: Settings → Connectors;
ChatGPT: Settings → Connectors, developer mode). Each request may carry the user's
ErgoHub JWT as `Authorization: Bearer <token>`, so every user acts as themselves.
Without a token the server falls back to the env credentials.
> **Production note:** a real deployment should put OAuth 2.1 in front (as the MCP
> authorization spec describes) and leave the env credentials empty. The tunnel setup
> is for demos.
## Inspect and test
```bash
npx @modelcontextprotocol/inspector .venv/bin/ergohub-mcp # browse tools interactively
pytest -q # unit tests, no backend needed
python scripts/smoke_stdio.py whoami 'find_open_projects:{}' # against a running ErgoHub
```
## Authors
- [Konstantinos Papadogiannis](https://github.com/KonstantinosPapadogiannis) - konstantinospapadogiannis.dev@gmail.com
- [Anastasiia Zervas](https://github.com/naasssssty)
## License
**Proprietary. All rights reserved. This is not open-source software.** The code is
public so that employers and clients can assess it. You may read it and run it
privately for that purpose only; see [LICENSE](LICENSE).
TDQS
Scored across 28 tools
Most tools have clearly distinct role-scoped purposes, such as my_projects vs. list_all_projects vs. my_assigned_projects, and admin/client/freelancer actions are separated. A few project-listing tools and review-listing tools overlap conceptually, but the role tags and descriptions make selection manageable.
Names overwhelmingly use snake_case and are readable, with action tools following verb_noun (post_project, apply_to_project, complete_project). Deviations like whoami, admin_overview, my_reviews, and my_projects are minor and follow a coherent 'my_' convention for personal listings.
28 tools is heavy, at the edge of what a multi-role marketplace needs. The three roles (admin, client, freelancer) and chat/review/report workflows justify breadth, but several listing tools could be consolidated or parameterized.
The surface covers the core marketplace lifecycle: project posting and approval, freelancer discovery and application, assignment, chat, completion, reviews, notifications, and admin oversight. Gaps remain around editing or cancelling projects, withdrawing applications, and creating reports, but these are not central to most agent workflows.