Skip to content

Commit 1b1852c

Browse files
authored
fix: Stdio and SSE example, improve logging (#32)
* fix: Examples stdio and sse * fix: log message
1 parent 560e33b commit 1b1852c

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

src/examples/clientSse.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ const dirname = path.dirname(filename);
2222
dotenv.config({ path: path.resolve(dirname, '../../.env') });
2323

2424
const SERVER_URL = 'https://actors-mcp-server.apify.actor/sse';
25-
// We need to change forward slash / to underscore _ in the tool name as Anthropic does not allow forward slashes in the tool name
26-
const SELECTED_TOOL = 'apify_rag-web-browser';
25+
// We need to change forward slash / to underscore -- in the tool name as Anthropic does not allow forward slashes in the tool name
26+
const SELECTED_TOOL = 'apify--rag-web-browser';
2727
const QUERY = 'web browser for Anthropic';
2828

2929
if (!process.env.APIFY_TOKEN) {

src/examples/clientStdio.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ const SERVER_PATH = path.resolve(dirname, '../../dist/index.js');
2424
const NODE_PATH = execSync(process.platform === 'win32' ? 'where node' : 'which node').toString().trim();
2525

2626
const TOOLS = 'apify/rag-web-browser,lukaskrivka/google-maps-with-contact-details';
27-
const SELECTED_TOOL = 'apify_rag-web-browser'; // We need to change / to _ in the tool name
27+
const SELECTED_TOOL = 'apify--rag-web-browser'; // We need to change / to _ in the tool name
2828

2929
if (!process.env.APIFY_TOKEN) {
3030
console.error('APIFY_TOKEN is required but not set in the environment variables.');

src/main.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ app.route(Routes.ROOT)
6161
return;
6262
}
6363
try {
64-
log.info(`Received GET message at: ${req.url}`);
64+
log.info(`Received GET message at: ${Routes.ROOT}`);
6565
await processParamsAndUpdateTools(req.url);
6666
res.status(200).json({ message: `Actor is using Model Context Protocol. ${HELP_MESSAGE}` }).end();
6767
} catch (error) {
@@ -76,7 +76,7 @@ app.route(Routes.ROOT)
7676
app.route(Routes.SSE)
7777
.get(async (req: Request, res: Response) => {
7878
try {
79-
log.info(`Received GET message at: ${req.url}`);
79+
log.info(`Received GET message at: ${Routes.SSE}`);
8080
await processParamsAndUpdateTools(req.url);
8181
transport = new SSEServerTransport(Routes.MESSAGE, res);
8282
await mcpServer.connect(transport);
@@ -89,7 +89,7 @@ app.route(Routes.SSE)
8989
app.route(Routes.MESSAGE)
9090
.post(async (req: Request, res: Response) => {
9191
try {
92-
log.info(`Received POST message at: ${req.url}`);
92+
log.info(`Received POST message at: ${Routes.MESSAGE}`);
9393
if (transport) {
9494
await transport.handlePostMessage(req, res);
9595
} else {

0 commit comments

Comments
 (0)