Troubleshooting

Guide

Symptoms, causes and fixes for common problems: tools that do not appear, install and build failures, failing tool calls, HTTP 403 and connection errors, Docker and deployment health checks, and where to find logs.

Status
stable
Trust tier
unverified
Generated
claude-code/claude-opus-5-5, 2026-12-05
Tags
troubleshootingerrorslogshttpdocker

This page lists common problems with the NSF Awards MCP server, grouped by where they show up: in the MCP client, during install and build, in tool results, in HTTP mode, and in containers and deployments. Each entry gives the symptom, the cause and the fix.

Most problems become clear once you see the server’s stderr. Run the server by hand with debug logging (see Logs) before you change anything else.

Tools do not appear

The client does not list the “nsf-awards” server or its five tools.1

  1. Validate the config file’s JSON: no trailing commas, straight quotes.
  2. Check the path: ls /absolute/path/to/nsf-awards-mcp/build/index.js. If it is missing, run npm run build. The path must be absolute.
  3. Check that node --version is 20 or later and that the client can find node. If it cannot, put the full path of Node in command (which node or where.exe node).
  4. Quit and reopen the client. A reload is often not enough.

Connecting clients has the config entry for each client.

The server starts and then exits

Run it by hand to see its stderr:1

LOG_LEVEL=debug node /absolute/path/to/nsf-awards-mcp/build/index.js

A healthy server logs Starting NSF Awards MCP server with "transport":"stdio" and the version, then waits for a client on stdin (Ctrl+C stops it).1 If you see a missing-module error, run npm install and npm run build. If Node is older than 20, upgrade it.2

An uncaught exception or unhandled promise rejection is logged (Uncaught exception or Unhandled rejection) and the process exits with code 1.3

Install and build problems

Symptom Fix
npm install fails Check node --version: package.json requires Node 20 or later.4
EACCES permission errors from npm Do not use sudo. Fix npm’s prefix, or use a version manager.5
Corrupt install rm -rf node_modules && npm install.5
npm run build fails Run npm run type-check to see the TypeScript errors. After you pull a new version, install dependencies again first.5
Cannot find module at startup, or MODULE_NOT_FOUND for build/index.js Run npm run build: the client runs build/index.js, not src/. Check that the path in the client config is absolute.5 6
Cannot find module '@modelcontextprotocol/server' rm -rf node_modules && npm install.6
node: command not found from the client Use the full path to Node as command (which node or where.exe node).5

Tool calls fail

A failed tool call returns isError: true with a message in content[0].text.1 First check that the NSF API is reachable from the machine that runs the server:1

curl "https://www.research.gov/awardapi-service/v1/awards.json?keyword=wildfire&rpp=1"

The client retries network errors, timeouts, HTTP 429 and HTTP 5xx responses with exponential backoff (1 s, then 2 s), up to NSF_API_MAX_RETRIES times (default 2). It does not retry a request that the MCP client cancelled. Each attempt times out after NSF_API_TIMEOUT_MS (default 15000 ms).7 The messages you can see:

Message Cause and fix
No NSF award found with ID <id> The award does not exist. Check the number.8
No Project Outcomes Report for award <id>: the award does not exist, is still active, or predates outcome reports Only completed awards from roughly 2010 on have a report. Check hasOutcomesReport in the award record first.9 1
AwardAPI-002: Invalid parameter(s) ... The NSF API rejected a parameter. The API reports this as HTTP 200 with a notice, and the server turns it into an error.7 2
Search matches <n> awards, more than the 250 that can be merged; narrow it (e.g. add firstName, institution, stateCode or a date range) search_by_pi with includeCoPIs matched too many awards. Add the suggested filters.7
NSF API search failed (HTTP 503), NSF API award lookup failed (timed out), NSF API project outcomes lookup failed (...) The request failed after all retries. The text in parentheses is the HTTP status, timed out, or the network error. On slow networks, raise NSF_API_TIMEOUT_MS.7 1
NSF API award lookup failed (HTTP 404) Not a missing award (the API answers those with HTTP 200 and an empty list). The API URL is wrong or the API has moved: check NSF_API_BASE_URL. A 404 is not retried.7
NSF API search was cancelled The client cancelled the call.7
Unexpected NSF API response format, Failed to parse NSF API response, Unexpected NSF API response (no "response" object, content-type <type>) The API sent a body the client cannot read, or one that is not an NSF reply (an HTML error page, {}, a proxy’s JSON error). Check the API with the curl command above, and NSF_API_BASE_URL.7
Input validation error: Invalid arguments for tool <tool>: ... The arguments failed the input schema before any API call: a bad date, a reversed range, limit outside 1 to 25, a non-numeric awardId, or a missing required field.1 2
keyword has an unmatched double quote, keyword has an unmatched parenthesis, keyword can hold only one quoted phrase ... The API fails on an unmatched quote or parenthesis, and reads everything from the first quote to the last as one phrase. Quote one phrase and join other words with uppercase AND, for example "wildfire smoke" AND health.10

For resources, an unknown award or a missing report returns a resource-not-found error (No NSF award with ID <id>, No Project Outcomes Report for award <id>).11 Errors describes every error in detail.

Results are empty or too broad

Symptom Fix
A name search returns nothing Drop the first name, or check the institution’s official name.1 Institutions are matched as phrases, so use the full name (“Massachusetts Institute of Technology”, not “MIT”).
A first-name search returns other people’s awards A first name on its own is fuzzy. Pair it with a last name.1
A piLastName search also returns longer surnames (Roos finds Roosevelt) piLastName is a prefix match. Use pdPIName with the full name, or search_by_pi, which sends pdPIName (plus piLastName for a surname alone).12
A keyword search returns too much Words separated by spaces match any of them. Join them with uppercase AND to require all (CAREER AND "machine learning").10
A city search matches other cities awardeeCity matches any word. Pair it with a state code.2
capped: true, or a total of 10000+ The API counts and serves at most 10,000 matches. Narrow the search with a keyword, state or date range.1
A page repeats or skips one award Awards with the same start date can change order between calls. This is API behavior.2

The NSF API search parameters page explains name and phrase matching in full.

HTTP mode

Symptom Cause and fix
403 on /mcp The Host or Origin header is not allowed. Connect with localhost or 127.0.0.1, or set MCP_ALLOWED_HOSTS or MCP_ALLOWED_ORIGINS.5 The body is a JSON-RPC error with code -32000.13
403 on every request through nginx or another proxy The proxy passes the public Host header, and a loopback-bound backend accepts only localhost names. Set MCP_ALLOWED_HOSTS to the public host name.14
404 with {"error":"Not found; the MCP endpoint is /mcp"} Wrong path. The MCP endpoint is exactly /mcp.15
405 on /health Only GET is allowed there.15
Connection refused from another machine or container The default HOST is 127.0.0.1. Set HOST=0.0.0.0 (the Docker image already does) and MCP_ALLOWED_HOSTS.5
EADDRINUSE Another process uses the port. Set PORT.5
The startup log shows "hostCheck":"disabled" The server is not bound to loopback and MCP_ALLOWED_HOSTS is unset, so any Host is accepted. Set MCP_ALLOWED_HOSTS for a public server.15
The server answers on stdio instead of HTTP HTTP mode needs --http or MCP_TRANSPORT=http exactly.3

See HTTP transport for how the checks work.

Docker and deployments

Symptom Cause and fix
A stdio client gets no answer from the container The image speaks MCP on stdin and stdout by default. Run it with docker run -i.5
The client cannot start the container Build the image first: docker build -t nsf-awards-mcp .1
Health checks on /health fail, or nothing listens on port 3000 The container runs in stdio mode. Set MCP_TRANSPORT=http. The image’s default command is node build/index.js; the shipped templates (Compose, Cloud Run, deployment/gcp/deploy.sh, the CloudFormation task and the systemd unit) set the variable, so check a configuration of your own.16 17 18 19 20 21 See Deployment.

Logs

All logs go to stderr, never stdout, so they cannot corrupt the stdio protocol stream.22 In stdio mode they appear in the client’s MCP server log.1

  • LOG_LEVEL sets the level: error, warn, info (default) or debug.5 22 debug adds every NSF API request URL and its parameters.1
  • With NODE_ENV=production, the server also writes logs/error.log and logs/combined.log (5 MB per file, 5 files each). The path is relative to the server’s working directory.22 The Docker image sets NODE_ENV=production and has /app/logs for this.16 The repository’s .mcp.json sets it too, so a server that Claude Code starts in the repository writes to logs/ there.23
  • To debug from a source checkout, run LOG_LEVEL=debug npm run dev.6

Still stuck

Open an issue at https://github.com/tyson-swetnam/nsf-awards-mcp/issues with your OS, node --version, the command or client config, and the error.5

  1. User guide (USAGE.md) ↩ ↩2 ↩3 ↩4 ↩5 ↩6 ↩7 ↩8 ↩9 ↩10 ↩11 ↩12 ↩13 ↩14

  2. Project README ↩ ↩2 ↩3 ↩4 ↩5

  3. Server entry point (src/index.ts) ↩ ↩2

  4. package.json ↩

  5. Installation guide (INSTALL.md) ↩ ↩2 ↩3 ↩4 ↩5 ↩6 ↩7 ↩8 ↩9 ↩10 ↩11

  6. Developer guide (DEVELOPMENT.md) ↩ ↩2 ↩3

  7. NSF API client (src/client/nsf-api-client.ts) ↩ ↩2 ↩3 ↩4 ↩5 ↩6 ↩7

  8. get_award_details handler ↩

  9. get_project_outcomes handler ↩

  10. Tool input schemas (keyword checks) ↩ ↩2

  11. MCP server factory (src/server.ts) ↩

  12. search_by_pi handler (name parameters) ↩

  13. HTTP transport tests ↩

  14. nginx reverse proxy example ↩

  15. Streamable HTTP transport (src/http.ts) ↩ ↩2 ↩3

  16. Dockerfile ↩ ↩2

  17. Docker Compose file ↩

  18. Cloud Run service manifest ↩

  19. Cloud Run deployment script ↩

  20. AWS CloudFormation template ↩

  21. systemd unit file ↩

  22. Logger configuration (src/utils/logger.ts) ↩ ↩2 ↩3

  23. Project-scoped Claude Code server config (.mcp.json) ↩

Sources

  1. User guide (USAGE.md) usage-guide
  2. Installation guide (INSTALL.md) install-guide
  3. Project README readme
  4. Developer guide (DEVELOPMENT.md) development-guide
  5. NSF API client (src/client/nsf-api-client.ts) api-client
  6. get_award_details handler award-details-tool
  7. get_project_outcomes handler outcomes-tool
  8. MCP server factory (src/server.ts) server-factory
  9. Streamable HTTP transport (src/http.ts) http-transport
  10. HTTP transport tests http-tests
  11. Server entry point (src/index.ts) entry-point
  12. Logger configuration (src/utils/logger.ts) logger
  13. Dockerfile dockerfile
  14. package.json package-json
  15. Project-scoped Claude Code server config (.mcp.json) mcp-json
  16. nginx reverse proxy example nginx-conf
  17. Cloud Run deployment script gcp-deploy
  18. Docker Compose file docker-compose
  19. Cloud Run service manifest cloud-run
  20. AWS CloudFormation template cloudformation
  21. systemd unit file systemd-unit
  22. Tool input schemas (keyword checks) tool-schemas
  23. search_by_pi handler (name parameters) pi-tool