← Browse

@invariantlabs-ai/server

C

This repository provides example implementations of MCP (Model Context Protocol) Streamable HTTP client and server in Python and Typescript, based on the specification: πŸ“„ MCP Streamable HTTP Spec.

mcp_servermcp

Install

agr install @invariantlabs-ai/server --target claude

This artifact does not publish files for Claude.

Document

{ "name": "server", "version": "1.0.0", "description": "", "main": "index.js", "type": "module", "bin": { "create-mcp-server": "./build/index.js" }, "scripts": { "build": "tsc && chmod 755 build/index.js" }, "files": [ "build" ], "license": "ISC", "dependencies": { "@modelcontextprotocol/sdk": "^1.11.4", "express": "^5.1.0" }, "devDependencies": { "@types/express": "^5.0.1", "@types/node": "^22.14.0", "typescript": "^5.8.3" } }

Repository README

Describes invariantlabs-ai/mcp-streamable-http as a whole, which may contain artifacts other than this one. Where this artifact had no useful description of its own, its summary was taken from here.

MCP Streamable HTTP – Python and Typescript Examples

This repository provides example implementations of MCP (Model Context Protocol) Streamable HTTP client and server in Python and Typescript, based on the specification: πŸ“„ MCP Streamable HTTP Spec.

You can set up a client + server stack entirely using either Python or TypeScript. This example also demonstrates cross-language compatibility, allowing a Python client to communicate with a TypeScript server, and vice-versa.

πŸš€ Getting Started

1. Clone the Repository

git clone https://github.com/invariantlabs-ai/mcp-streamable-http.git
cd python-example

2. Python Example

1. Add Your Anthropic API Key

Update the .env file inside the python-example/client directory with the following content:

ANTHROPIC_API_KEY=your_api_key_here

2. Set Up the Server

cd python-example/server
pip install .
python weather.py

By default, the server will start at http://localhost:8123.
If you'd like to specify a different port, use the --port flag:

python weather.py --port=9000

3. Set Up the Client

cd ../client
pip install .

4. Run the Client

python client.py

This will start an interactive chat loop using the MCP Streamable HTTP protocol.
If you started the MCP server on a different port, specify it using the --mcp-localhost-port flag:

python client.py --mcp-localhost-port=9000

3. Typescript Example

1. Add Your Anthropic API Key

Update the .env file inside the typescript-example/client directory with the following content:

ANTHROPIC_API_KEY=your_api_key_here

2. Set Up the Server

cd typescript-example/server
npm install && npm run build
node build/index.js

By default, the server will start at http://localhost:8123.
If you'd like to specify a different port, use the --port flag:

node build/index.js --port=9000

3. Set Up the Client

cd ../client
npm install && npm run build

4. Run the Client

node build/index.js

This will start an interactive chat loop using the MCP Streamable HTTP protocol.
If you started the MCP server on a different port, specify it using the --mcp-localhost-port flag:

node build/index.js --mcp-localhost-port=9000

πŸ’¬ Example Queries

In the client chat interface, you can ask questions like:

  • β€œAre there any weather alerts in Sacramento?”
  • β€œWhat’s the weather like in New York City?”
  • β€œTell me the forecast for Boston tomorrow.”

The client will forward requests to the local MCP weather server and return the results using Anthropic’s Claude language model. The MCP transport layer used will be Streamable HTTP.

Trustgrade C

  • passBody integrity

    Whether the stored document is plausibly the kind of file the artifact declares, rather than something fetched by mistake.

  • warnType matchbest-effort: server code not analyzed

    Whether the artifact is really the kind of thing its metadata claims it is.

  • warnFreshnessstale (>1y)

    How long since the source repository was last pushed to.

  • passPrompt injection

    Scans the artifact's own text for instructions aimed at your agent rather than at you.

  • warnLicenseno SPDX license detected

    Whether the source repository declares an SPDX license permissive enough to redistribute.

How the grade is calculated

Each check contributes 0 points when it passes, 1 when it warns, and 2 when it fails. The total maps to a letter:

  • Aevery check passed
  • Bone warning
  • Ctwo warnings
  • Dprompt injection or body integrity failed, or three warnings
  • Fone of those failed, and something else is wrong

These are automated hygiene checks, not a security audit, and not a dependency or vulnerability scan. A grade of A means nothing was flagged β€” not that the artifact is safe.

Versions

  • git-be47d92f8b4e2026-08-03