MCP / GETTING STARTED

Give your agent a news source.

Connect over the Model Context Protocol to search news by meaning, discover sources, and check your quota. Add Nearwire as a connector and sign in, or use an API key. Either way it's the same account and plan as the REST API.

Streamable HTTPOAuth sign-inAPI keysScoped tools

Connect your agent

Every client uses the same Streamable HTTP endpoint:

MCP endpoint
https://nearwire.dev/mcp

Sign in with Nearwire (recommended)

For connectors in chat apps such as Claude and ChatGPT, and for clients like Claude Code and VS Code that support MCP sign-in. No key to copy.

  1. In your client, add a custom connector or remote MCP server with the endpoint above. Leave any OAuth client ID and secret fields empty; the client registers itself.
  2. When prompted, sign in to Nearwire (or create an account) and review the permissions. Read-only access is requested by default, and you can untick anything you don't want to share.
  3. Approve, and you're returned to your client with the tools enabled. Ask your agent to search for a topic and cite the original article links.
Claude Code · terminal
claude mcp add --transport http nearwire https://nearwire.dev/mcp
# then run /mcp inside Claude Code and choose "Authenticate"

Connected apps appear under Dashboard → API keys → Connected apps, where you can disconnect them at any time. Access tokens last an hour and are refreshed by your client in the background.

API key

For scripts, CI jobs, SDK code and clients that let you set request headers.

  1. Generate a key in Dashboard → API keys. A dedicated key makes it easy to revoke one agent's access. New keys default to search:read and expire in 30 days.
  2. Add a remote MCP server with the endpoint above and set the HTTP header Authorization: Bearer nw_your_key. Keep the key in your client's secret storage or an environment variable.
  3. Connect and enable the tools permitted by your key.
Check the connection · terminal
curl "https://nearwire.dev/mcp" \
  -H "Authorization: Bearer $NEARWIRE_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Accept: application/json, text/event-stream" \
  -d '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2025-11-25","capabilities":{},"clientInfo":{"name":"connection-check","version":"1.0.0"}}}'

Set NEARWIRE_API_KEY in your environment first. This check returns server details and capabilities; an MCP client handles the remaining initialization steps automatically. There's no legacy SSE endpoint. Use HTTPS when connecting to a deployed server.

VS Code setup

For VS Code extension-host chat, add this to .vscode/mcp.json, merging it with any existing servers. The first connection prompts for your API key rather than storing it in the file.

.vscode/mcp.json
{
  "inputs": [
    {
      "type": "promptString",
      "id": "nearwire-api-key",
      "description": "Nearwire API key",
      "password": true
    }
  ],
  "servers": {
    "nearwire": {
      "type": "http",
      "url": "https://nearwire.dev/mcp",
      "headers": {
        "Authorization": "Bearer ${input:nearwire-api-key}"
      }
    }
  }
}

Run MCP: List Servers, start nearwire, and enable its tools in chat. Interactive input configurations are not forwarded to Agent Host sessions; those sessions need a configuration that supplies the key without an interactive prompt. See the VS Code configuration reference for that client’s options.

JavaScript / TypeScript agents

Install the official SDK with npm install @modelcontextprotocol/sdk. Save this example as client.mjs and run it with Node after setting NEARWIRE_API_KEY. The same client works inside a TypeScript agent.

client.mjs · official MCP SDK
import { Client } from "@modelcontextprotocol/sdk/client/index.js";
import { StreamableHTTPClientTransport } from "@modelcontextprotocol/sdk/client/streamableHttp.js";

const apiKey = process.env.NEARWIRE_API_KEY;
if (!apiKey) throw new Error("Set NEARWIRE_API_KEY first");

const client = new Client({ name: "news-research-agent", version: "1.0.0" });
const transport = new StreamableHTTPClientTransport(
  new URL(process.env.NEARWIRE_MCP_URL ?? "https://nearwire.dev/mcp"),
  { requestInit: { headers: { Authorization: `Bearer ${apiKey}` } } },
);

try {
  await client.connect(transport);
  console.log(await client.listTools());

  const result = await client.callTool({
    name: "search_news",
    arguments: { query: "renewable energy policy", since: "24h", limit: 5 },
  });
  if (result.isError) throw new Error(JSON.stringify(result.structuredContent));
  console.log(result.structuredContent ?? result.content);
} finally {
  await client.close();
}

The SDK negotiates the protocol, discovers tools, and supplies transport headers. Tools return both structuredContent for agents and JSON text for clients that display text results. For local development, set NEARWIRE_MCP_URL=http://localhost:5180/mcp. See the SDK client guide.

Available tools

search_news

Requires search:read. Find headlines and summaries with semantic, keyword, or hybrid ranking. Returns article IDs, titles, summaries, original URLs, authors, publication times, source IDs/names, similarity scores, and monthly usage. Each valid search consumes one search, even if no results match.

related_stories

Requires search:read. Supply articleId from a search result, plus optional limit, minScore, feedIds, since and until. Returns related coverage, excluding the original article, and consumes one search request.

monitoring_inbox

Requires monitoring:read. Read 30-day saved-query matches with optional queryId, unreadOnly and cursor filters. Returns matches, unread count and nextCursor; does not consume additional quota.

list_feeds

No arguments. Returns feeds, an array of active sources with id, title, url, and siteUrl. Use IDs to filter a search. Does not consume monthly search quota.

get_usage

No arguments. Returns plan, used, and limit for the account’s current UTC month. Does not consume monthly search quota.

Search arguments

ArgumentBehavior
queryNatural-language topic, 1–2,000 characters. Provide exactly one of query or embedding.
embeddingAlternative to query: a 1,536-number text-embedding-3-small vector.
modesemantic (default), keyword, or hybrid. Keyword and hybrid require query text; English full-text supports quoted phrases, OR, and minus exclusions.
requiredTerms / excludedPhrasesArrays of up to 10 literal substrings, 100 characters each. Case-insensitive title/description matching: every required entry must occur; any excluded entry rejects the article. These filters apply across all modes.
limit1–100 results; defaults to 10.
since / untilPublication range as ISO timestamps or relative times: "24h", "7d", "yesterday". Dates use UTC.
feedIdsOptional array of up to 100 source UUIDs from list_feeds.
minScoreOptional minimum cosine similarity, from -1 to 1, applied to both candidate lists in hybrid search.
search_news · arguments
{
  "query": "central banks cutting interest rates",
  "mode": "hybrid",
  "excludedPhrases": [
    "opinion"
  ],
  "since": "7d",
  "limit": 5
}

The score remains cosine similarity in every mode. rankingScore controls ordering: cosine in semantic mode, weighted English full-text rank in keyword mode, and reciprocal rank fusion in hybrid mode. Ranking scores are not probabilities or monitoring thresholds. All modes use indexed article embeddings and a cached query embedding to preserve cosine scores; each search costs one request.

These tools retrieve information; they cannot change your account, billing, or feeds. Publisher text should be treated as source material, and original links should be checked before relying on a result. A similarity score measures relevance, not factual accuracy.

Try these prompts

“Find news about renewable energy policy from the last 24 hours. Summarize five stories and cite their original URLs.”
“List available news sources, then find coverage of central bank rate cuts from the last week.”
“Check my remaining search quota, then research recent semiconductor export restrictions using Nearwire.”

Usage and limits

FREE
60 requests / minute

500 searches / month

STARTER
120 requests / minute

20,000 searches / month

BUSINESS
300 requests / minute

100,000 searches / month

MCP, REST, and authenticated dashboard requests share the same account request budget. Initialization, tool discovery, and notifications count toward the per-minute limit; searches and related-story lookups consume monthly quota. Limits use UTC fixed windows. Signup-month quotas are proportional to the time remaining until the next UTC month; mid-month tier changes adjust that allowance without resetting usage. Full quotas apply from the next 1st. Revoked or expired keys stop working on the next request.

HTTP responses include RateLimit and RateLimit-Policy. HTTP 429 means the request was throttled before a tool ran; wait for Retry-After seconds. A tool failure, including monthly quota exhaustion, returns isError: true with an error code, status, and retry delay when available. Read the tool result even when HTTP returns 200. Monthly search usage is also available in X-Usage-Monthly-* headers.

Troubleshooting

401 · unauthorized
With sign-in, reconnect or re-authenticate in your client; this also happens after you disconnect the app in your dashboard. With an API key, check the Bearer header and use an active key, not your password or a dashboard cookie. Create a replacement key if it was revoked.
403 · origin or host rejected
Use the configured public endpoint. Browser clients need their exact origin in the server’s MCP allowlist; native and server clients typically omit Origin. Operators configure APP_URL and, when needed, MCP_ALLOWED_ORIGINS.
405 · GET or DELETE
The endpoint is stateless and serves JSON responses to POST. A client may probe for SSE and receive 405; use Streamable HTTP, and do not configure a legacy /sse URL.
406 or 415 · transport headers
POST JSON with Content-Type: application/json and Accept: application/json, text/event-stream. The official SDK sets these for you.
400 or 413 · invalid request
Send a single JSON-RPC message per request, use the negotiated MCP protocol version, and keep request bodies within 64 KiB. Check tool arguments and time ranges.
No results
Widen the date range, remove source or score filters, or rephrase the topic. Coverage depends on currently indexed feeds.
Manage keys and connected apps