Skip to content

feat: support server instructions (closes #183) - #196

Open
huysonmind wants to merge 1 commit into
QuantGeekDev:mainfrom
huysonmind:feat/server-instructions
Open

huysonmind wants to merge 1 commit into
QuantGeekDev:mainfrom
huysonmind:feat/server-instructions

Conversation

@huysonmind

Copy link
Copy Markdown

Closes #183.

Adds an optional instructions field to MCPServerConfig. It is passed to the SDK Server, so clients receive it in the initialize result (InitializeResult.instructions), as described in the MCP spec.

const server = new MCPServer({
  name: "weather-server",
  instructions: "Call get_forecast with a city name. Temperatures are in Celsius.",
});

Server options were built in two places (start() and createSDKServerForSession()); both now use one helper, so stdio, HTTP, SSE and handleRequest()/Lambda all return the same instructions.

Tests

  • New tests/core/instructions.test.ts: initialize via handleRequest() with and without instructions.
  • Full suite on Node 22: no new failures compared with main (the 6 suites already failing on main — packages/docs type errors and one JWKS caching test — are unchanged).

Docs: new "Server Instructions" section in the README.

🤖 Generated with Claude Code

Pass an optional `instructions` string to the SDK Server so it is returned
in the initialize result (InitializeResult.instructions). Server options are
now built in one place for both start() and per-session/serverless servers.

Closes QuantGeekDev#183

Co-Authored-By: Claude Opus 5.5 <[email protected]>
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.

Support MCP InitializeResult.instructions / server instructions?

1 participant