mirror of
https://github.com/bendtherules/ask262.git
synced 2026-08-18 13:21:55 +00:00
feat: Add env support + small fixes
This commit is contained in:
+2
-2
@@ -32,5 +32,5 @@ ASK262_EMBEDDING_PROVIDER=ollama
|
|||||||
# HTTP SERVER CONFIGURATION
|
# HTTP SERVER CONFIGURATION
|
||||||
# =============================================================================
|
# =============================================================================
|
||||||
|
|
||||||
# Port for the HTTP MCP server (optional, defaults to 3000)
|
# Port for the HTTP MCP server (optional, defaults to 8081)
|
||||||
# ASK262_PORT=3000
|
# ASK262_PORT=8081
|
||||||
|
|||||||
Vendored
+1
-1
@@ -5,7 +5,7 @@
|
|||||||
"name": "Debug: MCP Server",
|
"name": "Debug: MCP Server",
|
||||||
"type": "bun",
|
"type": "bun",
|
||||||
"request": "launch",
|
"request": "launch",
|
||||||
"program": "${workspaceFolder}/src/mcp-server.ts",
|
"program": "${workspaceFolder}/src/mcp-server-stdio.ts",
|
||||||
"cwd": "${workspaceFolder}",
|
"cwd": "${workspaceFolder}",
|
||||||
"stopOnEntry": false,
|
"stopOnEntry": false,
|
||||||
"watchMode": false
|
"watchMode": false
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ ask262/
|
|||||||
│ ├── htmlAddInternalMethodLink.ts # Adds internal method links
|
│ ├── htmlAddInternalMethodLink.ts # Adds internal method links
|
||||||
│ ├── text-splitters/ # Text chunking utilities
|
│ ├── text-splitters/ # Text chunking utilities
|
||||||
│ └── utils/ # Formatting utilities
|
│ └── utils/ # Formatting utilities
|
||||||
│ ├── mcp-server.ts # MCP server for external tool integration
|
│ ├── mcp-server-stdio.ts # MCP server (stdio transport)
|
||||||
│ └── test/ # Manual verification tests
|
│ └── test/ # Manual verification tests
|
||||||
│ └── manual/
|
│ └── manual/
|
||||||
│ ├── verify-db.ts # Verify database contents
|
│ ├── verify-db.ts # Verify database contents
|
||||||
@@ -65,7 +65,7 @@ bun test # Run all tests
|
|||||||
bun run test-evaluate # Test evaluate in engine262 tool
|
bun run test-evaluate # Test evaluate in engine262 tool
|
||||||
bun run test-search-spec-sections "query" # Test vector search tool with query
|
bun run test-search-spec-sections "query" # Test vector search tool with query
|
||||||
bun run agent "Query" # Run agent with question
|
bun run agent "Query" # Run agent with question
|
||||||
bun run mcp-server # Start MCP server (stdio transport)
|
bun run ask262-stdio # Start MCP server (stdio transport)
|
||||||
bun run test-mcp-server # Test MCP server with all tools
|
bun run test-mcp-server # Test MCP server with all tools
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -91,7 +91,7 @@ Add to your MCP client configuration:
|
|||||||
"mcpServers": {
|
"mcpServers": {
|
||||||
"ask262": {
|
"ask262": {
|
||||||
"command": "bun",
|
"command": "bun",
|
||||||
"args": ["run", "/path/to/ask262/src/mcp-server.ts"],
|
"args": ["run", "/path/to/ask262/src/mcp-server-stdio.ts"],
|
||||||
"cwd": "/path/to/ask262"
|
"cwd": "/path/to/ask262"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -107,7 +107,7 @@ Add to your MCP client configuration:
|
|||||||
"mcp": {
|
"mcp": {
|
||||||
"ask262": {
|
"ask262": {
|
||||||
"type": "local",
|
"type": "local",
|
||||||
"command": ["bun", "run", "src/mcp-server.ts"],
|
"command": ["bun", "run", "src/mcp-server-stdio.ts"],
|
||||||
"enabled": true,
|
"enabled": true,
|
||||||
"environment": {
|
"environment": {
|
||||||
"OLLAMA_HOST": "http://localhost:11434"
|
"OLLAMA_HOST": "http://localhost:11434"
|
||||||
@@ -124,7 +124,7 @@ Add to your MCP client configuration:
|
|||||||
"mcp": {
|
"mcp": {
|
||||||
"ask262": {
|
"ask262": {
|
||||||
"type": "remote",
|
"type": "remote",
|
||||||
"url": "http://localhost:3000/mcp",
|
"url": "http://localhost:8081/mcp",
|
||||||
"enabled": true
|
"enabled": true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -133,7 +133,7 @@ Add to your MCP client configuration:
|
|||||||
|
|
||||||
Start the HTTP server first:
|
Start the HTTP server first:
|
||||||
```bash
|
```bash
|
||||||
bun run mcp-http # Development
|
bun run ask262-http # Development
|
||||||
ask262-http # After npm install -g
|
ask262-http # After npm install -g
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ nano .env # or use your preferred editor
|
|||||||
- `ASK262_EMBEDDING_PROVIDER`: Choose `ollama` (local) or `fireworks` (cloud). Default: `ollama`
|
- `ASK262_EMBEDDING_PROVIDER`: Choose `ollama` (local) or `fireworks` (cloud). Default: `ollama`
|
||||||
- `OLLAMA_HOST`: Ollama server URL. Default: `http://localhost:11434`
|
- `OLLAMA_HOST`: Ollama server URL. Default: `http://localhost:11434`
|
||||||
- `FIREWORKS_API_KEY`: Required if using Fireworks. Get from https://app.fireworks.ai
|
- `FIREWORKS_API_KEY`: Required if using Fireworks. Get from https://app.fireworks.ai
|
||||||
- `ASK262_PORT`: HTTP server port. Default: `3000`
|
- `ASK262_PORT`: HTTP server port. Default: `8081`
|
||||||
|
|
||||||
**Example `.env`:**
|
**Example `.env`:**
|
||||||
```bash
|
```bash
|
||||||
@@ -98,7 +98,7 @@ Add to your MCP client configuration using `bunx` (no installation required):
|
|||||||
"mcp": {
|
"mcp": {
|
||||||
"ask262": {
|
"ask262": {
|
||||||
"type": "remote",
|
"type": "remote",
|
||||||
"url": "http://localhost:3000/mcp",
|
"url": "http://localhost:8081/mcp",
|
||||||
"enabled": true
|
"enabled": true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -107,7 +107,7 @@ Add to your MCP client configuration using `bunx` (no installation required):
|
|||||||
|
|
||||||
Start the HTTP server first:
|
Start the HTTP server first:
|
||||||
```bash
|
```bash
|
||||||
bun run mcp-http # Development
|
bun run ask262-http # Development
|
||||||
ask262-http # After npm install -g
|
ask262-http # After npm install -g
|
||||||
# Or with custom port:
|
# Or with custom port:
|
||||||
ASK262_PORT=8080 ask262-http
|
ASK262_PORT=8080 ask262-http
|
||||||
|
|||||||
+4
-3
@@ -7,9 +7,9 @@
|
|||||||
"bun": ">=1.0.0"
|
"bun": ">=1.0.0"
|
||||||
},
|
},
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"main": "src/mcp-server.ts",
|
"main": "src/mcp-server-stdio.ts",
|
||||||
"bin": {
|
"bin": {
|
||||||
"ask262": "src/mcp-server.ts",
|
"ask262": "src/mcp-server-stdio.ts",
|
||||||
"ask262-http": "src/mcp-server-http.ts"
|
"ask262-http": "src/mcp-server-http.ts"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
@@ -24,7 +24,8 @@
|
|||||||
"test-evaluate-timeout": "bun run src/test/manual/test-evaluate-timeout.ts",
|
"test-evaluate-timeout": "bun run src/test/manual/test-evaluate-timeout.ts",
|
||||||
"test-search-spec-sections": "bun run src/test/manual/test-search-spec-sections.ts",
|
"test-search-spec-sections": "bun run src/test/manual/test-search-spec-sections.ts",
|
||||||
"test-mcp-server": "bun run src/test/manual/test-mcp-server.ts",
|
"test-mcp-server": "bun run src/test/manual/test-mcp-server.ts",
|
||||||
"mcp-http": "bun run src/mcp-server-http.ts",
|
"ask262-stdio": "bun run src/mcp-server-stdio.ts",
|
||||||
|
"ask262-http": "bun run src/mcp-server-http.ts",
|
||||||
"test": "bun test",
|
"test": "bun test",
|
||||||
"prepublish": "npm run type-check && npm run lint && npm pack --dry-run",
|
"prepublish": "npm run type-check && npm run lint && npm pack --dry-run",
|
||||||
"release": "bash scripts/release.sh --patch"
|
"release": "bash scripts/release.sh --patch"
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ export function createEmbeddings(provider?: EmbeddingProvider): Embeddings {
|
|||||||
|
|
||||||
switch (selectedProvider) {
|
switch (selectedProvider) {
|
||||||
case "ollama": {
|
case "ollama": {
|
||||||
console.log("[Embeddings] Using Ollama provider");
|
console.error("[Embeddings] Using Ollama provider");
|
||||||
return new OllamaEmbeddings({
|
return new OllamaEmbeddings({
|
||||||
model: OLLAMA_EMBEDDING_MODEL,
|
model: OLLAMA_EMBEDDING_MODEL,
|
||||||
baseUrl: process.env.OLLAMA_HOST,
|
baseUrl: process.env.OLLAMA_HOST,
|
||||||
@@ -50,7 +50,7 @@ export function createEmbeddings(provider?: EmbeddingProvider): Embeddings {
|
|||||||
if (!apiKey) {
|
if (!apiKey) {
|
||||||
throw new Error("FIREWORKS_API_KEY environment variable is required");
|
throw new Error("FIREWORKS_API_KEY environment variable is required");
|
||||||
}
|
}
|
||||||
console.log("[Embeddings] Using Fireworks provider");
|
console.error("[Embeddings] Using Fireworks provider");
|
||||||
return new FireworksEmbeddings({
|
return new FireworksEmbeddings({
|
||||||
apiKey,
|
apiKey,
|
||||||
modelName: FIREWORKS_EMBEDDING_MODEL,
|
modelName: FIREWORKS_EMBEDDING_MODEL,
|
||||||
|
|||||||
@@ -43,8 +43,8 @@ const STORAGE_DIR = path.resolve(__dirname, "..", STORAGE_DIR_REL);
|
|||||||
// Initialize embeddings based on ASK262_EMBEDDING_PROVIDER env var
|
// Initialize embeddings based on ASK262_EMBEDDING_PROVIDER env var
|
||||||
const embeddings = createEmbeddings();
|
const embeddings = createEmbeddings();
|
||||||
|
|
||||||
// Server port (default: 3000)
|
// Server port (default: 8081)
|
||||||
const PORT = Number(process.env.ASK262_PORT) || 3000;
|
const PORT = Number(process.env.ASK262_PORT) || 8081;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Factory function to create a fresh MCP server instance.
|
* Factory function to create a fresh MCP server instance.
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import type {
|
|||||||
EvaluateToolMCPOutput,
|
EvaluateToolMCPOutput,
|
||||||
GetSectionContentMCPOutput,
|
GetSectionContentMCPOutput,
|
||||||
SearchSpecMCPOutput,
|
SearchSpecMCPOutput,
|
||||||
} from "../../mcp-server.js";
|
} from "../../mcp-server-stdio.js";
|
||||||
|
|
||||||
async function testMCPServer() {
|
async function testMCPServer() {
|
||||||
console.log("Starting MCP Server tests...\n");
|
console.log("Starting MCP Server tests...\n");
|
||||||
@@ -17,7 +17,7 @@ async function testMCPServer() {
|
|||||||
// Create transport connecting to the server
|
// Create transport connecting to the server
|
||||||
const transport = new StdioClientTransport({
|
const transport = new StdioClientTransport({
|
||||||
command: "bun",
|
command: "bun",
|
||||||
args: ["run", "src/mcp-server.ts"],
|
args: ["run", "src/mcp-server-stdio.ts"],
|
||||||
});
|
});
|
||||||
|
|
||||||
// Create client
|
// Create client
|
||||||
|
|||||||
Reference in New Issue
Block a user