AGENT SKILL

serving-and-agent-tools

Run and troubleshoot Pyserini REST and MCP servers, server YAML configs, OpenAPI clients, API keys, caches, and agent integrations.

License 许可
Apache-2.0
最近更新
2026-09-03
Stars
★ 351
Forks
27

01 前言 Front Matter

name
serving-and-agent-tools
license
Apache 2.0
metadata
{ "disco-role": "operating" }
description
Run and troubleshoot Pyserini REST and MCP servers, server YAML configs, OpenAPI clients, API keys, caches, and agent integrations.
disable-model-invocation
true

02 资源文件 5

03 SKILL.md 正文

Serving and Agent Tools

Use this sub-skill when a task involves the Pyserini REST server, FastAPI/OpenAPI behavior, MCP server setup, Claude/Cursor MCP configuration, server YAML aliases, API keys, cache sizes, load shedding, server logs, or errors from pyserini.server.rest or pyserini.server.mcp.

Do not use this sub-skill for building Lucene indexes, interpreting BM25/search semantics, creating dense embeddings, choosing Faiss encoders, package installation, or source checkout resource builds. Route those to ../index-search-fetch/SKILL.md, ../dense-encoding/SKILL.md, ../install-and-runtime/SKILL.md, or ../repo-development/SKILL.md as appropriate.

Quick Routing

  • REST server: Start with python -m pyserini.server.rest, add --config for aliases/API keys, and read references/rest-api.md for endpoints and HTTP parameters.
  • Server YAML: Validate aliases before startup with python scripts/validate_server_config.py server.yaml; read references/configuration.md for schema and examples.
  • Locked-down deployment: Use --config server.yaml --no-prebuilt-indexes, configure api_keys, tune cache sizes, and use log-file flags.
  • MCP integration: Use python -m pyserini.server.mcp for local stdio clients or --transport http --port 8000 for remote/forwarded clients; read references/mcp-server.md.
  • Troubleshooting: For invalid aliases, auth failures, missing faiss, missing eval jars, stdio-vs-HTTP mismatches, or disabled prebuilt indexes, read references/troubleshooting.md.

Default REST Setup

  1. Create a local server config with explicit aliases:

    indexes:
      local_sparse: ./indexes/demo-lucene
      local_faiss:
        path: ./indexes/demo-faiss
        index_type: faiss
        base_index: local_sparse
        encoder: BAAI/bge-base-en-v1.5
    api_keys:
      - replace-with-a-secret-token
    
  2. Validate the config without opening indexes:

    python scripts/validate_server_config.py server.yaml
    
  3. Start the REST server:

    python -m pyserini.server.rest --host 127.0.0.1 --port 8081 --config server.yaml --no-prebuilt-indexes
    
  4. Search with one of the configured aliases:

    curl -H "Authorization: Bearer replace-with-a-secret-token" \
      "http://127.0.0.1:8081/v1/local_sparse/search?query=information%20retrieval&hits=5"
    

Default MCP Setup

  1. For a local stdio MCP client, configure the client to run the same Python executable that imports Pyserini:

    {
      "mcpServers": {
        "mcpyserini": {
          "command": "python",
          "args": ["-m", "pyserini.server.mcp", "--config", "server.yaml"]
        }
      }
    }
    
  2. For a remote or forwarded MCP server, start HTTP transport:

    python -m pyserini.server.mcp --transport http --port 8000 --config server.yaml
    
  3. Point the MCP client at http://127.0.0.1:8000/mcp after forwarding or exposing the port safely.

What to Read Next

  • references/configuration.md for the server YAML schema, alias types, API keys, cache flags, and logging flags.
  • references/rest-api.md for REST endpoints, parameters, response shape, OpenAPI, auth, and status codes.
  • references/mcp-server.md for MCP transports, client config snippets, tool schemas, and remote setup.
  • references/troubleshooting.md for config, auth, missing dependency/resource, transport, and prebuilt-index failures.
  • scripts/validate_server_config.py --help for safe config validation before starting either server.

Safety Defaults

  • Prefer --no-prebuilt-indexes with explicit aliases for shared or public deployments so arbitrary local paths and prebuilt downloads are not accepted.
  • Use API keys for any network-exposed REST server; both Authorization: Bearer <token> and X-API-Key: <token> are accepted.
  • Treat REST as GET-only and string-query-only; use MCP or direct Pyserini APIs for multimodal queries, query_generator, encoder, and ef_search control.
  • Do not run long model downloads or open large indexes while diagnosing server config; validate YAML and imports first.

04 同仓库更多 Skills

VectorSpaceLab
VectorSpaceLab/AREX-Skill

passnet-triton-opt

Make a single PassNet Triton kernel fast AND numerically faithful: performance model (when a replacement can win at all), block/grid/warp tuning, autotune policy, launch overhead, and per-op numeric recipes to pass the dtype baseline tolerances. Use when a pass matches and is correct but speedup below expected, or when correctness fails by small numeric margins.

★ 351
VectorSpaceLab
VectorSpaceLab/AREX-Skill

passnet-solve

END-TO-END playbook for solving one PassNet sample: analyze the computation graphs, decide the optimization strategy (what to fuse, what to replace, what to leave alone), drive the iteration loop, and maximize the sample score. This is the ENTRY skill — invoke it first for any PassNet optimization task; it tells you when to use passnet-pattern-fusion, passnet-triton-opt and passnet-feedback.

★ 351
VectorSpaceLab
VectorSpaceLab/AREX-Skill

passnet-skill

PassNet GPU kernel optimization via compiler passes. Design and implement Triton-based optimization passes, create pass files under ./pass_dir/, self-evaluate with pass_evaluator, and iterate to maximize GPU speedup.

★ 351
VectorSpaceLab
VectorSpaceLab/AREX-Skill

passnet-pattern-fusion

Author PassNet pass files: write patterns that actually MATCH the FX graph, pick fusion regions (which ops to absorb into one Triton kernel), and structure multi-pass submissions with the mandatory shared-dispatch architecture. Use when creating or fixing pattern()/replacement_args()/replacement_func() files, when a pass "failed to match", or when deciding how to fuse multiple kernels/ops.

★ 351
VectorSpaceLab
VectorSpaceLab/AREX-Skill

passnet-orchestrate

Round/batch planning and decision support for PassNet graph optimization. Use for multi-sample triage, worker allocation, eval-budget policy, and post-eval keep/revert decisions. For solving one concrete sample end to end, use passnet-solve as the entry skill; consult this skill only when you need broader planning or a specific decision gate.

★ 351
VectorSpaceLab
VectorSpaceLab/AREX-Skill

passnet-feedback

Fast, deterministic feedback for PassNet work: pre-flight pattern/match verification WITHOUT burning a GPU evaluation, per-node bottleneck analysis of a sample's graphs, and eval-log parsing into per-variant status + estimated score + failure classification. Use BEFORE every GPU evaluation (check_pattern), at the START of a sample (analyze_graph), and AFTER every evaluation (parse_eval_log).

★ 351