Skip to content

Commit e19195f

Browse files
authored
Merge pull request #3 from ServiceStack/claude/add-mcp-connection-examples-011CUrKTJF3LHvJ6pJxXPWAH
Add MCP connection examples for Claude tools
2 parents 251c2c0 + b2bfb78 commit e19195f

1 file changed

Lines changed: 175 additions & 0 deletions

File tree

README.md

Lines changed: 175 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,3 +50,178 @@ Or multiple APIs:
5050
npx mcp-apis ./app.json --apis QueryPosts,CreatePost,UpdatePost,DeletePost
5151
```
5252

53+
## Connecting to Claude Tools
54+
55+
### Claude Desktop App
56+
57+
To use this MCP server with the Claude Desktop app, add it to your Claude Desktop configuration file:
58+
59+
**On macOS:** `~/Library/Application Support/Claude/claude_desktop_config.json`
60+
61+
**On Windows:** `%APPDATA%/Claude/claude_desktop_config.json`
62+
63+
**On Linux:** `~/.config/Claude/claude_desktop_config.json`
64+
65+
Add the following configuration:
66+
67+
```json
68+
{
69+
"mcpServers": {
70+
"servicestack": {
71+
"command": "npx",
72+
"args": [
73+
"mcp-apis",
74+
"/absolute/path/to/your/app.json"
75+
]
76+
}
77+
}
78+
}
79+
```
80+
81+
For example, if your app.json is in your home directory:
82+
83+
```json
84+
{
85+
"mcpServers": {
86+
"techstacks-api": {
87+
"command": "npx",
88+
"args": [
89+
"mcp-apis",
90+
"/Users/yourname/projects/techstacks/app.json",
91+
"--tag",
92+
"Posts"
93+
]
94+
}
95+
}
96+
}
97+
```
98+
99+
After saving the configuration, restart Claude Desktop. The MCP server will appear in the MCP menu (click the 🔌 icon at the bottom of the chat window).
100+
101+
### Claude Code CLI
102+
103+
To use this MCP server with Claude Code, add it to your MCP settings file:
104+
105+
**Location:** `~/.config/claude-code/mcp_settings.json`
106+
107+
Add the following configuration:
108+
109+
```json
110+
{
111+
"mcpServers": {
112+
"servicestack": {
113+
"command": "npx",
114+
"args": [
115+
"mcp-apis",
116+
"/absolute/path/to/your/app.json"
117+
]
118+
}
119+
}
120+
}
121+
```
122+
123+
Example with filtering options:
124+
125+
```json
126+
{
127+
"mcpServers": {
128+
"my-api": {
129+
"command": "npx",
130+
"args": [
131+
"mcp-apis",
132+
"/home/user/projects/myapp/app.json",
133+
"--apis",
134+
"QueryPosts,CreatePost,UpdatePost"
135+
]
136+
}
137+
}
138+
}
139+
```
140+
141+
After saving, restart Claude Code. You can verify the MCP server is connected by checking the MCP status in the CLI.
142+
143+
### Per-Project Configuration (Claude Code)
144+
145+
For project-specific MCP servers, create a `.mcp_settings.json` file in your project root:
146+
147+
```json
148+
{
149+
"mcpServers": {
150+
"local-api": {
151+
"command": "npx",
152+
"args": [
153+
"mcp-apis",
154+
"./app.json"
155+
]
156+
}
157+
}
158+
}
159+
```
160+
161+
Claude Code will automatically load this configuration when working in that directory.
162+
163+
### Using with Other MCP Clients
164+
165+
Any MCP-compatible client can connect to this server using the stdio transport. The general pattern is:
166+
167+
```json
168+
{
169+
"command": "npx",
170+
"args": ["mcp-apis", "/path/to/app.json"]
171+
}
172+
```
173+
174+
Or if you've installed globally:
175+
176+
```json
177+
{
178+
"command": "mcp-apis",
179+
"args": ["/path/to/app.json"]
180+
}
181+
```
182+
183+
### Configuration Options
184+
185+
All command-line options work in MCP client configurations:
186+
187+
- **Filter by tag:**
188+
```json
189+
"args": ["mcp-apis", "./app.json", "--tag", "Posts"]
190+
```
191+
192+
- **Filter specific APIs:**
193+
```json
194+
"args": ["mcp-apis", "./app.json", "--apis", "QueryPosts,CreatePost"]
195+
```
196+
197+
- **Combine multiple filters:**
198+
```json
199+
"args": ["mcp-apis", "./app.json", "--tag", "TechStacks", "--apis", "QueryPosts"]
200+
```
201+
202+
### Example Usage in Claude
203+
204+
Once connected, you can interact with your ServiceStack APIs naturally:
205+
206+
```
207+
You: "Get the post with ID 123"
208+
Claude: [Uses the GetPost API to fetch post 123]
209+
210+
You: "Create a new post titled 'Hello World' in organization 1"
211+
Claude: [Uses the CreatePost API with the provided parameters]
212+
213+
You: "Search for posts about TypeScript"
214+
Claude: [Uses the QueryPosts API to search for relevant posts]
215+
```
216+
217+
### Troubleshooting
218+
219+
If the MCP server doesn't appear:
220+
221+
1. **Verify the path:** Make sure the path to your `app.json` file is absolute, not relative
222+
2. **Check the file exists:** Ensure your `app.json` file exists at the specified path
223+
3. **Restart the client:** After updating the configuration, restart Claude Desktop or Claude Code
224+
4. **Check logs:**
225+
- Claude Desktop: Check `~/Library/Logs/Claude/` (macOS) or equivalent on your OS
226+
- Claude Code: Look for MCP-related errors in the CLI output
227+

0 commit comments

Comments
 (0)