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
- 参考文档references/configuration.md4.3 KB
- 参考文档references/mcp-server.md5.5 KB
- 参考文档references/rest-api.md5.4 KB
- 参考文档references/troubleshooting.md6.9 KB
- 脚本scripts/validate_server_config.py7.9 KB
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--configfor aliases/API keys, and readreferences/rest-api.mdfor endpoints and HTTP parameters. - Server YAML: Validate aliases before startup with
python scripts/validate_server_config.py server.yaml; readreferences/configuration.mdfor schema and examples. - Locked-down deployment: Use
--config server.yaml --no-prebuilt-indexes, configureapi_keys, tune cache sizes, and use log-file flags. - MCP integration: Use
python -m pyserini.server.mcpfor local stdio clients or--transport http --port 8000for remote/forwarded clients; readreferences/mcp-server.md. - Troubleshooting: For invalid aliases, auth failures, missing
faiss, missing eval jars, stdio-vs-HTTP mismatches, or disabled prebuilt indexes, readreferences/troubleshooting.md.
Default REST Setup
-
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 -
Validate the config without opening indexes:
python scripts/validate_server_config.py server.yaml -
Start the REST server:
python -m pyserini.server.rest --host 127.0.0.1 --port 8081 --config server.yaml --no-prebuilt-indexes -
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
-
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"] } } } -
For a remote or forwarded MCP server, start HTTP transport:
python -m pyserini.server.mcp --transport http --port 8000 --config server.yaml -
Point the MCP client at
http://127.0.0.1:8000/mcpafter forwarding or exposing the port safely.
What to Read Next
references/configuration.mdfor the server YAML schema, alias types, API keys, cache flags, and logging flags.references/rest-api.mdfor REST endpoints, parameters, response shape, OpenAPI, auth, and status codes.references/mcp-server.mdfor MCP transports, client config snippets, tool schemas, and remote setup.references/troubleshooting.mdfor config, auth, missing dependency/resource, transport, and prebuilt-index failures.scripts/validate_server_config.py --helpfor safe config validation before starting either server.
Safety Defaults
- Prefer
--no-prebuilt-indexeswith 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>andX-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, andef_searchcontrol. - Do not run long model downloads or open large indexes while diagnosing server config; validate YAML and imports first.
04 同仓库更多 Skills
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.
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.
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.
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.
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.
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).