|
1 | | -# CLAUDE.md |
| 1 | +# AGENTS.md |
2 | 2 |
|
3 | | -This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository. |
| 3 | +## Project overview |
| 4 | +This is the official Ruby SDK for the Model Context Protocol (MCP), implementing both server and client functionality for JSON-RPC 2.0 based communication between LLM applications and context providers. |
4 | 5 |
|
5 | | -## Development Commands |
| 6 | +## Dev environment setup |
| 7 | +- Ruby 3.2.0+ required |
| 8 | +- Run `bundle install` to install dependencies |
| 9 | +- Dependencies: `json_rpc_handler` ~> 0.1, `json-schema` >= 4.1 |
6 | 10 |
|
7 | | -### Core Commands |
| 11 | +## Build and test commands |
8 | 12 | - `bundle install` - Install dependencies |
9 | 13 | - `rake test` - Run all tests |
10 | 14 | - `rake rubocop` - Run linter |
11 | 15 | - `rake` - Run tests and linting (default task) |
12 | | - |
13 | | -### Testing |
14 | 16 | - `ruby -I lib -I test test/path/to/specific_test.rb` - Run single test file |
15 | | -- Test files are located in `test/` directory with `_test.rb` suffix |
16 | | - |
17 | | -### Gem Management |
18 | 17 | - `gem build mcp.gemspec` - Build the gem |
19 | | -- Releases are triggered by updating version in `lib/mcp/version.rb` and merging to main |
20 | 18 |
|
21 | | -## Architecture Overview |
| 19 | +## Testing instructions |
| 20 | +- Test files are in `test/` directory with `_test.rb` suffix |
| 21 | +- Run full test suite with `rake test` |
| 22 | +- Run individual tests with `ruby -I lib -I test test/path/to/file_test.rb` |
| 23 | +- Tests should pass before submitting PRs |
| 24 | + |
| 25 | +## Code style guidelines |
| 26 | +- Follow RuboCop rules (run `rake rubocop`) |
| 27 | +- Use frozen string literals |
| 28 | +- Follow Ruby community conventions |
| 29 | +- Keep dependencies minimal |
| 30 | + |
| 31 | +## Commit message conventions |
| 32 | +- Use conventional commit format when possible |
| 33 | +- Include clear, descriptive commit messages |
| 34 | +- Releases are triggered by updating version in `lib/mcp/version.rb` and merging to main |
22 | 35 |
|
23 | | -This is the official Ruby SDK for the Model Context Protocol (MCP), implementing both server and client functionality for JSON-RPC 2.0 based communication between LLM applications and context providers. |
| 36 | +## Architecture overview |
24 | 37 |
|
25 | 38 | ### Core Components |
26 | 39 |
|
@@ -68,7 +81,12 @@ This is the official Ruby SDK for the Model Context Protocol (MCP), implementing |
68 | 81 | - `json-schema` >= 4.1 - Schema validation |
69 | 82 | - Ruby 3.2.0+ required |
70 | 83 |
|
71 | | -### Example Integration Patterns |
72 | | -- Rails controllers: Use `server.handle_json(request.body.read)` for HTTP endpoints |
73 | | -- Command-line tools: Use `StdioTransport.new(server).open` for CLI applications |
74 | | -- HTTP services: Use `StreamableHttpTransport` for web-based servers |
| 84 | +### Integration patterns |
| 85 | +- **Rails controllers**: Use `server.handle_json(request.body.read)` for HTTP endpoints |
| 86 | +- **Command-line tools**: Use `StdioTransport.new(server).open` for CLI applications |
| 87 | +- **HTTP services**: Use `StreamableHttpTransport` for web-based servers |
| 88 | + |
| 89 | +### Component definition patterns |
| 90 | +1. **Class inheritance**: `class MyTool < MCP::Tool` |
| 91 | +2. **Define methods**: `MCP::Tool.define(name: "my_tool") { ... }` |
| 92 | +3. **Server registration**: `server.define_tool(name: "my_tool") { ... }` |
0 commit comments