File size: 51,997 Bytes
891fe52 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 | # Polyhedra - Product Requirements Document
## Document Control
| Field | Value |
|-------|-------|
| **Project Name** | Polyhedra |
| **Version** | 2.0.0 |
| **Type** | MCP Tool Server |
| **Status** | Ready for Development |
| **Created** | November 26, 2024 |
| **Last Updated** | November 29, 2025 |
| **Author** | Product Team |
| **Stakeholders** | Engineering, Research Community |
### Revision History
| Version | Date | Author | Changes |
|---------|------|--------|----------|
| 2.0.0 | 2024-11-26 | Product Team | BREAKING: Removed internal LLM calls, simplified to pure MCP tool server |
| 1.x | - | Product Team | Legacy versions with built-in LLM agents |
---
## Executive Summary
### Purpose
Polyhedra is a pure Model Context Protocol (MCP) tool server designed to augment IDE-based AI assistants (Cursor, GitHub Copilot, Windsurf, VS Code) with academic research capabilities. Unlike traditional research tools, Polyhedra does not call LLMs directly—all content generation is handled by the IDE's native AI, while Polyhedra provides specialized research tools and data access.
### Key Capabilities
- **Paper Discovery**: Search and retrieve academic papers via Semantic Scholar API
- **Citation Management**: Automated BibTeX generation and reference management
- **RAG Retrieval**: Semantic search across indexed papers for relevant citations
- **Context Management**: Read/write project files for research workflow
- **Project Scaffolding**: Initialize standardized research project structures
### Target Audience
- ML/AI researchers using modern IDEs with AI assistants
- PhD students requiring streamlined research workflows
- Academic professionals seeking IDE-integrated paper management
### Success Criteria
- Sub-2-second paper search response time
- 100% valid BibTeX generation
- Support for 4+ major IDEs (Cursor, Copilot, Windsurf, VS Code)
- Setup time under 5 minutes
---
## 1. Product Overview
### 1.1 Vision
Polyhedra is a **pure MCP tool server** that extends IDE AI assistants (Cursor, GitHub Copilot, Windsurf, VS Code) with academic research capabilities.
**Polyhedra does NOT call LLMs** — all generation capabilities come from the IDE's AI.
### 1.2 Architecture Philosophy
```
┌─────────────────────────────────────────────────────────┐
│ IDE (Cursor / Copilot) │
│ ┌───────────────────────────────────────────────────┐ │
│ │ IDE's LLM (Claude/GPT) │ │
│ │ • Intent understanding │ │
│ │ • Literature review generation │ │
│ │ • Paper writing │ │
│ │ • Hypothesis generation │ │
│ └─────────────────────┬─────────────────────────────┘ │
│ │ MCP Protocol │
│ ┌─────────────────────▼─────────────────────────────┐ │
│ │ Polyhedra MCP Server │ │
│ │ • Paper search (Semantic Scholar API) │ │
│ │ • Context management (project files) │ │
│ │ • RAG retrieval (relevant papers) │ │
│ │ • Citation management (BibTeX) │ │
│ │ • File read/write │ │
│ └───────────────────────────────────────────────────┘ │
└─────────────────────────────────────────────────────────┘
```
### 1.3 What Polyhedra Does vs What IDE Does
| Capability | Polyhedra (MCP) | IDE (LLM) |
|------------|-----------------|-----------|
| Search academic papers | ✓ | |
| Fetch paper metadata & BibTeX | ✓ | |
| Read project files | ✓ | |
| Write/save files | ✓ | |
| RAG retrieval | ✓ | |
| Manage citations | ✓ | |
| Understand user intent | | ✓ |
| Generate literature review | | ✓ |
| Generate hypotheses | | ✓ |
| Write paper sections | | ✓ |
| Decide workflow | | ✓ |
### 1.4 Target Users
- ML/AI researchers using Cursor, Copilot, or Windsurf
- PhD students who want AI-assisted research workflow
- Anyone who wants academic paper tools in their IDE
### 1.5 Tech Stack
```yaml
language: Python 3.11+
mcp_framework: mcp (official SDK)
http_client: httpx
data_validation: Pydantic
bibtex_parser: bibtexparser
embeddings: sentence-transformers
vector_store: numpy (simple cosine similarity)
package_manager: uv
supported_ides:
- Cursor
- GitHub Copilot
- Windsurf
- VS Code (with MCP extension)
```
---
## 2. System Architecture
### 2.1 High-Level Architecture
```
┌─────────────────────────────────────────────────────────┐
│ MCP Server │
│ │
│ ┌─────────────────────────────────────────────────┐ │
│ │ Tool Layer │ │
│ │ search_papers | get_paper | get_context │ │
│ │ query_similar | save_file | manage_citations │ │
│ └─────────────────────┬───────────────────────────┘ │
│ │ │
│ ┌─────────────────────▼───────────────────────────┐ │
│ │ Service Layer │ │
│ │ ┌──────────┐ ┌──────────┐ ┌──────────┐ │ │
│ │ │ Papers │ │ Context │ │ Citations│ │ │
│ │ │ Service │ │ Service │ │ Service │ │ │
│ │ └──────────┘ └──────────┘ └──────────┘ │ │
│ │ ┌──────────┐ ┌──────────┐ │ │
│ │ │ RAG │ │ File │ │ │
│ │ │ Service │ │ Service │ │ │
│ │ └──────────┘ └──────────┘ │ │
│ └─────────────────────────────────────────────────┘ │
└─────────────────────────────────────────────────────────┘
```
### 2.2 Directory Structure
```
polyhedra/
├── pyproject.toml
├── README.md
├── src/
│ └── polyhedra/
│ ├── __init__.py
│ ├── server.py # MCP server entry point
│ ├── tools/
│ │ ├── __init__.py
│ │ ├── papers.py # search_papers, get_paper
│ │ ├── context.py # get_context, get_project_status
│ │ ├── retrieval.py # query_similar_papers
│ │ ├── citations.py # add_citation, get_citations
│ │ └── files.py # save_file, read_file
│ ├── services/
│ │ ├── __init__.py
│ │ ├── semantic_scholar.py
│ │ ├── context_manager.py
│ │ ├── citation_manager.py
│ │ ├── rag_service.py
│ │ └── file_service.py
│ └── schemas/
│ ├── __init__.py
│ ├── paper.py
│ └── project.py
└── tests/
├── test_tools/
└── test_services/
```
### 2.3 Project Output Structure
When used in a research project:
```
my-research/
├── .poly/
│ ├── config.yaml # Project configuration
│ └── embeddings/ # Cached paper embeddings
│ └── papers.pkl
├── literature/
│ ├── papers.json # Paper metadata (structured)
│ ├── review.md # Generated by IDE's LLM
│ └── gaps.md # Generated by IDE's LLM
├── ideas/
│ └── hypotheses.md # Generated by IDE's LLM
├── method/
│ └── design.md # Generated by IDE's LLM
├── paper/
│ ├── abstract.md
│ ├── introduction.md
│ └── ... # All generated by IDE's LLM
├── references.bib # Managed by Polyhedra
└── .cursorrules # IDE prompts for research workflow
```
---
## 3. MCP Tools Specification
### 3.1 Tool: `search_papers`
Search academic papers via Semantic Scholar.
```yaml
name: search_papers
description: |
Search for academic papers on Semantic Scholar.
Returns paper metadata including title, authors, abstract,
citations, and BibTeX entry.
input_schema:
type: object
properties:
query:
type: string
description: Search query (topic, keywords, or paper title)
limit:
type: integer
default: 20
description: Maximum number of papers to return (max 100)
year_start:
type: integer
description: Filter papers from this year onwards
year_end:
type: integer
description: Filter papers until this year
fields_of_study:
type: array
items:
type: string
description: Filter by fields (e.g., "Computer Science", "Medicine")
required: [query]
output_schema:
type: object
properties:
papers:
type: array
items:
$ref: "#/schemas/Paper"
total_results:
type: integer
query_used:
type: string
```
### 3.2 Tool: `get_paper`
Get detailed information for a specific paper.
```yaml
name: get_paper
description: |
Get detailed information about a specific paper by its ID.
Returns full metadata, abstract, BibTeX, and citation context.
input_schema:
type: object
properties:
paper_id:
type: string
description: Semantic Scholar paper ID or DOI or ArXiv ID
required: [paper_id]
output_schema:
type: object
properties:
paper:
$ref: "#/schemas/Paper"
references:
type: array
description: Papers this paper cites
citations:
type: array
description: Papers that cite this paper
```
### 3.3 Tool: `get_context`
Read project files for context.
```yaml
name: get_context
description: |
Read one or more project files to provide context for generation.
Use this before writing paper sections to get relevant background.
input_schema:
type: object
properties:
files:
type: array
items:
type: string
description: |
File paths relative to project root.
Common paths: literature/papers.json, literature/review.md,
ideas/hypotheses.md, method/design.md
include_papers:
type: boolean
default: false
description: If true, include full paper metadata from papers.json
required: [files]
output_schema:
type: object
properties:
contents:
type: object
description: Map of filename to file content
missing_files:
type: array
description: Files that were requested but don't exist
```
### 3.4 Tool: `query_similar_papers`
RAG retrieval for relevant papers.
```yaml
name: query_similar_papers
description: |
Find papers most relevant to a query using semantic similarity.
Useful when writing sections that need specific citations.
Papers must first be indexed via index_papers.
input_schema:
type: object
properties:
query:
type: string
description: Natural language query describing what you need
k:
type: integer
default: 5
description: Number of papers to return
required: [query]
output_schema:
type: object
properties:
papers:
type: array
items:
type: object
properties:
paper_id:
type: string
title:
type: string
abstract:
type: string
relevance_score:
type: number
bibtex_key:
type: string
```
### 3.5 Tool: `index_papers`
Index papers for RAG retrieval.
```yaml
name: index_papers
description: |
Index papers from papers.json for semantic search.
Call this after search_papers to enable query_similar_papers.
input_schema:
type: object
properties:
papers_file:
type: string
default: "literature/papers.json"
description: Path to papers JSON file
required: []
output_schema:
type: object
properties:
indexed_count:
type: integer
status:
type: string
```
### 3.6 Tool: `save_file`
Save generated content to project.
```yaml
name: save_file
description: |
Save content to a file in the project.
Creates parent directories if they don't exist.
input_schema:
type: object
properties:
path:
type: string
description: File path relative to project root
content:
type: string
description: Content to write
append:
type: boolean
default: false
description: If true, append instead of overwrite
required: [path, content]
output_schema:
type: object
properties:
success:
type: boolean
path:
type: string
bytes_written:
type: integer
```
### 3.7 Tool: `add_citation`
Add a citation to references.bib.
```yaml
name: add_citation
description: |
Add a BibTeX entry to the project's references.bib file.
Handles duplicates automatically (skips if key exists).
input_schema:
type: object
properties:
bibtex:
type: string
description: BibTeX entry string
paper_id:
type: string
description: |
Alternative: Semantic Scholar paper ID.
Will fetch BibTeX automatically.
required: [] # One of bibtex or paper_id required
output_schema:
type: object
properties:
key:
type: string
description: The BibTeX citation key
added:
type: boolean
description: True if newly added, false if already existed
```
### 3.8 Tool: `get_citations`
List all citations in references.bib.
```yaml
name: get_citations
description: |
Get all citation keys and entries from references.bib.
Useful for checking what papers are already cited.
input_schema:
type: object
properties:
keys_only:
type: boolean
default: true
description: If true, return only keys. If false, return full entries.
required: []
output_schema:
type: object
properties:
citations:
type: array
items:
type: object
properties:
key:
type: string
title:
type: string
authors:
type: string
year:
type: integer
count:
type: integer
```
### 3.9 Tool: `get_project_status`
Get current project state.
```yaml
name: get_project_status
description: |
Get overview of current research project state.
Shows which files exist and project progress.
input_schema:
type: object
properties: {}
required: []
output_schema:
type: object
properties:
project_root:
type: string
existing_files:
type: array
items:
type: string
paper_count:
type: integer
citation_count:
type: integer
indexed_for_rag:
type: boolean
```
### 3.10 Tool: `init_project`
Initialize a new research project.
```yaml
name: init_project
description: |
Initialize a new research project with standard directory structure.
input_schema:
type: object
properties:
path:
type: string
default: "."
description: Project root path
name:
type: string
description: Project name (used in config)
required: []
output_schema:
type: object
properties:
created_dirs:
type: array
created_files:
type: array
project_root:
type: string
```
---
## 4. Data Schemas
### 4.1 Paper Schema
```python
# schemas/paper.py
from pydantic import BaseModel
from typing import Optional
class Paper(BaseModel):
id: str # Semantic Scholar ID
title: str
authors: list[str]
year: int
venue: Optional[str]
abstract: str
citation_count: int
bibtex_key: str # e.g., "vaswani2017attention"
bibtex_entry: str # Full BibTeX string
url: Optional[str]
pdf_url: Optional[str]
fields_of_study: list[str]
```
### 4.2 Project Config Schema
```python
# schemas/project.py
from pydantic import BaseModel
from typing import Optional
class ProjectConfig(BaseModel):
name: str
created_at: str
paper_count: int = 0
indexed: bool = False
```
---
## 5. Service Implementations
### 5.1 Semantic Scholar Service
```python
# services/semantic_scholar.py
import httpx
from typing import Optional
class SemanticScholarService:
BASE_URL = "https://api.semanticscholar.org/graph/v1"
def __init__(self, api_key: Optional[str] = None):
self.api_key = api_key
self.client = httpx.AsyncClient(
headers={"x-api-key": api_key} if api_key else {}
)
async def search(
self,
query: str,
limit: int = 20,
year_start: Optional[int] = None,
year_end: Optional[int] = None,
fields_of_study: Optional[list[str]] = None
) -> list[dict]:
"""Search papers by query"""
params = {
"query": query,
"limit": min(limit, 100),
"fields": "paperId,title,authors,year,venue,abstract,"
"citationCount,fieldsOfStudy,url,openAccessPdf"
}
if year_start or year_end:
year_filter = f"{year_start or ''}-{year_end or ''}"
params["year"] = year_filter
if fields_of_study:
params["fieldsOfStudy"] = ",".join(fields_of_study)
resp = await self.client.get(
f"{self.BASE_URL}/paper/search",
params=params
)
resp.raise_for_status()
return resp.json().get("data", [])
async def get_paper(self, paper_id: str) -> dict:
"""Get paper by ID"""
resp = await self.client.get(
f"{self.BASE_URL}/paper/{paper_id}",
params={
"fields": "paperId,title,authors,year,venue,abstract,"
"citationCount,citations,references,fieldsOfStudy,"
"url,openAccessPdf"
}
)
resp.raise_for_status()
return resp.json()
def generate_bibtex(self, paper: dict) -> tuple[str, str]:
"""Generate BibTeX key and entry for a paper"""
# Generate key: firstauthorYear
first_author = paper["authors"][0]["name"].split()[-1].lower()
year = paper.get("year", "unknown")
key = f"{first_author}{year}"
# Generate entry
authors = " and ".join(a["name"] for a in paper["authors"])
entry = f"""@article{{{key},
title={{{paper['title']}}},
author={{{authors}}},
year={{{year}}},
venue={{{paper.get('venue', '')}}},
}}"""
return key, entry
```
### 5.2 Citation Manager Service
```python
# services/citation_manager.py
import bibtexparser
from pathlib import Path
from typing import Optional
class CitationManager:
def __init__(self, project_root: Path):
self.bib_path = project_root / "references.bib"
def load(self) -> bibtexparser.Library:
if self.bib_path.exists():
return bibtexparser.parse_file(str(self.bib_path))
return bibtexparser.Library()
def save(self, library: bibtexparser.Library):
bibtexparser.write_file(str(self.bib_path), library)
def add_entry(self, bibtex_str: str) -> tuple[str, bool]:
"""Add entry, returns (key, was_added)"""
library = self.load()
new_entry = bibtexparser.parse_string(bibtex_str).entries[0]
key = new_entry.key
existing_keys = {e.key for e in library.entries}
if key in existing_keys:
return key, False
library.add(new_entry)
self.save(library)
return key, True
def get_all_keys(self) -> list[str]:
library = self.load()
return [e.key for e in library.entries]
def get_all_entries(self) -> list[dict]:
library = self.load()
return [
{
"key": e.key,
"title": e.get("title", ""),
"authors": e.get("author", ""),
"year": int(e.get("year", 0)) if e.get("year") else None
}
for e in library.entries
]
```
### 5.3 RAG Service
```python
# services/rag_service.py
import json
import pickle
import numpy as np
from pathlib import Path
from sentence_transformers import SentenceTransformer
class RAGService:
def __init__(
self,
project_root: Path,
model_name: str = "all-MiniLM-L6-v2"
):
self.project_root = project_root
self.embeddings_path = project_root / ".poly" / "embeddings" / "papers.pkl"
self.model = None # Lazy load
self.model_name = model_name
self._index = None
def _load_model(self):
if self.model is None:
self.model = SentenceTransformer(self.model_name)
def index_papers(self, papers_file: Path) -> int:
"""Index papers for retrieval"""
self._load_model()
papers = json.loads(papers_file.read_text())
texts = []
metadata = []
for paper in papers:
text = f"{paper['title']}. {paper['abstract']}"
texts.append(text)
metadata.append({
"id": paper["id"],
"title": paper["title"],
"abstract": paper["abstract"],
"bibtex_key": paper.get("bibtex_key", "")
})
embeddings = self.model.encode(texts, show_progress_bar=False)
self._index = {
"embeddings": embeddings,
"metadata": metadata
}
self.embeddings_path.parent.mkdir(parents=True, exist_ok=True)
with open(self.embeddings_path, "wb") as f:
pickle.dump(self._index, f)
return len(papers)
def query(self, query: str, k: int = 5) -> list[dict]:
"""Find top-k similar papers"""
if self._index is None:
self._load_index()
if self._index is None:
return []
self._load_model()
query_emb = self.model.encode([query])[0]
embeddings = self._index["embeddings"]
similarities = np.dot(embeddings, query_emb) / (
np.linalg.norm(embeddings, axis=1) * np.linalg.norm(query_emb)
)
top_indices = np.argsort(similarities)[-k:][::-1]
results = []
for idx in top_indices:
meta = self._index["metadata"][idx]
results.append({
"paper_id": meta["id"],
"title": meta["title"],
"abstract": meta["abstract"],
"bibtex_key": meta["bibtex_key"],
"relevance_score": float(similarities[idx])
})
return results
def _load_index(self):
if self.embeddings_path.exists():
with open(self.embeddings_path, "rb") as f:
self._index = pickle.load(f)
def is_indexed(self) -> bool:
return self.embeddings_path.exists()
```
### 5.4 Context Manager Service
```python
# services/context_manager.py
import json
from pathlib import Path
from typing import Optional
class ContextManager:
def __init__(self, project_root: Path):
self.root = project_root
def read_files(self, paths: list[str]) -> tuple[dict, list[str]]:
"""Read multiple files, return contents and missing files"""
contents = {}
missing = []
for path in paths:
full_path = self.root / path
if full_path.exists():
contents[path] = full_path.read_text()
else:
missing.append(path)
return contents, missing
def write_file(self, path: str, content: str, append: bool = False) -> int:
"""Write content to file, return bytes written"""
full_path = self.root / path
full_path.parent.mkdir(parents=True, exist_ok=True)
mode = "a" if append else "w"
with open(full_path, mode) as f:
return f.write(content)
def get_status(self) -> dict:
"""Get project status"""
existing = []
check_paths = [
"literature/papers.json",
"literature/review.md",
"literature/gaps.md",
"ideas/hypotheses.md",
"method/design.md",
"paper/abstract.md",
"paper/introduction.md",
"paper/related_work.md",
"paper/method.md",
"paper/experiments.md",
"paper/conclusion.md",
"references.bib"
]
for path in check_paths:
if (self.root / path).exists():
existing.append(path)
paper_count = 0
papers_file = self.root / "literature" / "papers.json"
if papers_file.exists():
papers = json.loads(papers_file.read_text())
paper_count = len(papers)
citation_count = 0
bib_file = self.root / "references.bib"
if bib_file.exists():
import bibtexparser
lib = bibtexparser.parse_file(str(bib_file))
citation_count = len(lib.entries)
indexed = (self.root / ".poly" / "embeddings" / "papers.pkl").exists()
return {
"project_root": str(self.root),
"existing_files": existing,
"paper_count": paper_count,
"citation_count": citation_count,
"indexed_for_rag": indexed
}
def init_project(self, name: Optional[str] = None) -> dict:
"""Initialize project structure"""
dirs = [
"literature",
"ideas",
"method",
"paper",
".poly/embeddings"
]
created_dirs = []
for d in dirs:
path = self.root / d
if not path.exists():
path.mkdir(parents=True)
created_dirs.append(d)
created_files = []
# Create empty references.bib
bib_path = self.root / "references.bib"
if not bib_path.exists():
bib_path.write_text("")
created_files.append("references.bib")
# Create config
config_path = self.root / ".poly" / "config.yaml"
if not config_path.exists():
import yaml
from datetime import datetime
config = {
"name": name or self.root.name,
"created_at": datetime.now().isoformat(),
"paper_count": 0,
"indexed": False
}
config_path.write_text(yaml.dump(config))
created_files.append(".poly/config.yaml")
return {
"created_dirs": created_dirs,
"created_files": created_files,
"project_root": str(self.root)
}
```
---
## 6. MCP Server Implementation
### 6.1 Server Entry Point
```python
# server.py
from mcp.server import Server
from mcp.server.stdio import stdio_server
from mcp.types import Tool, TextContent
from pathlib import Path
import json
from polyhedra.services.semantic_scholar import SemanticScholarService
from polyhedra.services.citation_manager import CitationManager
from polyhedra.services.rag_service import RAGService
from polyhedra.services.context_manager import ContextManager
# Initialize server
server = Server("polyhedra")
# Services (initialized per project root)
_project_root: Path = Path.cwd()
_papers_service = SemanticScholarService()
_citation_manager: CitationManager = None
_rag_service: RAGService = None
_context_manager: ContextManager = None
def _init_services(project_root: Path = None):
global _project_root, _citation_manager, _rag_service, _context_manager
_project_root = project_root or Path.cwd()
_citation_manager = CitationManager(_project_root)
_rag_service = RAGService(_project_root)
_context_manager = ContextManager(_project_root)
_init_services()
@server.list_tools()
async def list_tools() -> list[Tool]:
return [
Tool(
name="search_papers",
description="Search academic papers on Semantic Scholar",
inputSchema={
"type": "object",
"properties": {
"query": {"type": "string", "description": "Search query"},
"limit": {"type": "integer", "default": 20},
"year_start": {"type": "integer"},
"year_end": {"type": "integer"}
},
"required": ["query"]
}
),
Tool(
name="get_paper",
description="Get detailed paper information by ID",
inputSchema={
"type": "object",
"properties": {
"paper_id": {"type": "string"}
},
"required": ["paper_id"]
}
),
Tool(
name="get_context",
description="Read project files for context",
inputSchema={
"type": "object",
"properties": {
"files": {
"type": "array",
"items": {"type": "string"}
}
},
"required": ["files"]
}
),
Tool(
name="query_similar_papers",
description="Find similar papers using semantic search",
inputSchema={
"type": "object",
"properties": {
"query": {"type": "string"},
"k": {"type": "integer", "default": 5}
},
"required": ["query"]
}
),
Tool(
name="index_papers",
description="Index papers for semantic search",
inputSchema={
"type": "object",
"properties": {
"papers_file": {"type": "string", "default": "literature/papers.json"}
}
}
),
Tool(
name="save_file",
description="Save content to project file",
inputSchema={
"type": "object",
"properties": {
"path": {"type": "string"},
"content": {"type": "string"},
"append": {"type": "boolean", "default": False}
},
"required": ["path", "content"]
}
),
Tool(
name="add_citation",
description="Add BibTeX citation to references.bib",
inputSchema={
"type": "object",
"properties": {
"bibtex": {"type": "string"},
"paper_id": {"type": "string"}
}
}
),
Tool(
name="get_citations",
description="List all citations in references.bib",
inputSchema={
"type": "object",
"properties": {
"keys_only": {"type": "boolean", "default": True}
}
}
),
Tool(
name="get_project_status",
description="Get current project status",
inputSchema={"type": "object", "properties": {}}
),
Tool(
name="init_project",
description="Initialize research project structure",
inputSchema={
"type": "object",
"properties": {
"name": {"type": "string"}
}
}
)
]
@server.call_tool()
async def call_tool(name: str, arguments: dict) -> list[TextContent]:
if name == "search_papers":
papers = await _papers_service.search(
query=arguments["query"],
limit=arguments.get("limit", 20),
year_start=arguments.get("year_start"),
year_end=arguments.get("year_end")
)
# Add BibTeX to each paper
results = []
for p in papers:
key, entry = _papers_service.generate_bibtex(p)
results.append({
"id": p["paperId"],
"title": p["title"],
"authors": [a["name"] for a in p.get("authors", [])],
"year": p.get("year"),
"venue": p.get("venue"),
"abstract": p.get("abstract", ""),
"citation_count": p.get("citationCount", 0),
"bibtex_key": key,
"bibtex_entry": entry
})
# Auto-save to papers.json
papers_path = _project_root / "literature" / "papers.json"
papers_path.parent.mkdir(parents=True, exist_ok=True)
papers_path.write_text(json.dumps(results, indent=2))
return [TextContent(
type="text",
text=json.dumps({
"papers": results,
"total_results": len(results),
"saved_to": "literature/papers.json"
}, indent=2)
)]
elif name == "get_paper":
paper = await _papers_service.get_paper(arguments["paper_id"])
key, entry = _papers_service.generate_bibtex(paper)
result = {
"paper": {
"id": paper["paperId"],
"title": paper["title"],
"authors": [a["name"] for a in paper.get("authors", [])],
"year": paper.get("year"),
"abstract": paper.get("abstract", ""),
"bibtex_key": key,
"bibtex_entry": entry
},
"references": len(paper.get("references", [])),
"citations": len(paper.get("citations", []))
}
return [TextContent(type="text", text=json.dumps(result, indent=2))]
elif name == "get_context":
contents, missing = _context_manager.read_files(arguments["files"])
return [TextContent(
type="text",
text=json.dumps({
"contents": contents,
"missing_files": missing
}, indent=2)
)]
elif name == "query_similar_papers":
results = _rag_service.query(
arguments["query"],
k=arguments.get("k", 5)
)
return [TextContent(type="text", text=json.dumps({"papers": results}, indent=2))]
elif name == "index_papers":
papers_file = _project_root / arguments.get("papers_file", "literature/papers.json")
count = _rag_service.index_papers(papers_file)
return [TextContent(
type="text",
text=json.dumps({"indexed_count": count, "status": "success"})
)]
elif name == "save_file":
bytes_written = _context_manager.write_file(
arguments["path"],
arguments["content"],
append=arguments.get("append", False)
)
return [TextContent(
type="text",
text=json.dumps({
"success": True,
"path": arguments["path"],
"bytes_written": bytes_written
})
)]
elif name == "add_citation":
if arguments.get("bibtex"):
key, added = _citation_manager.add_entry(arguments["bibtex"])
elif arguments.get("paper_id"):
paper = await _papers_service.get_paper(arguments["paper_id"])
_, entry = _papers_service.generate_bibtex(paper)
key, added = _citation_manager.add_entry(entry)
else:
return [TextContent(type="text", text='{"error": "Provide bibtex or paper_id"}')]
return [TextContent(
type="text",
text=json.dumps({"key": key, "added": added})
)]
elif name == "get_citations":
if arguments.get("keys_only", True):
keys = _citation_manager.get_all_keys()
return [TextContent(
type="text",
text=json.dumps({"citations": keys, "count": len(keys)})
)]
else:
entries = _citation_manager.get_all_entries()
return [TextContent(
type="text",
text=json.dumps({"citations": entries, "count": len(entries)})
)]
elif name == "get_project_status":
status = _context_manager.get_status()
return [TextContent(type="text", text=json.dumps(status, indent=2))]
elif name == "init_project":
result = _context_manager.init_project(arguments.get("name"))
return [TextContent(type="text", text=json.dumps(result, indent=2))]
return [TextContent(type="text", text=f"Unknown tool: {name}")]
async def main():
async with stdio_server() as (read_stream, write_stream):
await server.run(read_stream, write_stream)
if __name__ == "__main__":
import asyncio
asyncio.run(main())
```
---
## 7. IDE Integration
### 7.1 Configuration Files
**Cursor** (`.cursor/mcp.json`):
```json
{
"mcpServers": {
"polyhedra": {
"command": "python",
"args": ["-m", "polyhedra.server"],
"env": {}
}
}
}
```
**VS Code / GitHub Copilot** (`settings.json`):
```json
{
"mcp": {
"servers": {
"polyhedra": {
"command": "python",
"args": ["-m", "polyhedra.server"]
}
}
}
}
```
**Windsurf** (`.windsurf/mcp.json`):
```json
{
"mcpServers": {
"polyhedra": {
"command": "python",
"args": ["-m", "polyhedra.server"]
}
}
}
```
### 7.2 IDE Prompt Instructions
Create `.cursorrules` or `.github/copilot-instructions.md`:
```markdown
# Research Project Instructions
This is an academic research project. Use Polyhedra MCP tools for research tasks.
## Workflow
### 1. Literature Search
When asked to find papers or do a literature review:
1. Use `search_papers` to find relevant papers
2. Use `index_papers` to enable semantic search
3. Use `get_context` to read papers.json
4. Generate a literature review and save with `save_file` to literature/review.md
5. For each cited paper, use `add_citation` to update references.bib
### 2. Writing Paper Sections
When writing paper sections:
1. Use `get_context` to load relevant files (review.md, hypotheses.md, etc.)
2. Use `query_similar_papers` to find papers to cite
3. Generate content with proper citations (\cite{key} format)
4. Use `save_file` to save the section
5. Use `add_citation` for any new citations
### 3. Citation Format
- Always use \cite{bibtex_key} or [@bibtex_key] format
- Check existing citations with `get_citations` before adding
- Only cite papers from papers.json
### 4. Project Status
Use `get_project_status` to see what files exist and progress.
## File Locations
- Literature review: literature/review.md
- Paper metadata: literature/papers.json
- Research gaps: literature/gaps.md
- Hypotheses: ideas/hypotheses.md
- Method design: method/design.md
- Paper sections: paper/{section}.md
- Citations: references.bib
```
---
## 8. Functional Requirements
### Requirements Summary Table
| ID | Requirement | Priority | Status |
|----|-------------|----------|--------|
| FR-001 | Paper Search | P0 | Not Started |
| FR-002 | RAG Retrieval | P0 | Not Started |
| FR-003 | Citation Management | P0 | Not Started |
| FR-004 | Context Management | P0 | Not Started |
| FR-005 | Project Initialization | P1 | Not Started |
| NFR-001 | Performance | P0 | Not Started |
| NFR-002 | Reliability | P0 | Not Started |
| NFR-003 | Compatibility | P0 | Not Started |
### FR-001: Paper Search
**Priority**: P0 (Critical)
**Status**: Not Started
**Description**
Search Semantic Scholar API and return structured paper data with automatically generated BibTeX entries.
**Acceptance Criteria**
- Returns papers with all required fields (title, authors, abstract, year, venue, citation count)
- Auto-generates BibTeX key using format: `firstauthor+year`
- Auto-generates valid BibTeX entry
- Saves results to `literature/papers.json`
- Handles API rate limiting gracefully with retry logic
- Returns up to 100 results per query
**Dependencies**: Semantic Scholar API access
---
### FR-002: RAG Retrieval
**Priority**: P0 (Critical)
**Status**: Not Started
**Description**
Index papers locally and enable semantic similarity search for finding relevant citations during writing.
**Acceptance Criteria**
- Indexes paper titles and abstracts using sentence transformers
- Returns top-k most similar papers to a natural language query
- Includes relevance scores (cosine similarity)
- Cached embeddings persist across sessions in `.poly/embeddings/`
- Supports re-indexing when papers.json is updated
**Dependencies**: sentence-transformers, numpy
---
### FR-003: Citation Management
**Priority**: P0 (Critical)
**Status**: Not Started
**Description**
Manage project's `references.bib` file with automatic deduplication and BibTeX validation.
**Acceptance Criteria**
- Add new citations without duplicates (check by key)
- Fetch BibTeX by Semantic Scholar paper ID
- List all citation keys
- List all citation entries with metadata
- Generate 100% valid BibTeX format
- Support manual BibTeX entry addition
**Dependencies**: bibtexparser
---
### FR-004: Context Management
**Priority**: P0 (Critical)
**Status**: Not Started
**Description**
Read and write project files to provide context to IDE's LLM for content generation.
**Acceptance Criteria**
- Read multiple files in one call
- Report missing files (don't fail silently)
- Create parent directories automatically on write
- Support append mode for incremental updates
- Return file contents as structured JSON
- Handle encoding issues gracefully
**Dependencies**: None (standard library)
---
### FR-005: Project Initialization
**Priority**: P1 (High)
**Status**: Not Started
**Description**
Initialize a new research project with standardized directory structure and configuration files.
**Acceptance Criteria**
- Creates standard directories: `literature/`, `ideas/`, `method/`, `paper/`, `.poly/embeddings/`
- Creates empty `references.bib`
- Creates `.poly/config.yaml` with project metadata
- Idempotent (safe to run multiple times)
- Returns list of created directories and files
**Dependencies**: None (standard library)
---
### NFR-001: Performance
**Priority**: P0 (Critical)
**Status**: Not Started
**Description**
Ensure responsive tool execution to maintain IDE assistant responsiveness.
**Acceptance Criteria**
- Paper search: < 2 seconds (including API call)
- Local file operations: < 100ms
- RAG indexing: < 5 seconds for 100 papers
- RAG query: < 500ms
- Citation operations: < 50ms
---
### NFR-002: Reliability
**Priority**: P0 (Critical)
**Status**: Not Started
**Description**
Handle errors gracefully without crashing or losing data.
**Acceptance Criteria**
- API failures return informative error messages
- Network timeouts handled with retry logic
- File I/O errors reported clearly
- Invalid BibTeX rejected with validation errors
- No data corruption on concurrent access
---
### NFR-003: IDE Compatibility
**Priority**: P0 (Critical)
**Status**: Not Started
**Description**
Support major IDEs with MCP protocol compatibility.
**Acceptance Criteria**
- Works with Cursor IDE
- Works with GitHub Copilot (VS Code)
- Works with Windsurf
- Works with VS Code + MCP extension
- Provides configuration templates for each IDE
---
## 9. Development Tasks
### Phase 1: Core Services (Week 1)
```yaml
tasks:
- id: T-001
name: Project setup
description: |
- pyproject.toml with dependencies
- src layout
- Basic tests structure
estimate: 2h
- id: T-002
name: Semantic Scholar service
description: |
- Search endpoint
- Get paper endpoint
- BibTeX generation
- Rate limiting
estimate: 4h
depends_on: [T-001]
- id: T-003
name: Citation manager service
description: |
- BibTeX parsing with bibtexparser
- Add/get/list operations
- Deduplication
estimate: 3h
depends_on: [T-001]
- id: T-004
name: RAG service
description: |
- Paper indexing
- Embedding with sentence-transformers
- Similarity search
- Caching
estimate: 4h
depends_on: [T-001]
- id: T-005
name: Context manager service
description: |
- File read/write
- Project status
- Project init
estimate: 3h
depends_on: [T-001]
```
### Phase 2: MCP Server (Week 2)
```yaml
tasks:
- id: T-006
name: MCP server implementation
description: |
- Server setup with mcp SDK
- All 10 tools implemented
- Tool schemas
estimate: 6h
depends_on: [T-002, T-003, T-004, T-005]
- id: T-007
name: IDE configuration files
description: |
- .cursor/mcp.json template
- .vscode settings template
- .cursorrules template
estimate: 2h
depends_on: [T-006]
- id: T-008
name: Integration testing
description: |
- Test with Cursor
- Test with Copilot
- End-to-end workflow
estimate: 4h
depends_on: [T-006, T-007]
```
### Phase 3: Polish (Week 3)
```yaml
tasks:
- id: T-009
name: Error handling
description: |
- API errors
- File not found
- Invalid inputs
estimate: 3h
depends_on: [T-006]
- id: T-010
name: Documentation
description: |
- README with setup instructions
- Tool documentation
- Example workflows
estimate: 3h
depends_on: [T-008]
- id: T-011
name: Package and publish
description: |
- PyPI setup
- Installation instructions
estimate: 2h
depends_on: [T-010]
```
**Total: ~3 weeks** (down from 8 weeks in v1.x)
---
## 10. Testing Strategy
### Unit Tests
```python
# tests/test_services/test_citation_manager.py
def test_add_citation():
mgr = CitationManager(tmp_path)
bibtex = "@article{test2023, title={Test Paper}}"
key, added = mgr.add_entry(bibtex)
assert key == "test2023"
assert added == True
def test_no_duplicate_citations():
mgr = CitationManager(tmp_path)
bibtex = "@article{test2023, title={Test}}"
mgr.add_entry(bibtex)
key, added = mgr.add_entry(bibtex)
assert added == False
assert len(mgr.get_all_keys()) == 1
```
### Integration Tests
```python
# tests/test_integration.py
async def test_search_and_index_workflow():
# 1. Search papers
result = await call_tool("search_papers", {"query": "transformers", "limit": 5})
papers = json.loads(result[0].text)["papers"]
assert len(papers) == 5
# 2. Index papers
result = await call_tool("index_papers", {})
assert json.loads(result[0].text)["status"] == "success"
# 3. Query similar
result = await call_tool("query_similar_papers", {"query": "attention mechanism", "k": 3})
similar = json.loads(result[0].text)["papers"]
assert len(similar) == 3
```
---
## 11. Success Metrics
### Performance Metrics
| Metric | Target | Measurement Method |
|--------|--------|--------------------|
| Paper Search Response Time | < 2 seconds | Average response time over 100 queries |
| Local Operations | < 100ms | File read/write, citation operations |
| RAG Indexing | < 5 seconds per 100 papers | Benchmark with standard paper set |
| RAG Query | < 500ms | Average query time |
### Quality Metrics
| Metric | Target | Measurement Method |
|--------|--------|--------------------|
| Search Result Relevance | Relevant papers in top 10 | Manual evaluation by researchers |
| Citation Accuracy | 100% valid BibTeX | Automated validation with LaTeX |
| BibTeX Deduplication | 0 duplicate keys | Automated testing |
### Compatibility Metrics
| Metric | Target | Measurement Method |
|--------|--------|--------------------|
| IDE Support | 4+ IDEs supported | Integration testing |
| Setup Time | < 5 minutes | Timed user testing from install to first search |
| Documentation Completeness | 100% API coverage | Documentation review |
### Adoption Metrics (Post-Launch)
| Metric | Target (3 months) | Measurement Method |
|--------|-------------------|--------------------|
| Active Users | 100+ | Telemetry (opt-in) |
| Papers Searched | 10,000+ | Usage statistics |
| Projects Initialized | 50+ | Project creation count |
---
## Appendix A: Example IDE Conversation
```
User: Search for papers about efficient vision transformers
Copilot: I'll search for papers on efficient vision transformers.
[Calls search_papers with query="efficient vision transformers"]
Found 20 papers. Here are the top results:
1. **EfficientViT: Memory Efficient Vision Transformer** (liu2023)
- Citations: 245
- Year: 2023
2. **MobileViT: Light-weight Vision Transformer** (mehta2022)
- Citations: 890
- Year: 2022
...
Papers saved to literature/papers.json. Would you like me to:
1. Generate a literature review
2. Index papers for semantic search
3. Look at a specific paper
User: Generate a literature review and save it
Copilot: I'll read the papers and generate a review.
[Calls get_context with files=["literature/papers.json"]]
[Calls index_papers]
# Literature Review: Efficient Vision Transformers
## Overview
Vision Transformers (ViTs) have achieved remarkable success...
## Taxonomy of Approaches
### 1. Architecture Modifications
...
[Calls save_file with path="literature/review.md"]
[Calls add_citation for each cited paper]
✓ Saved literature review to literature/review.md
✓ Added 12 citations to references.bib
```
---
## Appendix B: Comparison with v1.x
| Aspect | v1.x (Agent-based) | v2.0 (Pure MCP) |
|--------|-------------------|-----------------|
| LLM calls | Internal | IDE handles |
| Complexity | High | Low |
| Dependencies | Many (LLM SDKs) | Few |
| Development time | 8 weeks | 3 weeks |
| Cost | User pays API | IDE subscription |
| Flexibility | Fixed prompts | IDE customizable |
| Maintenance | Prompt updates | Minimal |
|