Skip to content

Commit 0e26224

Browse files
committed
Initial release: AI-native Robinhood trading interface
TypeScript monorepo with two packages: - @rh-agent-tools/client: Standalone Robinhood API client (~50 async methods) - rh-agent-tools: MCP server with 18 structured tools Features: - Browser-based authentication via Playwright (Chrome) - AES-256-GCM encrypted session storage with OS keychain - Multi-account support across all account-scoped methods - 5 Claude Code skills (setup, portfolio, research, trade, options) - Safety controls: blocked fund transfers, blocked bulk cancels, explicit order params - Compatible with Claude Code, Codex, OpenClaw, and any MCP-compatible agent
0 parents  commit 0e26224

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

78 files changed

+5955
-0
lines changed

.editorconfig

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
root = true
2+
3+
[*]
4+
end_of_line = lf
5+
insert_final_newline = true
6+
charset = utf-8
7+
trim_trailing_whitespace = true
8+
9+
[*.{ts,js,json,md,yml,yaml}]
10+
indent_style = space
11+
indent_size = 2

.github/CODEOWNERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* @kevin1chun
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
---
2+
name: Bug Report
3+
about: Report a bug or unexpected behavior
4+
labels: bug
5+
---
6+
7+
## Environment
8+
9+
- **rh-agent-tools version**:
10+
- **Bun version** (`bun --version`):
11+
- **OS**:
12+
- **MCP client** (Claude Code / Claude Desktop / other):
13+
14+
## Description
15+
16+
A clear description of the bug.
17+
18+
## Steps to Reproduce
19+
20+
1.
21+
2.
22+
3.
23+
24+
## Expected Behavior
25+
26+
What you expected to happen.
27+
28+
## Actual Behavior
29+
30+
What actually happened. Include error messages or MCP tool output if applicable.
31+
32+
## Security Notice
33+
34+
**Never paste tokens, credentials, session data, or account numbers in issues.**
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
---
2+
name: Feature Request
3+
about: Suggest a new tool, skill, or improvement
4+
labels: enhancement
5+
---
6+
7+
## Use Case
8+
9+
Describe the problem or workflow this feature would support.
10+
11+
## Proposed Solution
12+
13+
What you'd like to see (new MCP tool, client method, skill, etc.).
14+
15+
## Safety Considerations
16+
17+
Does this feature involve order placement, account modifications, or sensitive data? If so, describe the safety implications and any safeguards you'd suggest.
18+
19+
## Alternatives Considered
20+
21+
Any alternative approaches you've considered.

.github/pull_request_template.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
## Summary
2+
3+
Brief description of the changes.
4+
5+
## Safety Checklist
6+
7+
- [ ] Does not expose fund transfer or bank operations
8+
- [ ] Does not enable bulk operations without safeguards
9+
- [ ] Order-related changes require explicit parameters (no dangerous defaults)
10+
- [ ] ACCESS_CONTROLS.md updated if adding new operations
11+
12+
## Testing
13+
14+
- [ ] `npx vitest run` passes
15+
- [ ] `bun run typecheck` passes
16+
- [ ] `bun run check` passes
17+
- [ ] New tests added for new functionality

.github/workflows/ci.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [master]
6+
pull_request:
7+
branches: [master]
8+
9+
jobs:
10+
check:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v4
14+
- uses: oven-sh/setup-bun@v2
15+
- run: bun install --frozen-lockfile
16+
- run: bun run check
17+
- run: bun run typecheck
18+
- run: npx vitest run

.gitignore

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
node_modules/
2+
dist/
3+
.env
4+
*.enc
5+
.vscode/
6+
.idea/
7+
.DS_Store
8+
*~
9+
coverage/

CHANGELOG.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Changelog
2+
3+
All notable changes to this project will be documented in this file.
4+
5+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7+
8+
## [0.3.0] - 2025-03-10
9+
10+
### Added
11+
12+
- **MCP Server** with 18 structured tools for any MCP-compatible AI agent
13+
- **Standalone client library** (`@rh-agent-tools/client`) with ~50 async methods
14+
- **5 Claude Code skills**: setup, portfolio, research, trade, options
15+
- Browser-based authentication via Playwright (Chrome)
16+
- AES-256-GCM encrypted session storage with OS keychain key management
17+
- Multi-account support (first-class across all account-scoped methods)
18+
- Interactive onboarding TUI (`rh-agent-tools onboard`)
19+
- One-command install for Claude Code (`rh-agent-tools install`)
20+
- Safety controls: blocked fund transfers, blocked bulk cancels, explicit order parameters
21+
- Support for Claude Code, Codex, and OpenClaw agents
22+
23+
[0.3.0]: https://github.com/kevin1chun/rh-agent-tools/releases/tag/v0.3.0

CLAUDE.md

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
# rh-agent-tools
2+
3+
AI-native Robinhood trading interface — TypeScript monorepo with a standalone API client and MCP server.
4+
5+
## Project Structure
6+
- `packages/client/``@rh-agent-tools/client`: Standalone Robinhood API client
7+
- `packages/server/``rh-agent-tools`: MCP server with 18 tools
8+
- `.claude/skills/` — Claude Code skills for interactive use (SKILL.md only, no scripts)
9+
- `docs/` — Architecture, access controls, use cases, contributing
10+
11+
## Tech Stack
12+
- **Runtime**: Bun
13+
- **Language**: TypeScript (strict mode, ESM-only)
14+
- **MCP SDK**: `@modelcontextprotocol/sdk` v1.12+ (McpServer + StdioServerTransport)
15+
- **Validation**: Zod v3.24 (API responses + MCP tool schemas)
16+
- **Testing**: Vitest (not `bun test` — module isolation matters)
17+
- **Linting**: Biome v2
18+
- **Browser Auth**: playwright-core (browser auth)
19+
20+
## Running the MCP Server
21+
```bash
22+
bun install
23+
bun packages/server/bin/rh-agent-tools.ts
24+
```
25+
26+
## Development
27+
```bash
28+
bun run typecheck # tsc --noEmit on both packages
29+
bun run check # biome lint + format
30+
npx vitest run # all tests (use vitest, NOT bun test)
31+
```
32+
33+
## Skills
34+
Canonical skill source is `packages/server/skills/`. Local `.claude/skills/` contains symlinks for development.
35+
36+
Install MCP server + skills: `bun packages/server/bin/rh-agent-tools.ts install`
37+
38+
Skills use three-layer progressive disclosure:
39+
1. **SKILL.md** — MCP tool orchestration (default)
40+
2. **reference.md** — MCP tool API details (loaded on demand)
41+
3. **client-api.md** — TypeScript client library patterns (advanced, loaded on demand)
42+
43+
Available skills:
44+
- `robinhood-setup` - Initial auth setup
45+
- `robinhood-portfolio` - Portfolio and holdings
46+
- `robinhood-research` - Stock research and analysis
47+
- `robinhood-trade` - Order placement with safety checks
48+
- `robinhood-options` - Options chain analysis
49+
50+
## Client Patterns
51+
```typescript
52+
import { RobinhoodClient, getClient } from "@rh-agent-tools/client";
53+
54+
// Class-based
55+
const client = new RobinhoodClient();
56+
await client.restoreSession();
57+
const quotes = await client.getQuotes("AAPL");
58+
59+
// Singleton
60+
const rh = getClient();
61+
await rh.restoreSession();
62+
```
63+
- All methods are `async` (native `fetch` under the hood)
64+
- Multi-account is first-class: every account-scoped method accepts `accountNumber`
65+
- Session cached to `~/.rh-agent-tools/session.enc` (AES-256-GCM, key in OS keychain)
66+
- Proper exceptions: `AuthenticationError`, `APIError`
67+
- **Do NOT use `phoenix.robinhood.com`** — it rejects TLS. Use `api.robinhood.com` endpoints only.
68+
69+
## Safety Rules
70+
- **NEVER** place bulk cancel operations
71+
- **NEVER** call fund transfer functions
72+
- **ALWAYS** confirm with user before placing any order
73+
- Order tools require explicit parameters - no defaults that could cause accidental trades
74+
75+
## Testing
76+
```bash
77+
npx vitest run
78+
```
79+
Tests use `vi.mock()` to mock HTTP layer — no real API calls. Use `vitest` (not `bun test`) for correct module isolation.

CODE_OF_CONDUCT.md

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# Contributor Covenant Code of Conduct
2+
3+
## Our Pledge
4+
5+
We as members, contributors, and leaders pledge to make participation in our
6+
community a welcoming experience for everyone.
7+
8+
## Our Standards
9+
10+
Examples of behavior that contributes to a positive environment:
11+
12+
- Using welcoming and inclusive language
13+
- Being respectful of differing viewpoints and experiences
14+
- Gracefully accepting constructive criticism
15+
- Focusing on what is best for the community
16+
- Showing empathy towards other community members
17+
18+
Examples of unacceptable behavior:
19+
20+
- Trolling, insulting or derogatory comments, and personal or political attacks
21+
- Public or private harassment
22+
- Publishing others' private information without explicit permission
23+
- Other conduct which could reasonably be considered inappropriate in a
24+
professional setting
25+
26+
## Our Responsibilities
27+
28+
Project maintainers are responsible for clarifying the standards of acceptable
29+
behavior and are expected to take appropriate and fair corrective action in
30+
response to any instances of unacceptable behavior.
31+
32+
## Scope
33+
34+
This Code of Conduct applies within all project spaces, and also applies when
35+
an individual is representing the project in public spaces.
36+
37+
## Enforcement
38+
39+
Instances of unacceptable behavior may be reported to the project team at
40+
**kevin@taji.finance**. All complaints will be reviewed and investigated
41+
promptly and fairly.
42+
43+
## Attribution
44+
45+
This Code of Conduct is adapted from the [Contributor Covenant](https://www.contributor-covenant.org),
46+
version 2.1, available at
47+
https://www.contributor-covenant.org/version/2/1/code_of_conduct.html.

0 commit comments

Comments
 (0)