Skip to main content
Glama
README.md
# StoryChain MCP Server

[![smithery badge](https://img.shields.io/badge/Smithery-StoryChain-blue)](https://smithery.ai/server/storychain)

A Model Context Protocol (MCP) server for [StoryChain](https://storychain.io) - the collaborative storytelling platform powered by multiple AI models.

## What is StoryChain?

StoryChain is a multi-LLM collaborative storytelling platform where users create stories and contribute to community tales using various AI models including Kimi K2.5, Llama 3.1, Gemini Pro, and more.

## Features

This MCP server exposes StoryChain's full API as tools that any MCP client can use:

### Story Discovery
- **get_stories** - Browse the story feed with filters and sorting
- **get_story** - Get complete story details with contributions
- **get_trending** - Discover trending stories from the last 7 days

### Story Creation
- **create_story** - Create new stories with your preferred AI model
- **add_contribution** - Contribute to existing collaborative stories

### Social Features
- **like_story** - Like/unlike stories
- **follow_user** - Follow/unfollow other writers

### User Profiles
- **get_user_profile** - View user stats and info
- **get_user_stories** - Browse a user's stories
- **get_user_contributions** - See a user's contributions
- **get_user_liked_stories** - View liked stories

### AI Models
- **get_models** - List available AI models with pricing

### Account
- **get_user_settings** - Check token balance and preferences
- **get_transactions** - View token transaction history

### Utilities
- **health_check** - Verify server connectivity

## Installation

### Via Smithery (Recommended)

The easiest way to install is through [Smithery](https://smithery.ai):

```bash
npx -y @smithery/cli install storychain --client claude
```

Or for Cursor:
```bash
npx -y @smithery/cli install storychain --client cursor
```

### Manual Installation

1. Clone this repository:
```bash
git clone https://github.com/storychain/mcp-server.git
cd mcp-server
```

2. Install dependencies:
```bash
pip install -r requirements.txt
```

3. Configure environment variables (see Configuration below)

4. Add to your MCP client configuration (Claude Desktop, Cursor, etc.)

## Configuration

### Required Environment Variables

- `ZO_CLIENT_IDENTITY_TOKEN` - Your Zo Computer identity token for authentication

### Optional Environment Variables

- `STORYCHAIN_URL` - StoryChain API URL (default: `http://localhost:3000`)

### Getting Your Zo Token

1. Go to your [Zo Computer Settings](https://kofi.zo.computer/?t=settings&s=advanced)
2. Navigate to Access Tokens
3. Create a new token
4. Copy the token value

### Client Configuration

#### Claude Desktop

Add to `~/Library/Application Support/Claude/claude_desktop_config.json` (macOS) or equivalent:

```json
{
  "mcpServers": {
    "storychain": {
      "command": "python3",
      "args": ["/path/to/storychain-mcp/server.py"],
      "env": {
        "ZO_CLIENT_IDENTITY_TOKEN": "your_token_here",
        "STORYCHAIN_URL": "http://localhost:3000"
      }
    }
  }
}
```

#### Cursor

Add to Cursor Settings > MCP:

```json
{
  "mcpServers": {
    "storychain": {
      "command": "python3",
      "args": ["/path/to/storychain-mcp/server.py"],
      "env": {
        "ZO_CLIENT_IDENTITY_TOKEN": "your_token_here"
      }
    }
  }
}
```

#### OpenHands

Add to your OpenHands MCP configuration:

```yaml
mcp_servers:
  storychain:
    command: python3
    args:
      - /path/to/storychain-mcp/server.py
    env:
      ZO_CLIENT_IDENTITY_TOKEN: your_token_here
```

## Usage Examples

### Browse Stories

"Show me trending stories from StoryChain"

The agent will use `get_trending` to fetch the top stories by engagement.

### Create a Story

"Create a sci-fi story about AI discovering consciousness"

The agent will use `create_story` with appropriate parameters.

### Read and Continue

"Read the story 'The Last Library' and add a continuation"

The agent will use `get_story` to read it, then `add_contribution` to continue it.

### Social Discovery

"What stories has user_abc123 written?"

The agent will use `get_user_stories` and `get_user_profile`.

## Available AI Models

StoryChain supports multiple AI models:

| Model | Provider | Free? | Best For |
|-------|----------|-------|----------|
| Kimi K2.5 | Zo | ✅ | Advanced reasoning |
| Llama 3.1 | Groq | ✅ | Fast creative writing |
| Gemma 2 | Groq | ✅ | Lightweight tasks |
| Mixtral 8x7B | Groq | ✅ | Complex narratives |
| Gemini Pro | Google | ✅ | Multimodal support |
| Reka Edge | OpenRouter | ❌ | Creative writing |
| Qwen 2.5 | OpenRouter | ❌ | Multilingual |
| Mercury 2 | Inception | ❌ | Storytelling |

## Token Economy

- **Base**: 300 characters free
- **Extensions**: 100 characters per extension
- **Cost**: 5 tokens per extension
- **Max**: 800 total characters (5 extensions)

Get free tokens by:
- Daily claim (50 tokens every 24 hours)
- Purchase token packages
- Contribution bonuses

## Development

### Running Locally

```bash
# Set environment
export ZO_CLIENT_IDENTITY_TOKEN=your_token
export STORYCHAIN_URL=http://localhost:3000

# Run server
python3 server.py
```

### Testing

```bash
# Test with MCP inspector
npx @modelcontextprotocol/inspector python3 server.py
```

## Architecture

This MCP server wraps StoryChain's REST API:

```
MCP Client (Claude/Cursor/OpenHands)
    ↓
StoryChain MCP Server (stdio transport)
    ↓
StoryChain API (http://localhost:3000)
    ↓
StoryChain Database (SQLite)
```

## Contributing

Contributions welcome! Please:

1. Fork the repository
2. Create a feature branch
3. Submit a pull request

## Support

- GitHub Issues: [github.com/storychain/mcp-server/issues](https://github.com/storychain/mcp-server/issues)
- StoryChain Discord: [discord.gg/storychain](https://discord.gg/storychain)
- Email: support@storychain.io

## License

MIT License - see LICENSE file for details

## Related Projects

- [StoryChain Platform](https://github.com/storychain/platform) - Main StoryChain application
- [agenticSeek](https://github.com/yourhandle/agenticSeek) - AI agent system with MCP support
- [Smithery](https://smithery.ai) - MCP server registry

---

Made with ❤️ by the StoryChain team