Switch MCP server from SSE to HTTP transport
- Update graphiti_mcp_server.py to use HTTP transport as default - Modify start.sh to use --transport http instead of sse - Update all documentation to reference /mcp endpoint instead of /sse - Rename mcp_config_sse_example.json to mcp_config_http_example.json - HTTP transport provides better compatibility and is actively supported 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
d6b032eb42
commit
2401d20e86
5 changed files with 21 additions and 16 deletions
|
|
@ -39,7 +39,7 @@ PORT=8080 bash start.sh
|
||||||
You should see the log line:
|
You should see the log line:
|
||||||
|
|
||||||
```
|
```
|
||||||
Graphiti MCP Server listening on 0.0.0.0:8080 (transport=sse)
|
Graphiti MCP Server listening on 0.0.0.0:8080 (transport=http)
|
||||||
```
|
```
|
||||||
|
|
||||||
## Remote validation with MCP Inspector
|
## Remote validation with MCP Inspector
|
||||||
|
|
@ -48,8 +48,8 @@ After deploying to Railway, validate the endpoint with [MCP Inspector](https://g
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
npx @modelcontextprotocol/inspector \
|
npx @modelcontextprotocol/inspector \
|
||||||
--transport sse \
|
--transport http \
|
||||||
--url https://<railway-app>.railway.app/sse \
|
--url https://<railway-app>.railway.app/mcp \
|
||||||
--headers "Authorization: Bearer <KEY-if-configured>"
|
--headers "Authorization: Bearer <KEY-if-configured>"
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -512,7 +512,7 @@ class GraphitiConfig(BaseModel):
|
||||||
class MCPConfig(BaseModel):
|
class MCPConfig(BaseModel):
|
||||||
"""Configuration for MCP server."""
|
"""Configuration for MCP server."""
|
||||||
|
|
||||||
transport: str = 'sse' # Default to SSE transport
|
transport: str = 'http' # Default to HTTP transport
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def from_cli(cls, args: argparse.Namespace) -> 'MCPConfig':
|
def from_cli(cls, args: argparse.Namespace) -> 'MCPConfig':
|
||||||
|
|
@ -1173,9 +1173,9 @@ async def initialize_server() -> MCPConfig:
|
||||||
)
|
)
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
'--transport',
|
'--transport',
|
||||||
choices=['sse', 'stdio'],
|
choices=['http', 'sse', 'stdio'],
|
||||||
default='sse',
|
default='http',
|
||||||
help='Transport to use for communication with the client. (default: sse)',
|
help='Transport to use for communication with the client. (default: http)',
|
||||||
)
|
)
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
'--model', help=f'Model name to use with the LLM client. (default: {DEFAULT_LLM_MODEL})'
|
'--model', help=f'Model name to use with the LLM client. (default: {DEFAULT_LLM_MODEL})'
|
||||||
|
|
@ -1258,6 +1258,11 @@ async def run_mcp_server():
|
||||||
logger.info(f'Starting MCP server with transport: {mcp_config.transport}')
|
logger.info(f'Starting MCP server with transport: {mcp_config.transport}')
|
||||||
if mcp_config.transport == 'stdio':
|
if mcp_config.transport == 'stdio':
|
||||||
await mcp.run_stdio_async()
|
await mcp.run_stdio_async()
|
||||||
|
elif mcp_config.transport == 'http':
|
||||||
|
logger.info(
|
||||||
|
f'Running MCP server with HTTP transport on {mcp.settings.host}:{mcp.settings.port}'
|
||||||
|
)
|
||||||
|
await mcp.run_http_async()
|
||||||
elif mcp_config.transport == 'sse':
|
elif mcp_config.transport == 'sse':
|
||||||
logger.info(
|
logger.info(
|
||||||
f'Running MCP server with SSE transport on {mcp.settings.host}:{mcp.settings.port}'
|
f'Running MCP server with SSE transport on {mcp.settings.host}:{mcp.settings.port}'
|
||||||
|
|
|
||||||
8
mcp_server/mcp_config_http_example.json
Normal file
8
mcp_server/mcp_config_http_example.json
Normal file
|
|
@ -0,0 +1,8 @@
|
||||||
|
{
|
||||||
|
"mcpServers": {
|
||||||
|
"graphiti": {
|
||||||
|
"transport": "http",
|
||||||
|
"url": "http://localhost:8000/mcp"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -1,8 +0,0 @@
|
||||||
{
|
|
||||||
"mcpServers": {
|
|
||||||
"graphiti": {
|
|
||||||
"transport": "sse",
|
|
||||||
"url": "http://localhost:8000/sse"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -7,4 +7,4 @@ if [[ -z "${PYTHON_BIN}" && -x "./.venv/bin/python" ]]; then
|
||||||
PYTHON_BIN="$(pwd)/.venv/bin/python"
|
PYTHON_BIN="$(pwd)/.venv/bin/python"
|
||||||
fi
|
fi
|
||||||
PYTHON_BIN="${PYTHON_BIN:-python}"
|
PYTHON_BIN="${PYTHON_BIN:-python}"
|
||||||
exec "$PYTHON_BIN" graphiti_mcp_server.py --transport sse --host 0.0.0.0 --port "$PORT"
|
exec "$PYTHON_BIN" graphiti_mcp_server.py --transport http --host 0.0.0.0 --port "$PORT"
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue