Skip to content

Add integration test that starts the MCP server and calls tools #5

@raphasouthall

Description

@raphasouthall

The current test suite covers the underlying logic (search, graph, triples etc.) but does not test the MCP server layer (`src/neurostack/server.py`) end-to-end. This means a bug in how a tool marshals its arguments or formats its JSON response could go undetected.

Add an integration test that:

  1. Spins up the MCP server against a test fixture vault
  2. Calls at least `vault_search`, `vault_stats`, and `vault_prediction_errors` via the MCP tool interface
  3. Asserts the response structure is correct (keys present, types correct)

Where to look:

  • `tests/` — existing test structure and fixtures
  • `src/neurostack/server.py` — the MCP tool definitions
  • Look at how existing tests set up the database/vault fixture and replicate that pattern

Notes:

  • You don't need to test over the network — the MCP tools are regular Python functions decorated with `@mcp.tool()`. You can call them directly in tests after importing from `server.py`, bypassing the stdio transport.
  • Check whether there is already a fixture vault in `tests/` or `vault-template/` you can reuse.

Acceptance criteria:

  • At least one integration test file under `tests/` that imports and calls MCP tool functions directly
  • Tests cover `vault_search`, `vault_stats`, and `vault_prediction_errors`
  • Each test asserts response is valid JSON and contains expected top-level keys
  • Tests pass in CI (`pytest tests/`)
  • No new external dependencies introduced

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions