Skip to main content
Glama
asaleh-lab

ts-mcp-agents

by asaleh-lab
README.md
# ts-mcp-agents

This repo demonstrates how to put a tool on an MCP server and call it from a client. The example we will use is The Landing, a small coworking floor with a handful of bookable rooms. In our case we need the desk note for a room, without baking that lookup into the chat model.

This is the TypeScript MCP SDK copy of the Python FastMCP repo. FastMCP is Python. We hang the same Landing tools on `@modelcontextprotocol/sdk`.

## Setup

```powershell
npm install
copy .env.example .env
```

Put your OpenAI API key in `.env`.

## Hang one room lookup on a server

```powershell
npx tsx src/hello-mcp.ts
```

## Put the notes on the server as a search, a file, and a prompt

```powershell
npx tsx src/mcp-rag-server.ts
```

## Call the search over STDIO

```powershell
npx tsx src/stdio-client.ts
```

## Call the search over HTTP

```powershell
npx tsx src/http-client.ts
```

## Talk to the rooms server and the desk server

```powershell
npx tsx src/multi-server.ts
```

## Keep the notes inside the client's root, then ask the client to draft a sign

```powershell
npx tsx src/sampling-roots.ts
```

## Ask before we write a booking

```powershell
npx tsx src/elicitation.ts
```

## Run the same search on STDIO, then on HTTP

```powershell
npx tsx src/stdio-client.ts
npx tsx src/http-client.ts
```

Same tool, same question. Only the pipe changes. You should see Room C, then the Quiet Room note that points at Room C or the Board. The notes themselves should not change.