Skip to content

Commit e83c813

Browse files
committed
lint
1 parent 7e2227a commit e83c813

File tree

2 files changed

+35
-4
lines changed

2 files changed

+35
-4
lines changed

examples/README.md

Lines changed: 31 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,19 @@ This directory contains examples demonstrating how to use the mcp-use library wi
1515
## Running Examples
1616

1717
First, build the library:
18+
1819
```bash
1920
npm run build
2021
```
2122

2223
Then run any example using Node.js:
24+
2325
```bash
2426
node dist/examples/example_name.js
2527
```
2628

2729
Or use the npm scripts:
30+
2831
```bash
2932
npm run example:airbnb
3033
npm run example:browser
@@ -35,32 +38,42 @@ npm run example:chat
3538
## Available Examples
3639

3740
### 1. Airbnb Search (`airbnb_use.ts`)
41+
3842
Search for accommodations using the Airbnb MCP server.
43+
3944
```bash
4045
npm run example:airbnb
4146
```
4247

4348
### 2. Browser Automation (`browser_use.ts`)
49+
4450
Control a browser using Playwright MCP server.
51+
4552
```bash
4653
npm run example:browser
4754
```
4855

4956
### 3. Interactive Chat (`chat_example.ts`)
57+
5058
Interactive chat session with conversation memory.
59+
5160
```bash
5261
npm run example:chat
5362
```
5463

5564
### 4. File System Operations (`filesystem_use.ts`)
65+
5666
Access and manipulate files using the filesystem MCP server.
67+
5768
```bash
5869
# First, edit the example to set your directory path
5970
npm run example:filesystem
6071
```
6172

6273
### 5. HTTP Server Connection (`http_example.ts`)
74+
6375
Connect to an MCP server via HTTP.
76+
6477
```bash
6578
# First, start the Playwright server in another terminal:
6679
npx @playwright/mcp@latest --port 8931
@@ -70,33 +83,43 @@ npm run example:http
7083
```
7184

7285
### 6. MCP Everything Test (`mcp_everything.ts`)
86+
7387
Test various MCP functionalities.
88+
7489
```bash
7590
npm run example:everything
7691
```
7792

7893
### 7. Multiple Servers (`multi_server_example.ts`)
94+
7995
Use multiple MCP servers in a single session.
96+
8097
```bash
8198
# First, edit the example to set your directory path
8299
npm run example:multi
83100
```
84101

85102
### 8. Sandboxed Environment (`sandbox_everything.ts`)
103+
86104
Run MCP servers in an E2B sandbox (requires E2B_API_KEY).
105+
87106
```bash
88107
npm run example:sandbox
89108
```
90109

91110
### 9. OAuth Authentication (`simple_oauth_example.ts`)
111+
92112
OAuth flow example with Linear.
113+
93114
```bash
94115
# First, register your app with Linear and update the client_id
95116
npm run example:oauth
96117
```
97118

98119
### 10. Blender Integration (`blender_use.ts`)
120+
99121
Control Blender 3D through MCP.
122+
100123
```bash
101124
# First, install and enable the Blender MCP addon
102125
npm run example:blender
@@ -105,12 +128,14 @@ npm run example:blender
105128
## Configuration Files
106129

107130
Some examples use JSON configuration files:
131+
108132
- `airbnb_mcp.json` - Airbnb server configuration
109133
- `browser_mcp.json` - Browser server configuration
110134

111135
## Environment Variables
112136

113137
Different examples require different API keys:
138+
114139
- **ANTHROPIC_API_KEY**: For examples using Claude (airbnb, multi_server, blender)
115140
- **OPENAI_API_KEY**: For examples using GPT (browser, chat, filesystem, http, everything)
116141
- **E2B_API_KEY**: Only for the sandbox example
@@ -127,12 +152,14 @@ Different examples require different API keys:
127152
To create a new example:
128153

129154
1. Import the necessary modules:
155+
130156
```typescript
131-
import { MCPAgent, MCPClient } from '../index.js'
132157
import { ChatOpenAI } from '@langchain/openai'
158+
import { MCPAgent, MCPClient } from '../index.js'
133159
```
134160

135161
2. Configure your MCP server:
162+
136163
```typescript
137164
const config = {
138165
mcpServers: {
@@ -145,6 +172,7 @@ To create a new example:
145172
```
146173

147174
3. Create client, LLM, and agent:
175+
148176
```typescript
149177
const client = MCPClient.fromDict(config)
150178
const llm = new ChatOpenAI({ model: 'gpt-4o' })
@@ -159,7 +187,8 @@ To create a new example:
159187
## Contributing
160188

161189
Feel free to add more examples! Make sure to:
190+
162191
1. Follow the existing code style
163192
2. Add appropriate documentation
164193
3. Update this README with your example
165-
4. Add a corresponding npm script in package.json
194+
4. Add a corresponding npm script in package.json

package.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,8 +98,10 @@
9898
},
9999
"lint-staged": {
100100
"*.{js,ts}": [
101-
"eslint --fix",
102-
"git add"
101+
"npm run lint"
102+
],
103+
"**/*.ts": [
104+
"npm run build"
103105
]
104106
}
105107
}

0 commit comments

Comments
 (0)