Skip to content

Commit ac9fe98

Browse files
authored
feat: add CLAUDE.md for Claude Code guidance (#15)
* feat: add CLAUDE.md for Claude Code guidance Created comprehensive guidance file for Claude Code with: - Essential development commands (make targets) - High-level code architecture overview - Core components documentation (StackOneToolSet, Models, Parser, MCP Server) - Key development patterns and authentication - Imports of existing Cursor rules for consistency * fix: correct import syntax and remove duplications in CLAUDE.md - Fixed import statements to not include .mdc extension - Fixed references to imported files using @filename syntax - Removed duplicated content covered by imported Cursor rules * fix: use correct reference syntax for imported files - Use @.cursor/rules/filename syntax when referencing imported files * fix: use direct file references instead of imports - Changed from @import to direct @ references - Added ./ for relative paths - Formatted as bullet list for clarity * fix: use consistent @./ syntax for all file references - Updated all references to use @./.cursor/rules/ pattern - Ensures consistency throughout the document * chore: add mcp
1 parent e510f43 commit ac9fe98

File tree

2 files changed

+132
-0
lines changed

2 files changed

+132
-0
lines changed

.mcp.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"mcpServers": {
3+
"context7": {
4+
"type": "http",
5+
"url": "https://mcp.context7.com/mcp"
6+
},
7+
"grep": {
8+
"type": "http",
9+
"url": "https://mcp.grep.app"
10+
}
11+
}
12+
}

CLAUDE.md

Lines changed: 120 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
1+
# CLAUDE.md
2+
3+
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
4+
5+
## Cursor Rules
6+
7+
- @./.cursor/rules/package-installation
8+
- @./.cursor/rules/no-relative-imports
9+
- @./.cursor/rules/uv-scripts
10+
- @./.cursor/rules/release-please-standards
11+
- @./.cursor/rules/examples-standards
12+
13+
## Project Overview
14+
15+
StackOne AI SDK is a Python library that provides a unified interface for accessing various SaaS tools through AI-friendly APIs. It acts as a bridge between AI applications and multiple SaaS platforms (HRIS, CRM, ATS, LMS, Marketing, etc.) with support for OpenAI, LangChain, CrewAI, and Model Context Protocol (MCP).
16+
17+
## Essential Development Commands
18+
19+
```bash
20+
# Setup and installation
21+
make install # Install dependencies and pre-commit hooks
22+
23+
# Code quality
24+
make lint # Run ruff linting
25+
make lint-fix # Auto-fix linting issues
26+
make mypy # Run type checking
27+
28+
# Testing
29+
make test # Run all tests
30+
make test-tools # Run tool-specific tests
31+
make test-examples # Run example tests
32+
33+
# Documentation
34+
make docs-serve # Build and serve docs locally (http://localhost:8000)
35+
make docs-build # Build docs for deployment
36+
37+
# MCP Development
38+
make mcp-inspector # Run MCP server inspector for debugging
39+
```
40+
41+
## Code Architecture
42+
43+
### Core Components
44+
45+
1. **StackOneToolSet** (`stackone_ai/toolset.py`): Main entry point
46+
- Handles authentication (API key + optional account ID)
47+
- Manages tool loading with glob pattern filtering
48+
- Provides format converters for OpenAI/LangChain
49+
50+
2. **Models** (`stackone_ai/models.py`): Data structures
51+
- `StackOneTool`: Base class with execution logic
52+
- `Tools`: Container for managing multiple tools
53+
- Format converters for different AI frameworks
54+
55+
3. **OpenAPI Parser** (`stackone_ai/specs/parser.py`): Spec conversion
56+
- Converts OpenAPI specs to tool definitions
57+
- Handles file upload detection (`format: binary``type: file`)
58+
- Resolves schema references
59+
60+
4. **MCP Server** (`stackone_ai/server.py`): Protocol implementation
61+
- Async tool execution
62+
- CLI interface via `stackmcp` command
63+
64+
### OpenAPI Specifications
65+
66+
All tool definitions are generated from OpenAPI specs in `stackone_ai/oas/`:
67+
- `core.json`, `ats.json`, `crm.json`, `documents.json`, `hris.json`, `iam.json`, `lms.json`, `marketing.json`
68+
69+
## Key Development Patterns
70+
71+
### Tool Filtering
72+
```python
73+
# Use glob patterns for tool selection
74+
tools = StackOneToolSet(include_tools=["hris_*", "!hris_create_*"])
75+
```
76+
77+
### Authentication
78+
```python
79+
# Uses environment variables or direct configuration
80+
toolset = StackOneToolSet(
81+
api_key="your-api-key", # or STACKONE_API_KEY env var
82+
account_id="optional-id" # or STACKONE_ACCOUNT_ID env var
83+
)
84+
```
85+
86+
### Type Safety
87+
- Full type annotations required (Python 3.11+)
88+
- Strict mypy configuration
89+
- Use generics for better IDE support
90+
91+
### Testing
92+
- Snapshot testing for tool parsing (`tests/snapshots/`)
93+
- Async tests use `pytest-asyncio`
94+
- Example validation: See @./.cursor/rules/examples-standards
95+
96+
## Important Considerations
97+
98+
1. **Dependencies**: See @./.cursor/rules/package-installation for uv dependency management
99+
2. **Pre-commit**: Hooks configured for ruff and mypy - run on all commits
100+
3. **Python Version**: Requires Python >=3.11
101+
4. **Error Handling**: Custom exceptions (`StackOneError`, `StackOneAPIError`)
102+
5. **File Uploads**: Binary parameters auto-detected from OpenAPI specs
103+
6. **Context Window**: Tool loading warns when loading all tools (large context)
104+
105+
## Common Tasks
106+
107+
### Adding New SaaS Integration
108+
1. Add OpenAPI spec to `stackone_ai/oas/`
109+
2. Parser automatically converts to tool definitions
110+
3. Test with `make test-tools`
111+
112+
### Modifying Tool Behavior
113+
- Core execution logic in `StackOneTool.execute()` method
114+
- HTTP configuration via `ExecuteConfig` class
115+
- Response handling in `_process_response()`
116+
117+
### Updating Documentation
118+
- Examples requirements: See @./.cursor/rules/examples-standards
119+
- Run `make docs-serve` to preview changes
120+
- MkDocs config in `mkdocs.yml`

0 commit comments

Comments
 (0)