Api Server Mcp
FreeNo executable scriptsNot checkedChange REST routes, middleware, cache endpoints, server startup or MCP tools.
by xberg-io★ 9,642 GitHub starsAbout this skill
API Server & MCP Protocol
Axum server for document extraction, plus the rmcp Model Context Protocol surface
Locations: crates/xberg/src/api/ (router.rs, handlers.rs, startup.rs, types.rs,
error.rs, jobs.rs) and crates/xberg/src/mcp/. There is no api/server.rs.
REST routes
Registered in api/router.rs, all on one Router:
| Route | Handler |
|---|---|
POST /extract |
extract_handler — multipart files, URL fields, or JSON; builds ExtractInput |
POST /extract-async |
extract_async_handler — queues a job |
GET/DELETE /jobs/{job_id} |
job_status_handler / cancel_job_handler |
POST /detect |
detect_handler |
GET /formats |
formats_handler |
GET /health |
health_handler |
GET /info, GET /version |
info_handler, version_handler |
GET /cache/stats |
cache_stats_handler |
DELETE /cache/clear |
cache_clear_handler |
GET /cache/manifest, POST /cache/warm |
cache_manifest_handler, cache_warm_handler |
PUT /process, POST /v1/convert/file |
openweb_external_handler, openweb_docling_handler (api/openweb.rs) |
GET /openapi.json |
openapi_schema_handler (feature api) |
GET /metrics |
metrics_handler (feature prometheus) |
There is no POST /extract-url (URL ingestion is a field on ExtractInput passed to
/extract) and no POST /batch (batch is /extract-async + /jobs/{job_id}).
Middleware, in order: DefaultBodyLimit::max(limits.max_request_body_bytes) +
RequestBodyLimitLayer (default 100 MB), CORS, request-id, compression, catch-panic,
sensitive-header stripping, tracing. CORS is denied by default; XBERG_CORS_ORIGINS lists
allowed origins (* allows all). XBERG_API_TOKEN enables bearer auth (api/auth.rs) on every
route except /health; a non-loopback bind without a token is refused unless
XBERG_ALLOW_UNAUTHENTICATED is set.
Caching
crates/xberg/src/cache/ — GenericCache is a filesystem-backed store with LRU-style
eviction, not an in-memory map. Keys are BLAKE3 content hashes (blake3_hash_bytes /
blake3_hash_file, cache/utilities.rs). Eviction is bounded by max_age_days,
max_cache_size_mb and min_free_space_mb — there is no entry-count limit.
Error handling
ApiError is a struct, not an enum: { status: StatusCode, body: ErrorResponse }
(api/error.rs). Status comes from the constructor, not a variant:
validation()→ 400,unprocessable()→ 422,internal()→ 500,bad_gateway()→ 502From<XbergError>picks one viaerror.api_status_category()(Validation/Unprocessable/Internal)
There is no 404, 413 or 503 path with a named variant. Do not match on ApiError.
MCP
crates/xberg/src/mcp/. Transport is a single nested rmcp streamable-HTTP service —
Router::new().nest_service("/mcp", http_service) — not a set of /mcp/* REST paths.
Tools, resources and prompts are JSON-RPC methods on it. Stdio transport serves the same
router over stdin/stdout.
Tools (9)
extract, extract_batch, detect_mime_type, list_formats, cache_stats, cache_clear,
get_version, cache_manifest, cache_warm. The set is pinned by
test_all_tools_are_registered in mcp/server.rs. There is no get_capabilities.
extract, extract_batch and cache_warm are task-eligible (TASK_ELIGIBLE_TOOLS,
mcp/server.rs).
Resources
mcp/resources.rs: xberg://formats, xberg://models, xberg://languages/ocr, plus
xberg://presets/embeddings behind #[cfg(feature = "embeddings")].
Prompts (3)
mcp/prompts.rs: extract_document, extract_with_ocr, semantic_search.
Environment variables
There is no .env.example. Server-side vars are read in core/server_config/env.rs:
XBERG_HOST,XBERG_PORT(defaults127.0.0.1:8000)XBERG_MAX_REQUEST_BODY_BYTES,XBERG_MAX_MULTIPART_FIELD_BYTES(both default 100 MB)XBERG_CORS_ORIGINS(comma-separated)
Extraction-side vars are documented on ExtractionConfig::apply_env_overrides
(core/config/extraction/env.rs) — XBERG_OCR_BACKEND, XBERG_OCR_LANGUAGE,
XBERG_CHUNKING_MAX_CHARS, XBERG_CACHE_ENABLED, XBERG_LLM_*, and others. Read that doc
comment rather than guessing a name.
Critical Rules
REST
- Validate uploads — MIME type, size, magic bytes; never trust the filename.
- Size limits are configurable — always read
limits.max_request_body_bytes, never hardcode. - Errors must be actionable — include the operation and a remediation hint in
ErrorResponse. - CORS is denied by default — browser clients must be listed in
XBERG_CORS_ORIGINS. - Long work goes to
/extract-async— do not block a request thread on a multi-minute extraction.
MCP
- Register a new tool in
mcp/server.rsand extendtest_all_tools_are_registered— the test is the contract. - Feature-gate resources the same way
xberg://presets/embeddingsis — a missing feature must not break `resou
Install Api Server Mcp in Claude Code & Claude Desktop
Sign up to install this skill
Create a free account to reveal the install command and save the skill to your library.
- Reveal the one-line install command
- Save skills to your synced library
- Get notified when skills update
Allowed tools
Tools this skill is permitted to call.
No restriction — this skill can use any tool.
Bundled files
FAQ
What does the Api Server Mcp skill do?
Change REST routes, middleware, cache endpoints, server startup or MCP tools.
How do I install the Api Server Mcp skill?
Copy the skill folder into ~/.claude/skills (the Claude Code tab above does this in one command), or install it as a plugin.
Does the Api Server Mcp skill run scripts?
No, this skill is instructions only (SKILL.md) with no executable scripts.
Related skills
mcp-builder
Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when…
by Anthropicclaude-api
Reference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER…
by Anthropicalgorithmic-art
Creating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code…
by Anthropicmcp-integration
This skill should be used when the user asks to "add MCP server", "integrate MCP", "configure MCP in plugin", "use .mcp.json", "set up Model Context…
by Anthropic