MCP server
The MCP server exposes the Developer API as Model Context Protocol tools over streamable HTTP. Use the same API keys as the REST surface.
The MCP endpoint is served at https://sapien-poq.up.railway.app/mcp.
The server is stateless, so nothing is managed across requests. Project and upload tools share domain logic with /developer/v1; field names, pagination cursors, and error vocabulary match.
Authentication
Every request needs a bearer token in the Authorization request header:
Authorization: Bearer poq_live_...
See API keys for key creation and lifecycle. Project tools additionally require the key creator to be an org originator, the same rule as the Developer API. Unauthenticated requests receive a JSON 401 before any MCP dispatch.
Client setup
Example for Cursor (mcp.json):
{
"mcpServers": {
"sapien-poq": {
"type": "http",
"url": "https://sapien-poq.up.railway.app/mcp",
"headers": {
"Authorization": "Bearer poq_live_..."
}
}
}
}
Other MCP clients (Claude Code, VS Code) use the same URL and header pattern.
Tools
Project and upload tools
These mirror the Developer API 1
. See the Developer API reference and OpenAPI spec for field-level detail.| Tool | REST equivalent | Purpose |
|---|---|---|
ping | GET /developer/v1/ping | Auth probe. Returns { "pong": true }. |
create_project | POST /developer/v1/projects | Create a live project. Args: name, spec (JSON). |
list_projects | GET /developer/v1/projects | Paginated list. Args: limit (1–100), cursor. |
get_project | GET /developer/v1/projects/{id} | Fetch one project. Arg: projectId. |
update_project | PUT /developer/v1/projects/{id} | Update metadata. Args: projectId, plus name, description, and/or paused. |
create_upload_session | POST .../upload-sessions | Open a session. Args: projectId, files. |
declare_upload_files | POST .../files | Add files or refresh presigned URLs. |
get_upload_session | GET .../upload-sessions/{uploadId} | Session detail and verification counters. |
process_upload_session | POST .../process | Verify uploads and start ingest. Returns runId. |
get_upload_session_status | GET .../status | Poll session and latest run. |
Instruction and convenience tools
These have no REST counterpart.
| Tool | Purpose |
|---|---|
get_started | Recommended tool sequence for a new project: spec guide → JSON spec → create → upload. |
spec_authoring_guide | System prompt and message format for drafting a JSON spec from a poq.md. Call before create_project when you do not already have a spec. |
project_creation_instruction | Step-by-step upload guidance. Optional datasetType (markdown_split, csv, json, file_collection) for format-specific tips. |
wait_for_upload_session | Polls status internally until complete/failed or timeoutSeconds (1–300, default 60) elapses. Returns timedOut. |
Uploading data
Bytes never flow through a tool call. create_upload_session and declare_upload_files return a presigned PUT URL per file. Upload each file with a plain HTTP PUT to that URL (no Authorization header), then call process_upload_session and poll status.
The REST one-shot PUT .../file redirect has no MCP equivalent. It is HTTP transport sugar for curl -T. Use declare_upload_files instead.
Errors
Domain failures return tool errors (isError: true). The text leads with a stable camelCase code:
projectNotFound: Project not found.
requestId: 0192f0a0-...
Codes are the camelCase spellings of the REST catalog (projectSpecInvalid ↔ project_spec_invalid, notOrgOriginator ↔ not_org_originator). Map handling the same way across both surfaces.
Include the requestId block when reporting issues. It matches the X-Request-Id header on REST responses.
REST vs MCP
| Concern | REST | MCP |
|---|---|---|
| Transport | HTTP + JSON | Streamable HTTP MCP |
| Error codes | snake_case in JSON envelope | camelCase in tool error text |
| One-shot file upload | PUT .../file (307 redirect) | declare_upload_files + presigned PUT |
| Spec authoring help | External (docs, agents) | spec_authoring_guide, get_started |
| Polling | Client calls GET .../status | wait_for_upload_session convenience wrapper |
See also
| Page | Description |
|---|---|
| Developer API - REST | HTTP endpoints and error codes |
| API keys | Creation and authorization |
| Quickstart - API | End-to-end walkthrough |