sparka home

API reference

MCP

The MCP endpoint and the OAuth discovery documents MCP clients read.

MCP endpoint (JSON-RPC)

POST /mcp

Credential: None, or Secret key (Authorization: Bearer spk_live_…), or Secret key in X-API-Key, or MCP sign-in (Authorization: Bearer oat_…)

Stateless, POST-only MCP (streamable HTTP, JSON responses). Tools are described in the MCP page. initialize, tools/list, resources/*, prompts/*, ping and the public tools work without a credential. 401 with WWW-Authenticate is returned only when a protected tools/call has no credential, or any credential is unknown, revoked or expired; all other failures are tool errors with 200. GET/DELETE → 405.

Parameters

NameInTypeDescription
MCP-Protocol-Versionheaderstring
Mcp-MethodheaderstringWhen present, must equal the body's method.
Mcp-NameheaderstringWhen present, must equal the body's params.name / params.uri.

Request body

application/json

Request body of POST /mcp
FieldTypeDescription
jsonrpc required2.0
idstring | integer | null
methodstring
paramsobject
resultobject
errorobject
error.code requiredinteger
error.message requiredstring
error.dataany

Responses

200 JSON-RPC response.

200 response of POST /mcp
FieldTypeDescription
jsonrpc required2.0
idstring | integer | null
methodstring
paramsobject
resultobject
errorobject
error.code requiredinteger
error.message requiredstring
error.dataany

202 JSON-RPC notification accepted (empty body).

StatusError codes
400Header/body mismatch (JSON-RPC error -32020) or malformed JSON-RPC.
401Missing credential on a protected tool call, or an invalid credential.

Protected resource metadata (RFC 9728)

GET /.well-known/oauth-protected-resource

Credential: None

Same body as /.well-known/oauth-protected-resource/mcp. Cache-Control: public, max-age=300.

Responses

200 Metadata.

200 response of GET /.well-known/oauth-protected-resource
FieldTypeDescription
resource requiredstringFormat uri. Example https://sparka.io/mcp.
authorization_servers requiredarray of string
scopes_supported requiredarray of string
bearer_methods_supported requiredarray of string
resource_namestring
resource_documentationstringFormat uri.
StatusError codes
429rate_limited, with retry_after_s.

Protected resource metadata for /mcp (RFC 9728)

GET /.well-known/oauth-protected-resource/mcp

Credential: None

Cache-Control: public, max-age=300.

Responses

200 Metadata.

200 response of GET /.well-known/oauth-protected-resource/mcp
FieldTypeDescription
resource requiredstringFormat uri. Example https://sparka.io/mcp.
authorization_servers requiredarray of string
scopes_supported requiredarray of string
bearer_methods_supported requiredarray of string
resource_namestring
resource_documentationstringFormat uri.
StatusError codes
429rate_limited, with retry_after_s.

Authorization server metadata (RFC 8414)

GET /.well-known/oauth-authorization-server

Credential: None

Cache-Control: public, max-age=300. There is no /.well-known/openid-configuration.

Responses

200 Metadata.

200 response of GET /.well-known/oauth-authorization-server
FieldTypeDescription
issuer requiredstringFormat uri.
authorization_endpoint requiredstringFormat uri.
token_endpoint requiredstringFormat uri.
registration_endpoint requiredstringFormat uri.
revocation_endpoint requiredstringFormat uri.
scopes_supportedarray of string
response_types_supported requiredarray of string
response_modes_supportedarray of string
grant_types_supported requiredarray of string
token_endpoint_auth_methods_supported requiredarray of string
revocation_endpoint_auth_methods_supportedarray of string
code_challenge_methods_supported requiredarray of string
client_id_metadata_document_supportedboolean
authorization_response_iss_parameter_supportedboolean
service_documentationstringFormat uri.
StatusError codes
429rate_limited, with retry_after_s.