> SpecStream is the live web data engine for teams and agents. This is the Markdown copy of https://specstream.ai/docs/integrations/keen-code. Every page, with what SpecStream does and costs: https://specstream.ai/llms.txt

# Keen Code

Add one entry to `~/.keen/mcp/configs.json`, and Keen Code can search the live web, read whole pages and documents, and ask for structured data. These sit next to its own `web_fetch`.

[SpecStream for Keen CodeCoding agents](https://specstream.ai/integrations/keen-code.md)

## What you need

-   Keen Code, the `keen` command. Install it with `npm install -g keen-code`, or with the install script in [Keen Code's README (opens in a new tab)](https://github.com/mochow13/keen-code).
-   A SpecStream account. New accounts start with $10 of credit, no card. [Create one](https://specstream.ai/signup?utm_source=keen-code).

1.  1

    ## 1. Create a SpecStream API key

    In SpecStream, open [Agents & API](https://specstream.ai/workspace/agents?tab=keys&utm_source=keen-code), choose **API keys**, then **Create API key**, and give it a spending limit above 0. Copy the key when it is shown. It is not shown again.

2.  2

    ## 2. Add SpecStream to ~/.keen/mcp/configs.json

    When Keen starts, it reads its MCP servers from `~/.keen/mcp/configs.json`. SpecStream serves Streamable HTTP. Keen uses that transport for any entry with a `url` and no `command`. With `"type": "api_key"` and no `header`, Keen sends the key as `Authorization: Bearer <key>`, which is what SpecStream expects.

    If the file already lists servers, add the `specstream` entry inside the same `servers` object. Keen does not read environment variables in this file, so the key is stored in it as you typed it. Keep the file private, for example with `chmod 600 ~/.keen/mcp/configs.json`.

    ~/.keen/mcp/configs.json

    ```json
    {
      "servers": {
        "specstream": {
          "url": "https://api.specstream.ai/mcp",
          "auth": {
            "type": "api_key",
            "key": "YOUR_SPECSTREAM_KEY"
          }
        }
      }
    }
    ```

3.  3

    ## 3. Restart Keen and check the server

    Keen connects to every configured server at startup and does not reload the file while it runs, so restart it after each edit. Then run `/mcp status`. The `specstream` server should show `connected`. Keen also writes a skill named `mcp:specstream` that lists each SpecStream tool with its schema, so the agent reads those details only when it needs them.

    In Keen

    ```text
    /mcp status
    ```

4.  4

    ## 4. Ask for live web data

    Ask in plain words. Keen calls SpecStream through its `call_mcp_tool` tool and asks for your approval before each call:

    In a Keen session

    ```text
    Find the latest stable release of Go, read its release notes, and list the changes that affect go.mod.
    ```

## Sign in with OAuth instead of a key

Replace the `auth` block with `{ "type": "oauth" }`, restart Keen, and run `/mcp connect specstream`. Keen registers itself with SpecStream and opens the sign in page in your browser. It then waits for the reply at `http://localhost:1456/auth/mcp/callback`. Keen stores the token in its auth store and reuses it at the next start. Until you connect, `/mcp status` shows `auth_required`. Requests run on the account that signed in.

## What the agent calls

Each call goes through `call_mcp_tool` with `"server": "specstream"`, the tool's name and its arguments.

-   `search_web` answers a question from the live web with up to 10 results, each with its URL. It takes `{"q": "<the question>"}`.
-   `read_pages` returns the main text of up to 20 pages or documents (PDF, Word, Excel), read live. It takes `{"urls": ["<url>"]}`.
-   `compile` turns a request for many records into its conditions and the facts to bring back, and `quote_capacity_work` prices it. Neither one costs anything.
-   `authorize_capacity_work` starts a Deep Search run only with `confirm_max_cents` equal to the maximum you approved. `get_find` tracks the run, and `list_find_rows` reads the rows, each value with its source URL and read time.

## Next to the built in web\_fetch

Keen Code ships `web_fetch`, which reads a URL you already have. It has no web search tool. With SpecStream added, `search_web` finds the pages for a question, and `read_pages` reads up to 20 pages or documents in one call, including PDF, Word and Excel files. The Search API is the most accurate web search API on SimpleQA Verified and WideSearch. The scores and the method are on [the benchmarks page](https://specstream.ai/benchmarks.md).

## Approvals in Keen

Keen asks for your approval before every `call_mcp_tool` call. A search or a page read is charged to your balance as soon as it runs. A Deep Search run has a second gate: it starts only after you approve the maximum that SpecStream quotes.

## For one project only

Keen does not look for an MCP file inside a project. Put the entry in a file of its own and start Keen with `keen --mcp-config ./mcp-config.json`. For that session, the file replaces `~/.keen/mcp/configs.json` and is not merged with it. Keen stops with an error if the file is missing or invalid. Headless runs take the same flag: `keen run --mcp-config ./mcp-config.json "<prompt>"`.

## If it does not connect

`/mcp status` shows each server's state and its last error. `auth_failed` means SpecStream refused the key, so check that you copied it whole and that it has not been revoked. `disconnected` means Keen could not reach the address. A single invalid entry in `configs.json` stops every MCP server from loading. If `call_mcp_tool` is missing, check the JSON first.

## Cost

Each `search_web` call is one Search API search at $5 per 1,000 searches of up to 10 results. Each page `read_pages` reads costs $0.80 per 1,000 pages, and a page with no text is not charged. Both come out of your balance with no quote, up to the key's spending limit. A Deep Search run is priced per row and starts only after you approve its maximum. New accounts start with $10 of credit, no card. See [how billing works](https://specstream.ai/docs/billing.md).

## Disconnect

Remove the `specstream` entry from `~/.keen/mcp/configs.json` and restart Keen. Revoke the key under **Agents & API** in SpecStream. Send questions to [support@specstream.ai](mailto:support@specstream.ai).

## More

[SpecStream for Keen Code](https://specstream.ai/integrations/keen-code.md) covers what it does in Keen Code on one page. Every other tool has its guide in [Connect your tools](https://specstream.ai/docs/integrations.md). You see the most a request can cost before it starts, and the matches are paid from your balance. [Billing](https://specstream.ai/docs/billing.md) has the details. For help, email [support@specstream.ai](mailto:support@specstream.ai).
