Skip to content

Commit 11e6a57

Browse files
committed
release 1.5.2
1 parent bc3aa3a commit 11e6a57

File tree

5 files changed

+20
-14
lines changed

5 files changed

+20
-14
lines changed

.github/workflows/pipeline.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Testing
1+
name: Tests
22

33
on:
44
push:

README.md

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
A NestJS module to effortlessly expose tools, resources, and prompts for AI, from your NestJS applications using the **Model Context Protocol (MCP)**.
1515

16-
with `@rekog/mcp-nest` you define tools, resources, and prompts in a way that's familiar in NestJS and leverage the full power of dependency injection to utilize your existing codebase in building complex enterprise ready MCP servers.
16+
With `@rekog/mcp-nest` you define tools, resources, and prompts in a way that's familiar in NestJS and leverage the full power of dependency injection to utilize your existing codebase in building complex enterprise ready MCP servers.
1717

1818
## Features
1919

@@ -25,6 +25,7 @@ with `@rekog/mcp-nest` you define tools, resources, and prompts in a way that's
2525
- 💯 Zod-based tool call validation
2626
- 📊 Progress notifications
2727
- 🔒 Guard-based authentication
28+
- 🌐 Access to HTTP Request information within MCP Resources (Tools, Resources, Prompts)
2829

2930
## Installation
3031

@@ -58,6 +59,7 @@ export class AppModule {}
5859

5960
```typescript
6061
// greeting.tool.ts
62+
import type { Request } from 'express';
6163
import { Injectable } from '@nestjs/common';
6264
import { Tool, Resource, Context } from '@rekog/mcp-nest';
6365
import { z } from 'zod';
@@ -75,12 +77,12 @@ export class GreetingTool {
7577
name: z.string().default('World'),
7678
}),
7779
})
78-
async sayHello({ name }, context: Context) {
79-
const greeting = `Hello, ${name}!`;
80-
80+
async sayHello({ name }, context: Context, request: Request) {
81+
const userAgent = request.get('user-agent') || 'Unknown';
82+
const greeting = `Hello, ${name}! Your user agent is: ${userAgent}`;
8183
const totalSteps = 5;
8284
for (let i = 0; i < totalSteps; i++) {
83-
await new Promise((resolve) => setTimeout(resolve, 500));
85+
await new Promise((resolve) => setTimeout(resolve, 100));
8486

8587
// Send a progress update.
8688
await context.reportProgress({
@@ -117,6 +119,9 @@ export class GreetingTool {
117119

118120
You are done!
119121

122+
> [!TIP]
123+
> The above example shows how HTTP `Request` headers are accessed within MCP Tools. This is useful for identifying users, adding client-specific logic, and many other use cases. For more examples, see the [Authentication Tests](./tests/mcp-tool-auth.spec.ts).
124+
120125
## Quick Start for STDIO
121126

122127
The main difference is that you need to provide the `transport` option when importing the module.

package-lock.json

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@rekog/mcp-nest",
3-
"version": "1.5.1",
3+
"version": "1.5.2",
44
"description": "NestJS module for creating Model Context Protocol (MCP) servers",
55
"main": "dist/index.js",
66
"license": "MIT",

playground/resources/greeting.tool.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import type { Request } from 'express';
12
import { Injectable } from '@nestjs/common';
23
import { Context, Tool } from '../../src';
34
import { Progress } from '@modelcontextprotocol/sdk/types.js';
@@ -13,9 +14,9 @@ export class GreetingTool {
1314
name: z.string().default('World'),
1415
}),
1516
})
16-
async sayHello({ name }, context: Context) {
17-
const greeting = `Hello, ${name}!`;
18-
17+
async sayHello({ name }, context: Context, request: Request) {
18+
const userAgent = request.get('user-agent') || 'Unknown';
19+
const greeting = `Hello, ${name}! Your user agent is: ${userAgent}`;
1920
const totalSteps = 5;
2021
for (let i = 0; i < totalSteps; i++) {
2122
await new Promise((resolve) => setTimeout(resolve, 100));

0 commit comments

Comments
 (0)