ErgoHub MCP
# ErgoHub MCP
**Part of the [ErgoHub](https://github.com/AnastasiaZervas/ErgoHub) 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/AnastasiaZervas)
## 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 target distinct resources and are clearly role-scoped, so an agent can usually pick correctly. Minor overlap exists among the many list/read tools (e.g., list_conversations vs read_project_chat, project_reviews vs my_reviews), but the detailed descriptions resolve these.
The set is predominantly snake_case with a consistent verb_noun pattern (get_project, post_project, review_project, send_project_message). A few outliers like whoami and noun-style names such as admin_overview slightly break the pattern, but the my_* family is consistent.
At 28 tools the surface is heavy for an MCP server, and many are variations of listing (my_projects, list_all_projects, find_open_projects, my_assigned_projects, list_users, search_freelancers, list_conversations, project_reviews, my_reviews, etc.). Several could be consolidated behind a scope or filter parameter, reducing cognitive load.
Core workflows are covered: project creation/approval/assignment/completion, applications, chat, reviews, notifications, and admin moderation. Gaps include no project edit/update or cancellation, no single-notification read (only mark_all), and no user profile update, but agents can work around most of these.