Skip to content

Commit 01f5804

Browse files
committed
use the name "mcp" to avoid server.server echo
1 parent 67c9eec commit 01f5804

File tree

87 files changed

+331
-331
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

87 files changed

+331
-331
lines changed

exercises/01.ping/01.problem.connect/src/index.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js'
33
// import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js'
44

5-
// 🐨 create a new McpServer
5+
// 🐨 create a new McpServer called "mcp"
66
// - it should have a name of 'epicme', title of 'EpicMe', and a version of '1.0.0'
77
// - it should have instructions for the LLM to know what this server can be used to do (we'll start out by saying it can solve math problems)
88
// 💰 NOTE: the `instructions` should appear as a property of an object in the second argument of the McpServer constructor
@@ -11,9 +11,9 @@
1111

1212
async function main() {
1313
// 🐨 create a new StdioServerTransport
14-
// 🐨 connect the server to the transport
14+
// 🐨 connect the mcp server to the transport
1515

16-
// 🐨 add a log (using console.error) to the console to let the user know the server is running
16+
// 🐨 add a log (using console.error) to the console to let the user know the mcp server is running
1717

1818
// 💣 you can delete this once you're done
1919
throw new Error('Not implemented')

exercises/01.ping/01.solution.connect/src/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js'
22
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js'
33

4-
const server = new McpServer(
4+
const mcp = new McpServer(
55
{
66
name: 'epicme',
77
title: 'EpicMe',
@@ -14,7 +14,7 @@ const server = new McpServer(
1414

1515
async function main() {
1616
const transport = new StdioServerTransport()
17-
await server.connect(transport)
17+
await mcp.connect(transport)
1818
console.error('EpicMe MCP Server running on stdio')
1919
}
2020

exercises/02.tools/01.problem.simple/README.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ static result.
1313
As a reminder, here's an example of a tool:
1414

1515
```ts
16-
server.registerTool(
16+
mcp.registerTool(
1717
'hello',
1818
{
1919
title: 'Hello',

exercises/02.tools/01.problem.simple/src/index.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ test('Tool Call', async () => {
9494
'🚨 This means you haven\'t registered the "add" tool properly',
9595
)
9696
console.error(
97-
'🚨 In src/tools.ts, use agent.server.registerTool() to create a simple "add" tool',
97+
'🚨 In src/tools.ts, use agent.mcp.registerTool() to create a simple "add" tool',
9898
)
9999
console.error(
100100
'🚨 The tool should return "1 + 2 = 3" (hardcoded for this simple exercise)',

exercises/02.tools/01.problem.simple/src/index.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js'
22
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js'
33

4-
const server = new McpServer(
4+
const mcp = new McpServer(
55
{
66
name: 'epicme',
77
title: 'EpicMe',
@@ -13,14 +13,14 @@ const server = new McpServer(
1313
},
1414
)
1515

16-
// 🐨 add a tool to the server with the server.registerTool API
16+
// 🐨 add a tool to the server with the mcp.registerTool API
1717
// - the name should be 'add'
1818
// - the config object should include a user-facing title and an llm-facing description explaining what it can be used to do (add one and two)
1919
// - the callback should return a standard text response that says "The sum of 1 and 2 is 3."
2020

2121
async function main() {
2222
const transport = new StdioServerTransport()
23-
await server.connect(transport)
23+
await mcp.connect(transport)
2424
console.error('EpicMe MCP Server running on stdio')
2525
}
2626

exercises/02.tools/01.solution.simple/src/index.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ test('Tool Call', async () => {
9494
'🚨 This means you haven\'t registered the "add" tool properly',
9595
)
9696
console.error(
97-
'🚨 In src/tools.ts, use agent.server.registerTool() to create a simple "add" tool',
97+
'🚨 In src/tools.ts, use agent.mcp.registerTool() to create a simple "add" tool',
9898
)
9999
console.error(
100100
'🚨 The tool should return "1 + 2 = 3" (hardcoded for this simple exercise)',

exercises/02.tools/01.solution.simple/src/index.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js'
22
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js'
33

4-
const server = new McpServer(
4+
const mcp = new McpServer(
55
{
66
name: 'epicme',
77
title: 'EpicMe',
@@ -15,7 +15,7 @@ const server = new McpServer(
1515
},
1616
)
1717

18-
server.registerTool(
18+
mcp.registerTool(
1919
'add',
2020
{
2121
title: 'Add',
@@ -35,7 +35,7 @@ server.registerTool(
3535

3636
async function main() {
3737
const transport = new StdioServerTransport()
38-
await server.connect(transport)
38+
await mcp.connect(transport)
3939
console.error('EpicMe MCP Server running on stdio')
4040
}
4141

exercises/02.tools/02.problem.args/README.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ Here's a quick example of a tool with arguments.
1414
```ts
1515
import { z } from 'zod'
1616

17-
server.registerTool(
17+
mcp.registerTool(
1818
'hello',
1919
{
2020
title: 'Hello',

exercises/02.tools/02.problem.args/src/index.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js'
22
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js'
33

4-
const server = new McpServer(
4+
const mcp = new McpServer(
55
{
66
name: 'epicme',
77
title: 'EpicMe',
@@ -15,7 +15,7 @@ const server = new McpServer(
1515
},
1616
)
1717

18-
server.registerTool(
18+
mcp.registerTool(
1919
'add',
2020
{
2121
title: 'Add',
@@ -41,7 +41,7 @@ server.registerTool(
4141

4242
async function main() {
4343
const transport = new StdioServerTransport()
44-
await server.connect(transport)
44+
await mcp.connect(transport)
4545
console.error('EpicMe MCP Server running on stdio')
4646
}
4747

exercises/02.tools/02.solution.args/src/index.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js'
22
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js'
33
import { z } from 'zod'
44

5-
const server = new McpServer(
5+
const mcp = new McpServer(
66
{
77
name: 'epicme',
88
title: 'EpicMe',
@@ -16,7 +16,7 @@ const server = new McpServer(
1616
},
1717
)
1818

19-
server.registerTool(
19+
mcp.registerTool(
2020
'add',
2121
{
2222
title: 'Add',
@@ -40,7 +40,7 @@ server.registerTool(
4040

4141
async function main() {
4242
const transport = new StdioServerTransport()
43-
await server.connect(transport)
43+
await mcp.connect(transport)
4444
console.error('EpicMe MCP Server running on stdio')
4545
}
4646

0 commit comments

Comments
 (0)