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.

ToolREST equivalentPurpose
pingGET /developer/v1/pingAuth probe. Returns { "pong": true }.
create_projectPOST /developer/v1/projectsCreate a live project. Args: name, spec (JSON).
list_projectsGET /developer/v1/projectsPaginated list. Args: limit (1–100), cursor.
get_projectGET /developer/v1/projects/{id}Fetch one project. Arg: projectId.
update_projectPUT /developer/v1/projects/{id}Update metadata. Args: projectId, plus name, description, and/or paused.
create_upload_sessionPOST .../upload-sessionsOpen a session. Args: projectId, files.
declare_upload_filesPOST .../filesAdd files or refresh presigned URLs.
get_upload_sessionGET .../upload-sessions/{uploadId}Session detail and verification counters.
process_upload_sessionPOST .../processVerify uploads and start ingest. Returns runId.
get_upload_session_statusGET .../statusPoll session and latest run.

Instruction and convenience tools

These have no REST counterpart.

ToolPurpose
get_startedRecommended tool sequence for a new project: spec guide → JSON spec → create → upload.
spec_authoring_guideSystem 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_instructionStep-by-step upload guidance. Optional datasetType (markdown_split, csv, json, file_collection) for format-specific tips.
wait_for_upload_sessionPolls 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 (projectSpecInvalidproject_spec_invalid, notOrgOriginatornot_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

ConcernRESTMCP
TransportHTTP + JSONStreamable HTTP MCP
Error codessnake_case in JSON envelopecamelCase in tool error text
One-shot file uploadPUT .../file (307 redirect)declare_upload_files + presigned PUT
Spec authoring helpExternal (docs, agents)spec_authoring_guide, get_started
PollingClient calls GET .../statuswait_for_upload_session convenience wrapper

See also

PageDescription
Developer API - RESTHTTP endpoints and error codes
API keysCreation and authorization
Quickstart - APIEnd-to-end walkthrough
Edit this page on GitHub Last updated Jul 14, 2026