Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
node_modules/
dist/
*.tsbuildinfo
.env
6 changes: 4 additions & 2 deletions examples/ping-server/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 16 additions & 1 deletion examples/ping-server/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,22 @@ server.withTransport(transport);
app.post('/mcp', async (c) => {
try {
const request = c.req.raw;
return transport.handleRequest(request);
// Log incoming request details
console.log('--- Incoming /mcp request ---');
console.log('Method:', request.method);
console.log('URL:', request.url);
console.log('Headers:', JSON.stringify(Object.fromEntries(request.headers.entries()), null, 2));
const reqBody = await request.clone().text();
console.log('Body:', reqBody);

// Hand off to transport
const response = await transport.handleRequest(request);
// Log outgoing response details
console.log('--- Outgoing /mcp response ---');
console.log('Status:', response.status);
const resBody = await response.clone().text();
console.log('Body:', resBody);
return response;
} catch (error) {
console.error('Error handling MCP request:', error);
return new Response(JSON.stringify({ error: 'Internal server error' }), {
Expand Down
37 changes: 37 additions & 0 deletions examples/taffrail/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Simple ping server

The following is a very simple "ping" MCP server.

It has no tools, it has no
capabilities: it primarily only responds to `method.ping` requests after the initialization flow
[as defined in the MCP spec](https://modelcontextprotocol.io/specification/2025-03-26/basic/utilities/ping).

## 🏃 Build & run the server

```
npm i
npm run build
npm run start
```

## 🧠 Interact

Use the [Model Context Protocol Inspector](https://github.com/modelcontextprotocol/inspector)
and `localhost:3000/mcp`.

```sh
npx @modelcontextprotocol/inspector
```

or curl:

```sh
curl -X POST \
-H 'Accept: application/json' \
-d '{
"jsonrpc": "2.0",
"id": "123",
"method": "ping"
}' \
localhost:3000/mcp
```
Loading