Skip to content

feat(remote): add remote server capabilities #8

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 9 commits into
base: main
Choose a base branch
from
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
36 changes: 30 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,8 @@ Here are some example prompts to get you started:

### Claude Desktop Setup

#### Local

1. Open Claude Desktop settings
2. Add the following to your configuration:
```json
Expand All @@ -123,6 +125,27 @@ Here are some example prompts to get you started:
> [!TIP]
> You can refer to the [official documentation](https://modelcontextprotocol.io/quickstart/user) for Claude Desktop.

#### Remote
To run an HTTP server, as Claude Desktop doesn't natively support it yet, you'll have to use a gateway:
```json
{
"mcpServers": {
"algolia-mcp": {
"command": "<PATH_TO_BIN>/npx",
"args": [
"-y",
"mcp-remote",
"http://localhost:4243/mcp"
]
}
}
}
```
> [!INFO]
> Our HTTP server leverages the [Streamable HTTP transport](https://modelcontextprotocol.io/specification/2025-03-26/basic/transports#streamable-http).
> It is also backward compatible with the [SSE transport](https://modelcontextprotocol.io/docs/concepts/transports#server-sent-events-sse).


### CLI Options

#### Available Commands
Expand All @@ -131,14 +154,15 @@ Here are some example prompts to get you started:
Usage: algolia-mcp [options] [command]

Options:
-h, --help display help for command
-h, --help Display help for command

Commands:
start-server [options] Starts the Algolia MCP server
authenticate Authenticate with Algolia
logout Remove all stored credentials
list-tools List all available tools
help [command] display help for command
start-server [options] Starts the Algolia MCP server
start-sse-server [options] Starts the Algolia MCP SSE server
authenticate Authenticate with Algolia
logout Remove all stored credentials
list-tools List all available tools
help [command] Display help for command
```

#### Server Options
Expand Down
111 changes: 111 additions & 0 deletions package-lock.json

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

6 changes: 5 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"type-check": "tsc --noEmit",
"lint": "eslint --ext .ts src",
"test": "vitest",
"build": "bun build ./src/app.ts --compile",
"build": "bun build ./src/app.ts --compile --outfile dist/app",
"debug": "mcp-inspector npm start"
},
"type": "module",
Expand All @@ -19,12 +19,16 @@
"@modelcontextprotocol/sdk": "^1.11.0",
"algoliasearch": "^5.23.4",
"commander": "^13.1.0",
"cors": "^2.8.5",
"express": "^5.1.0",
"open": "^10.1.0",
"zod": "^3.24.2"
},
"devDependencies": {
"@eslint/js": "^9.24.0",
"@modelcontextprotocol/inspector": "^0.9.0",
"@types/cors": "^2.8.17",
"@types/express": "^5.0.1",
"@types/node": "^22.14.0",
"@vitest/coverage-v8": "^3.1.1",
"bun": "^1.2.9",
Expand Down
22 changes: 19 additions & 3 deletions src/app.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Command } from "commander";
import { type StartServerOptions } from "./commands/start-server.ts";
import type { StartServerOptions } from "./server/types.ts";
import { type ListToolsOptions } from "./commands/list-tools.ts";

const program = new Command("algolia-mcp");
Expand Down Expand Up @@ -62,9 +62,25 @@ program
.command("start-server", { isDefault: true })
.description("Starts the Algolia MCP server")
.option<string[]>(...ALLOW_TOOLS_OPTIONS_TUPLE)
.option("--transport [stdio|http]", "Transport type, either `stdio` (default) or `http`", "stdio")
.action(async (opts: StartServerOptions) => {
const { startServer } = await import("./commands/start-server.ts");
await startServer(opts);
switch (opts.transport) {
case "stdio": {
console.info('Starting server with stdio transport');
const { startServer } = await import("./commands/start-server.ts");
await startServer(opts);
break;
}
case "http": {
console.info('Starting server with HTTP transport support');
const { startHttpServer } = await import("./commands/start-http-server.ts");
await startHttpServer(opts);
break;
}
default:
console.error(`Unknown transport type: ${opts.transport}\nAllowed values: stdio, http`);
process.exit(1);
}
});

program
Expand Down
Loading