Skip to content

Commit ce8fdf5

Browse files
committed
Make it easier to run the inspector
1 parent 11cb72f commit ce8fdf5

File tree

3 files changed

+25
-48
lines changed

3 files changed

+25
-48
lines changed

README.md

Lines changed: 14 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,14 @@ Chatwerk provides AI tool integration for the [QueryPackwerk](https://github.com
44

55
## Installation
66

7-
Install the gem and add to your application's Gemfile:
7+
Install the gem, either add in to your packwerk'd application's Gemfile:
88

99
```ruby
10-
gem 'chatwerk', group: :development
11-
```
12-
13-
And then execute:
14-
15-
```bash
10+
$ bundle add chatwerk
1611
$ bundle install
1712
```
1813

19-
Or install it yourself:
14+
or install it on its own:
2015

2116
```bash
2217
$ gem install chatwerk
@@ -26,33 +21,23 @@ $ gem install chatwerk
2621

2722
### Starting the MCP Server
2823

29-
Start the MCP server in your Rails application directory:
30-
31-
```bash
32-
$ chatwerk_mcp
33-
```
34-
35-
By default, the server runs on port 7531. You can specify a different port:
24+
You can test the inspector to see if it's working
3625

3726
```bash
38-
$ chatwerk_mcp --port=9000
27+
$ chatwerk inspect
3928
```
4029

4130
### Connecting with Cursor IDE
4231

4332
To use Chatwerk with Cursor:
4433

45-
1. Start the MCP server in your project directory:
46-
```bash
47-
cd /your/rails/project
48-
chatwerk_mcp
49-
```
34+
1. In Cursor, open Settings > MCP
5035

51-
2. In Cursor, open Settings > Extensions > Model Context Providers.
36+
2. Add a new MCP connection as a command
37+
Name: `chatwerk`
38+
Command: `chatwerk mcp`
5239

53-
3. Add a new MCP connection with the URL: `http://localhost:7531/mcp/context`
54-
55-
4. Now you can ask Cursor questions about your Packwerk structure!
40+
3. Ask Cursor to check all the tools on packwerk. Give it an example pack name (partial strings work)
5641

5742
### Example Queries for Cursor
5843

@@ -63,31 +48,13 @@ Once connected, you can ask Cursor questions about your Packwerk structure:
6348
- "What packages depend on package Y?"
6449
- "Show me all the violations for package Z"
6550
- "How difficult would it be to separate package X from its dependencies?"
66-
- "What code patterns are used to access package Y?"
67-
68-
## API Reference
69-
70-
Chatwerk provides a structured API for accessing Packwerk information. This API powers the MCP server but can also be used directly in your Ruby code:
71-
72-
```ruby
73-
require 'chatwerk'
74-
75-
# Get detailed information about a package
76-
Chatwerk::API.package_info('packs/my_package')
77-
78-
# Get dependencies of a package
79-
Chatwerk::API.package_dependencies('packs/my_package')
80-
81-
# Find usage locations of a package
82-
Chatwerk::API.find_usage_locations('packs/my_package')
83-
84-
# Assess difficulty of separating a package
85-
Chatwerk::API.assess_separation_difficulty('packs/my_package')
86-
```
51+
- "What code patterns are used to access Constant on package Y?"
8752

8853
## Development
8954

90-
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
55+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests.
56+
57+
Run `bin/inspect`
9158

9259
## Contributing
9360

bin/inspect

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
11
#!/bin/bash
22

3-
npx @modelcontextprotocol/inspector bundle exec exe/chatwerk mcp
3+
if [ -n "$1" ]; then
4+
npx @modelcontextprotocol/inspector -e PWD="$1" bundle exec exe/chatwerk mcp
5+
else
6+
npx @modelcontextprotocol/inspector bundle exec exe/chatwerk mcp
7+
fi

lib/chatwerk/cli.rb

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,12 @@ def mcp
1414
MCP::Server.new(Chatwerk::Mcp.new).serve(MCP::Server::StdioClientConnection.new)
1515
end
1616

17+
desc 'inspect [WORKING_DIRECTORY]', 'Run the MCP inspector with an optional working directory path (defaults to current directory)'
18+
def inspect(working_directory = nil)
19+
pwd = working_directory || Dir.pwd
20+
system("npx @modelcontextprotocol/inspector -e PWD=#{pwd} bundle exec exe/chatwerk mcp")
21+
end
22+
1723
desc 'version', 'Display Chatwerk version'
1824
def version
1925
puts "Chatwerk #{Chatwerk::VERSION}"

0 commit comments

Comments
 (0)