Skip to content

feat: add home-based configuration and tool settings - #180

Open
maralbahari wants to merge 5 commits into
vllm-project:mainfrom
EmbeddedLLM:agentic-api-home-config
Open

feat: add home-based configuration and tool settings#180
maralbahari wants to merge 5 commits into
vllm-project:mainfrom
EmbeddedLLM:agentic-api-home-config

Conversation

@maralbahari

@maralbahari maralbahari commented Aug 14, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Add an Agentic API home directory, configurable through AGENTIC_API_HOME and defaulting to ~/.agentic-api.
  • Move the default SQLite database from the current working directory to $AGENTIC_API_HOME/agentic_api.db.
  • Add config.toml loading and first-run generation:
    • creates the home directory when needed;
    • writes configuration with 0640 permissions on Unix (group-readable so a container restart under a
      rotated arbitrary UID sharing the image's root group can still read it);
    • never overwrites an existing configuration;
    • stores non-secret settings and environment-variable references instead of API-key values.
  • Add typed configuration for:
    • llm_api_base and database_url;
    • [web_search] provider URL and api_key_env;
    • [mcp] request-declared host allowlists;
    • HTTP and stdio [mcp_servers.<label>];
    • configured MCP allowed_tools and require_approval;
    • Messages API gateway tool aliases.
  • Resolve runtime settings using CLI/process environment precedence over file configuration.
  • Support operator-configured MCP servers that requests can select using only server_label.
  • Treat configured MCP allowed_tools as a policy ceiling:
    • requests may narrow the configured tool set;
    • requests cannot expand it;
    • configured connection details cannot be overridden with server_url.
  • Fail a request immediately with a clear error when an MCP declaration is invalid (for
    example, attempting to override a gateway-configured server's server_url), instead of
    silently absorbing it into per-server discovery-failure metadata, which could otherwise leave
    tool_choice pointed at zero available tools and surface as an opaque upstream error.
  • Preserve request-declared MCP servers for self-contained requests and cassette recording.
  • Remove the one-time MCP environment allowlist cache and pass the effective allowlist explicitly into request URL validation.
  • Configure containers to use /var/lib/agentic-api as AGENTIC_API_HOME.
  • Add scripts/smoke-mcp.sh, which verifies MCP discovery and completed say_hello and sum calls through a running gateway.
  • Document the home directory, typed configuration, secret handling, configured MCP servers, precedence rules, and smoke-test workflow.

The default database location is a behavior change. Existing databases in the working directory are not moved automatically; deployments can continue using them by setting DATABASE_URL explicitly.

Test Plan

  • cargo test -- --test-threads=2 passes across the workspace (357 passed / 3 ignored
    Postgres-only in agentic-server-core, plus all other crates).
  • Fixed 4 agentic-server-core::tool::registry unit tests that combined a
    gateway-configured MCP server with a request declaration that also set server_url;
    updated their fixtures to declare the configured path by server_label alone, matching
    the policy-ceiling behavior this PR adds.
  • Added a regression path so an invalid MCP declaration (for example, a request trying to
    override a configured server's server_url) fails the request immediately instead of
    being silently absorbed into discovery-failure metadata.
  • cargo test -p agentic-server-core --test mcp_tool_test (8/8) after re-recording the
    gateway MCP cassettes; gateway output still matches the OpenAI reference cassettes.
  • docker build succeeds end-to-end (release compile stage + Debian runtime stage).

Signed-off-by: maral <maralbahari.98@gmail.com>
Signed-off-by: maral <maralbahari.98@gmail.com>
Signed-off-by: maral <maralbahari.98@gmail.com>
…ainer restarts

Signed-off-by: maral <maralbahari.98@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant