Skip to content

feat(server): send a User-Agent that names the package and version (#100) - #101

Open
johnxie wants to merge 1 commit into
mainfrom
feat/server-user-agent-100
Open

johnxie wants to merge 1 commit into
mainfrom
feat/server-user-agent-100

Conversation

@johnxie

@johnxie johnxie commented Oct 17, 2026

Copy link
Copy Markdown
Member

Summary

@taskade/mcp-server sent only the Authorization header to the Taskade API. The bundled HTTP client then added its generic default, User-Agent: node-fetch. A request from this package thus looked the same as a request from any Node script.

The server now identifies itself on every API request with User-Agent: taskade-mcp-server/<version>. With this header, Taskade can measure the usage of the package and debug its requests. The header holds no user data and no token.

Changes

  • packages/server/src/server.ts: add 'User-Agent': USER_AGENT to the header object of the v1 tool setup and of the v2 tool setup. USER_AGENT is taskade-mcp-server/${version}. The file already imports version from package.json, and esbuild inlines it into bin/cli.mjs at build time. No file is read at run time.
  • The generated tool runtime merges config.headers over the per-request headers on every call ({ ...payload.headers, ...this.config.headers }). Thus all 62 tools send the header, and the generated files do not change.
  • packages/server/src/server.test.ts: a new test connects an MCP client to the server in memory, mocks node-fetch, and calls one v1 tool and one v2 tool. It asserts the URL, the Authorization header and User-Agent: taskade-mcp-server/<version>, with the version read from package.json.
  • .changeset/server-user-agent.md: patch changeset for @taskade/mcp-server.

Risk and rollback

  • Low risk. The change adds one header. Authentication, URLs, request bodies and responses do not change.
  • The header value is ASCII only, so the HTTP client accepts it.
  • Rollback: revert this commit and publish a patch release.

Tests

  • yarn build: pass. The generated tool files did not change, and git status showed only the 3 files of this PR.
  • yarn lint: pass.
  • yarn test: 5 files, 21 tests, all pass (2 new).
  • The new test fails on main (2 of 2) and passes with this change.
  • tsc --noEmit -p packages/server: pass.
  • Manual run of the bundled bin/cli.mjs over stdio, with the API host sent to a local echo server:
Request Before After
GET /api/v1/workspaces (workspacesGet) User-Agent: node-fetch User-Agent: taskade-mcp-server/0.1.2
POST /api/v2/promptAgent (promptAgent) User-Agent: node-fetch User-Agent: taskade-mcp-server/0.1.2

tools/list returned 62 tools before and after. The Authorization: Bearer <token> header did not change.

  • A temporary bump of packages/server/package.json to 0.1.3 gave var version = "0.1.3" in bin/cli.mjs after yarn build:cli. The header thus follows the version that the release workflow writes before it builds.

Closes #100

)

The server sent only the Authorization header to the Taskade API. The
bundled HTTP client then added its generic default, "node-fetch".

The v1 and the v2 tool setup now send
"User-Agent: taskade-mcp-server/<version>". The build inlines the
version from package.json into bin/cli.mjs. A unit test asserts the
header and the version on a v1 and on a v2 tool call.

Closes #100
Copilot AI balanced review requested due to automatic review settings October 17, 2026 06:57
@changeset-bot

changeset-bot Bot commented Oct 17, 2026

Copy link
Copy Markdown

馃 Changeset detected

Latest commit: 5d89bc6

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@taskade/mcp-server Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

馃煝 Approval recommended

The narrowly scoped header change covers both API configurations, has targeted regression tests, and has no identified blocking issues.

No open issues 馃帀

What changed in this PR

Identifies Taskade MCP server API requests with a package-specific, versioned User-Agent, addressing #100.

Changes:

  • Adds the User-Agent header to both v1 and v2 tool configurations.
  • Adds regression tests checking URLs, authentication, and versioned headers.
  • Includes a patch changeset for release.
File Description
packages/鈥媠erver/鈥媠rc/鈥媠erver.ts Configures the versioned User-Agent for both APIs.
packages/鈥媠erver/鈥媠rc/鈥媠erver.test.ts Verifies request headers for representative v1 and v2 tools.
.changeset/鈥媠erver-user-agent.md Documents the patch release.

Review effort: Balanced

@johnxie

johnxie commented Oct 17, 2026

Copy link
Copy Markdown
Member Author

@deanzaka for review.

Impact

Every request from @taskade/mcp-server to the Taskade API now names the package and its version. Before this change, a request carried the generic User-Agent: node-fetch, the same value as any Node script. With this header, Taskade can measure the usage of the package and debug its requests. The header holds no user data and no token. Users of the package see no change.

Request flow

Before:

MCP client (for example Cursor)
   |  tools/call workspacesGet
   v
taskade-mcp-server (stdio, bin/cli.mjs)
   |  GET https://www.taskade.com/api/v1/workspaces
   |  Authorization: Bearer <token>
   |  User-Agent: node-fetch            <- generic, same as any script
   v
Taskade public API

After:

MCP client (for example Cursor)
   |  tools/call workspacesGet | promptAgent
   v
taskade-mcp-server (stdio, bin/cli.mjs)
   |  GET  https://www.taskade.com/api/v1/workspaces
   |  POST https://www.taskade.com/api/v2/promptAgent
   |  Authorization: Bearer <token>       (unchanged)
   |  User-Agent: taskade-mcp-server/0.1.2  <- version from package.json at build time
   v
Taskade public API

All 62 tools (57 v1 + 5 v2) send the header, because the tool runtime merges the server headers into every request.

QA

Step Action Expected result
1 Check out the branch. Run yarn install --frozen-lockfile and yarn build. The build passes. git status shows no change to the generated tool files.
2 Run grep -n 'taskade-mcp-server/' packages/server/bin/cli.mjs. One line: var USER_AGENT = `taskade-mcp-server/${version}`;. var version = "0.1.2" is in the same file.
3 Run yarn test. 5 files and 21 tests pass. packages/server/src/server.test.ts passes 2 tests (v1 and v2).
4 Start a local HTTP server that logs request headers. Run bin/cli.mjs over stdio with a test token, with the requests for www.taskade.com sent to that server. Call workspacesGet and promptAgent. The log shows user-agent: taskade-mcp-server/0.1.2 on GET /api/v1/workspaces and on POST /api/v2/promptAgent.
5 Optional live check: run npx @modelcontextprotocol/inspector node packages/server/bin/cli.mjs with TASKADE_API_KEY set to a real token. Call workspacesGet. The tool returns your workspaces, the same as on main.
6 Regression: in step 4, send tools/list. 62 tools, the same list as on main.
7 Regression: in step 4, read the authorization header. Bearer <token>, the same as on main. Tool calls with a bad token still return an error result.
8 Version check: set packages/server/package.json version to 0.1.3, run yarn build:cli, then restore the file. bin/cli.mjs holds var version = "0.1.3". The header follows the version that the release writes before it builds.
9 Rollback Revert the commit and publish a patch release. No flag or setting exists for this header.

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.

feat(server): send a User-Agent that names the package and version

2 participants